switch in options to show HUD or not ( if available )

This commit is contained in:
Titus Tscharntke 2011-06-09 22:54:45 +00:00
parent 36c25f709d
commit ca75809f2d
4 changed files with 24 additions and 10 deletions

View File

@ -75,6 +75,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
this->gameSettings= *gameSettings;
scrollSpeed = Config::getInstance().getFloat("UiScrollSpeed","1.5");
photoModeEnabled = Config::getInstance().getBool("PhotoMode","false");
visibleHUD = Config::getInstance().getBool("VisibleHud","true");
//MIN_RENDER_FPS_ALLOWED = Config::getInstance().getInt("MIN_RENDER_FPS_ALLOWED",intToStr(MIN_RENDER_FPS_ALLOWED).c_str());
mouseX=0;
@ -1885,8 +1886,9 @@ void Game::render2d(){
renderer.reset2d();
//HUD
renderer.renderHud();
if(visibleHUD == true) {
renderer.renderHud();
}
//display
renderer.renderDisplay();

View File

@ -115,6 +115,7 @@ private:
int renderFpsAvgTest;
bool photoModeEnabled;
bool visibleHUD;
Program *program;
bool gameStarted;

View File

@ -267,6 +267,15 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false"));
currentLine-=30;
labelVisibleHud.registerGraphicComponent(containerName,"lavelVisibleHud");
labelVisibleHud.init(currentLabelStart ,currentLine);
labelVisibleHud.setText(lang.get("VisibleHUD"));
checkBoxVisibleHud.registerGraphicComponent(containerName,"checkBoxVisibleHud");
checkBoxVisibleHud.init(currentColumnStart ,currentLine );
checkBoxVisibleHud.setValue(config.getBool("VisibleHud","true"));
currentLine-=30;
// end
//////////////////////////////////////////////////////////////////
@ -615,8 +624,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
listBoxScreenShotType.mouseClick(x, y);
labelDisableScreenshotConsoleText.mouseClick(x, y);
checkBoxDisableScreenshotConsoleText.mouseClick(x, y);
checkBoxVisibleHud.mouseClick(x, y);
}
}
@ -646,21 +655,15 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
checkBoxFullscreenWindowed.mouseMove(x, y);
listFontSizeAdjustment.mouseMove(x, y);
listBoxPublishServerExternalPort.mouseMove(x, y);
checkBoxEnableFTP.mouseMove(x, y);
checkBoxEnableFTPServer.mouseMove(x, y);
checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y);
checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y);
checkBoxEnablePrivacy.mouseMove(x, y);
checkBoxEnableTextureCompression.mouseMove(x, y);
listBoxScreenShotType.mouseMove(x, y);
labelDisableScreenshotConsoleText.mouseMove(x, y);
checkBoxDisableScreenshotConsoleText.mouseMove(x, y);
checkBoxVisibleHud.mouseMove(x, y);
}
bool MenuStateOptions::isInSpecialKeyCaptureEvent() {
@ -791,6 +794,9 @@ void MenuStateOptions::render(){
renderer.renderLabel(&labelDisableScreenshotConsoleText);
renderer.renderCheckBox(&checkBoxDisableScreenshotConsoleText);
renderer.renderLabel(&labelVisibleHud);
renderer.renderCheckBox(&checkBoxVisibleHud);
}
renderer.renderConsole(&console,false,true);
@ -841,6 +847,7 @@ void MenuStateOptions::saveConfig(){
config.setString("ScreenShotFileType", listBoxScreenShotType.getSelectedItem());
config.setBool("DisableScreenshotConsoleText", !checkBoxDisableScreenshotConsoleText.getValue());
config.setBool("VisibleHud", checkBoxVisibleHud.getValue());
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight");
string selectedResolution=listBoxScreenModes.getSelectedItem();

View File

@ -114,6 +114,10 @@ private:
GraphicLabel labelDisableScreenshotConsoleText;
GraphicCheckBox checkBoxDisableScreenshotConsoleText;
GraphicLabel labelVisibleHud;
GraphicCheckBox checkBoxVisibleHud;
public:
MenuStateOptions(Program *program, MainMenu *mainMenu);