📄 gameoption.cpp
字号:
//--------------------------------------------------
// Desc: Options
// Author: artsylee/2007.6.8
//--------------------------------------------------
#include "GameOption.h"
#include "Common.h"
#include "GameCommon.h"
unsigned char g_Brightness = 0;
CGameOption::CGameOption()
{
}
CGameOption::~CGameOption()
{
}
void CGameOption::Load()
{
int Value;
CIniFile option("Config\\Option.ini");
CSlider *pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_BRIGHTNESS);
if(pSlider!=NULL)
{
pSlider->SetRange(0, 50);
Value = option.ReadInt("Config", "Brightness", 50);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_DISTANCE);
if(pSlider!=NULL)
{
pSlider->SetRange(45, 80);
Value = option.ReadInt("Config", "ViewDistance", 50);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_FOG);
if(pSlider!=NULL)
{
pSlider->SetRange(500, 1500);
Value = option.ReadInt("Config", "FogDensity", 500);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_SENSITI);
if(pSlider!=NULL)
{
pSlider->SetRange(1, 8);
Value = option.ReadInt("Config", "Sensitivity", 5);
pSlider->SetValue(Value);
}
CCheckBox *pBox = (CCheckBox*)g_pGUIManager->GetElement(OPTION_CHE_SCREEN);
if(pBox)
{
pBox->SetSelect(option.ReadBOOL("Config", "FullScreen"));
}
}
//--------------------------------------------------
// 每次进入设置界面时加载系统当前的状态值
// (如FullScreen状态多种改变方式时必须加载当前的状态)
//--------------------------------------------------
void CGameOption::LoadCurrent()
{
CCheckBox *pBox = (CCheckBox*)g_pGUIManager->GetElement(OPTION_CHE_SCREEN);
if(pBox)
{
pBox->SetSelect(!g_pGraphics->IsWindowed());
}
}
void CGameOption::SaveValue()
{
int Value;
CIniFile option("Config\\Option.ini");
CSlider *pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_BRIGHTNESS);
if(pSlider!=NULL)
{
Value = pSlider->GetValue();
option.WriteInt("Config", "Brightness", Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_DISTANCE);
if(pSlider!=NULL)
{
Value = pSlider->GetValue();
option.WriteInt("Config", "ViewDistance", Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_FOG);
if(pSlider!=NULL)
{
Value = pSlider->GetValue();
option.WriteInt("Config", "FogDensity", Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_SENSITI);
if(pSlider!=NULL)
{
Value = pSlider->GetValue();
option.WriteInt("Config", "Sensitivity", Value);
}
CCheckBox *pBox = (CCheckBox*)g_pGUIManager->GetElement(OPTION_CHE_SCREEN);
if(pBox)
{
option.WriteBOOL("Config", "FullScreen", pBox->GetSelect());
}
option.Save(NULL);
}
void CGameOption::LoadDefault()
{
int Value;
CIniFile option("Config\\Option.ini");
CSlider *pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_BRIGHTNESS);
if(pSlider!=NULL)
{
Value = option.ReadInt("Default", "Brightness", 50);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_DISTANCE);
if(pSlider!=NULL)
{
Value = option.ReadInt("Default", "ViewDistance", 50);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_FOG);
if(pSlider!=NULL)
{
Value = option.ReadInt("Default", "FogDensity", 500);
pSlider->SetValue(Value);
}
pSlider = (CSlider*)g_pGUIManager->GetElement(OPTION_SLI_SENSITI);
if(pSlider!=NULL)
{
Value = option.ReadInt("Default", "Sensitivity", 5);
pSlider->SetValue(Value);
}
CCheckBox *pBox = (CCheckBox*)g_pGUIManager->GetElement(OPTION_CHE_SCREEN);
if(pBox)
{
pBox->SetSelect(option.ReadBOOL("Default", "FullScreen"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -