1
0
Fork 0

setup handles floats as well

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1621
This commit is contained in:
Peter Veenstra 2004-01-29 09:26:52 +00:00
parent 2436917d8c
commit 0f2a610b63
3 changed files with 40 additions and 7 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.h,v 1.14 2004-01-08 11:45:24 qbix79 Exp $ */
/* $Id: setup.h,v 1.15 2004-01-29 09:26:43 qbix79 Exp $ */
#ifndef _SETUP_H_
#define _SETUP_H_
@ -55,6 +55,7 @@ union Value{
bool _bool;
int _int;
std::string* _string;
float _float;
};
class Property {
@ -77,6 +78,15 @@ public:
void GetValuestring(char* str);
~Prop_int(){ }
};
class Prop_float:public Property {
public:
Prop_float(const char* _propname, float _value):Property(_propname){
__value._float=_value;
}
void SetValue(char* input);
void GetValuestring(char* str);
~Prop_float(){ }
};
class Prop_bool:public Property {
public:
@ -145,11 +155,13 @@ class Section_prop:public Section {
void Add_string(const char* _propname, char* _value=NULL);
void Add_bool(const char* _propname, bool _value=false);
void Add_hex(const char* _propname, int _value=0);
void Add_float(const char* _propname, float _value=0.0);
int Get_int(const char* _propname);
const char* Get_string(const char* _propname);
bool Get_bool(const char* _propname);
int Get_hex(const char* _propname);
int Get_hex(const char* _propname);
float Get_float(const char* _propname);
void HandleInputline(char *gegevens);
void PrintData(FILE* outfile);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: sdlmain.cpp,v 1.57 2004-01-28 15:12:38 harekiet Exp $ */
/* $Id: sdlmain.cpp,v 1.58 2004-01-29 09:26:45 qbix79 Exp $ */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
@ -539,7 +539,7 @@ static void GUI_StartUp(Section * sec) {
sdl.desktop.width=section->Get_int("fullwidth");
sdl.desktop.height=section->Get_int("fullheight");
sdl.desktop.doublebuf=section->Get_bool("fulldouble");
sdl.desktop.hwscale=1.2;
sdl.desktop.hwscale=section->Get_float("hwscale");
if (!sdl.desktop.width) {
#ifdef WIN32
sdl.desktop.width=GetSystemMetrics(SM_CXSCREEN);
@ -910,7 +910,7 @@ int main(int argc, char* argv[]) {
sdl_sec->Add_int("fullwidth",0);
sdl_sec->Add_int("fullheight",0);
sdl_sec->Add_string("output","surface");
sdl_sec->Add_string("hwscale","1.0");
sdl_sec->Add_float("hwscale",1.0);
sdl_sec->Add_bool("autolock",true);
sdl_sec->Add_int("sensitivity",100);
sdl_sec->Add_bool("waitonerror",true);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.cpp,v 1.18 2004-01-08 11:46:40 qbix79 Exp $ */
/* $Id: setup.cpp,v 1.19 2004-01-29 09:26:52 qbix79 Exp $ */
#include "dosbox.h"
#include "cross.h"
@ -30,6 +30,10 @@
using namespace std;
void Prop_float::SetValue(char* input){
input=trim(input);
__value._float= atof(input);
}
void Prop_int::SetValue(char* input){
input=trim(input);
@ -66,10 +70,20 @@ void Prop_bool::GetValuestring(char* str){
sprintf(str,"%s",__value._bool?"true":"false");
}
void Prop_float::GetValuestring(char* str){
sprintf(str,"%1.2f",__value._float);
}
void Prop_hex::GetValuestring(char* str){
sprintf(str,"%X",__value._hex);
}
void Section_prop::Add_float(const char* _propname, float _value) {
Property* test=new Prop_float(_propname,_value);
properties.push_back(test);
}
void Section_prop::Add_int(const char* _propname, int _value) {
Property* test=new Prop_int(_propname,_value);
properties.push_back(test);
@ -105,7 +119,14 @@ bool Section_prop::Get_bool(const char* _propname){
}
return false;
}
float Section_prop::Get_float(const char* _propname){
for(it tel=properties.begin();tel!=properties.end();tel++){
if((*tel)->propname==_propname){
return ((*tel)->GetValue())._float;
}
}
return false;
}
const char* Section_prop::Get_string(const char* _propname){
for(it tel=properties.begin();tel!=properties.end();tel++){