ok. i just got it that when i look at my '
int' variables are giving random out puts when converted to char.
so im a bit confused on why thou.
this is my source for my settings
class CSetting
{
//private
private:
//level
int AntiAliasingLevel;
int AnitsotropicLevel;
int SoundLevel;
//window
int GameWindowWidth;
int GameWindowHieght;
///////////////////
//Check Values
int AntiAliasingLevelA;
int AnitsotropicLevelA;
int SoundLevelA;
//window
int GameWindowWidthA;
int GameWindowHieghtA;
//////////////////////
bool FullScreen;
//on of variables
bool EnableSound;
bool EnableAnitsotropic;
bool EnableAntiAliasing;
//public:
public:
void SystemSetUp();
void SystemShutDown();
void SettingsGet();
void SettingsChange(int Mode,bool On,int Level);
void SettingsNext(int Mode);
bool SettingEnable(int Mode);
int SettingGetAnitsotropic();
int SettingGetAntiAliasing();
int SettingGetSoundLevel();
int SettingGetResolution(bool A);
void SettingDrawAll();
};
void CSetting::SystemSetUp()
{
//set up settings in case cant find ini file
AntiAliasingLevel=0;
AnitsotropicLevel=0;
SoundLevel=100;
GameWindowWidth=1024;
GameWindowHieght=768;
/////////////////////
AntiAliasingLevelA=0;
AnitsotropicLevelA=0;
SoundLevelA=100;
GameWindowWidthA=1024;
GameWindowHieghtA=768;
//////////////////////
FullScreen=false;
EnableSound=true;
EnableAnitsotropic=false;
EnableAntiAliasing=false;
}
void CSetting::SystemShutDown()
{
//save settings
char* AppSettings = "AppSettingsEnable";
char* FileName="Media\\SilenFuryApp.ini";
//sound
WritePrivateProfileString(AppSettings,"SoundEnable",dbStr(EnableSound),FileName);
WritePrivateProfileString(AppSettings,"SoundLevel",dbStr(SoundLevel),FileName);
//resolution
WritePrivateProfileString(AppSettings,"WindowWidth",dbStr(GameWindowWidth),FileName);
WritePrivateProfileString(AppSettings,"WindowHieght",dbStr(GameWindowHieght),FileName);
WritePrivateProfileString(AppSettings,"FullScreen",dbStr(FullScreen),FileName);
//texture filter
WritePrivateProfileString(AppSettings,"AnitsotropicEnable",dbStr(EnableAnitsotropic),FileName);
WritePrivateProfileString(AppSettings,"AnitsotropicLevel",dbStr(AnitsotropicLevel),FileName);
//AntiAliasing
WritePrivateProfileString(AppSettings,"AntiAliasingEnable",dbStr(EnableAntiAliasing),FileName);
WritePrivateProfileString(AppSettings,"AntiAliasingLevel",dbStr(AntiAliasingLevel),FileName);
}
void CSetting::SettingsGet()
{
//read the ini file for info
char* FileName="Media\\SilenFuryApp.ini";
char* AppSettings = "AppSettingsEnable";
//draw text
dbCenterText(512,384,"Loading Setting...");
dbSync();
//get the stuff
if (dbFileExist(FileName))
{
//sound
EnableSound = GetPrivateProfileIntA(AppSettings,"SoundEnable",true,FileName);
SoundLevel = GetPrivateProfileIntA(AppSettings,"SoundLevel",100,FileName);
//resolution
GameWindowWidth = GetPrivateProfileIntA(AppSettings,"WindowWidth",1024,FileName);
GameWindowHieght = GetPrivateProfileIntA(AppSettings,"WindowHieght",768,FileName);
FullScreen = GetPrivateProfileIntA(AppSettings,"FullScreen",false,FileName);
//texture filter
EnableAnitsotropic = GetPrivateProfileIntA(AppSettings,"AnitsotropicEnable",false,FileName);
AnitsotropicLevel = GetPrivateProfileIntA(AppSettings,"AnitsotropicLevel",0,FileName);
//AntiAliasing
EnableAntiAliasing = GetPrivateProfileIntA(AppSettings,"AntiAliasingEnable",false,FileName);
AntiAliasingLevel = GetPrivateProfileIntA(AppSettings,"AntiAliasingLevel",0,FileName);
}
}
void CSetting::SettingsChange(int Mode,bool On,int Level)
{
//changing the settings
switch(Mode)
{
//resolution
case 1:
break;
}
}
void CSetting::SettingsNext(int Mode)
{
//this is to change settings
switch(Mode)
{
case 1: //sound
SoundLevel+=10;if (SoundLevel>100){SoundLevel=0;}
break;
case 2: //texture
AnitsotropicLevel+=4;if (AnitsotropicLevel>=16){AnitsotropicLevel=4;}
break;
case 3: //AntiAliasing
AntiAliasingLevel+=2;if(AntiAliasingLevel>=8){AntiAliasingLevel=0;}
break;
case 4: //fullscreen
if (FullScreen){FullScreen=false;}else{FullScreen=true;}
break;
}
}
bool CSetting::SettingEnable(int Mode)
{
switch(Mode) //check for the mode
{
case 1: //sound
return EnableSound;
break;
case 2: //filter texture
return EnableAnitsotropic;
break;
case 3: //AntiAliasing
return EnableAntiAliasing;
break;
case 4: //full screen
return FullScreen;
break;
default:
return false;
break;
}
}
int CSetting::SettingGetAnitsotropic()
{
return AnitsotropicLevel;
}
int CSetting::SettingGetAntiAliasing()
{
return AntiAliasingLevel;
}
int CSetting::SettingGetSoundLevel()
{
return SoundLevel;
}
int CSetting::SettingGetResolution(bool A)
{
if ((GameWindowWidth==1024)&(GameWindowHieght==768))
{return 1;}
else
{return 0;}
}
void CSetting::SettingDrawAll()
{
if (inputState.IsKeyDown(VK_MBUTTON))
{
//manual setting level
AAText(1,750,220,ALIGN_LEFT,dbStr(5));//resolution
AAText(1,750,320,ALIGN_LEFT,dbStr(SoundLevel));//sound
AAText(1,750,420,ALIGN_LEFT,dbStr(AnitsotropicLevel));//texture filter
AAText(1,750,520,ALIGN_LEFT,dbStr(AntiAliasingLevel));//3d anti
AAText(1,750,620,ALIGN_LEFT,dbStr(GameWindowWidth));//full screen
}else{
//check values
AAText(1,750,320,ALIGN_LEFT,dbStr(SoundLevelA));//sound
AAText(1,750,420,ALIGN_LEFT,dbStr(AnitsotropicLevelA));//texture filter
AAText(1,750,520,ALIGN_LEFT,dbStr(AntiAliasingLevelA));//3d anti
AAText(1,750,620,ALIGN_LEFT,dbStr(GameWindowWidthA));//full screen
}
for(int i=0;i<=4;i++)
{AAText(1,610,220+(i*100),ALIGN_LEFT,"Mode");}
}
'AATEXT' is used for drawing text. see thread for more details.
any ideas on what to do?
what can i do to write my own function for converting int to char*?
Problem Solution That Never Fails: "Build A Bridge And Get Over It"