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

View File

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

View File

@@ -267,6 +267,15 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false")); checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false"));
currentLine-=30; 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 // end
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
@@ -615,8 +624,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
listBoxScreenShotType.mouseClick(x, y); listBoxScreenShotType.mouseClick(x, y);
labelDisableScreenshotConsoleText.mouseClick(x, y);
checkBoxDisableScreenshotConsoleText.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); checkBoxFullscreenWindowed.mouseMove(x, y);
listFontSizeAdjustment.mouseMove(x, y); listFontSizeAdjustment.mouseMove(x, y);
listBoxPublishServerExternalPort.mouseMove(x, y); listBoxPublishServerExternalPort.mouseMove(x, y);
checkBoxEnableFTP.mouseMove(x, y); checkBoxEnableFTP.mouseMove(x, y);
checkBoxEnableFTPServer.mouseMove(x, y); checkBoxEnableFTPServer.mouseMove(x, y);
checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y); checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y);
checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y); checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y);
checkBoxEnablePrivacy.mouseMove(x, y); checkBoxEnablePrivacy.mouseMove(x, y);
checkBoxEnableTextureCompression.mouseMove(x, y); checkBoxEnableTextureCompression.mouseMove(x, y);
listBoxScreenShotType.mouseMove(x, y); listBoxScreenShotType.mouseMove(x, y);
labelDisableScreenshotConsoleText.mouseMove(x, y);
checkBoxDisableScreenshotConsoleText.mouseMove(x, y); checkBoxDisableScreenshotConsoleText.mouseMove(x, y);
checkBoxVisibleHud.mouseMove(x, y);
} }
bool MenuStateOptions::isInSpecialKeyCaptureEvent() { bool MenuStateOptions::isInSpecialKeyCaptureEvent() {
@@ -791,6 +794,9 @@ void MenuStateOptions::render(){
renderer.renderLabel(&labelDisableScreenshotConsoleText); renderer.renderLabel(&labelDisableScreenshotConsoleText);
renderer.renderCheckBox(&checkBoxDisableScreenshotConsoleText); renderer.renderCheckBox(&checkBoxDisableScreenshotConsoleText);
renderer.renderLabel(&labelVisibleHud);
renderer.renderCheckBox(&checkBoxVisibleHud);
} }
renderer.renderConsole(&console,false,true); renderer.renderConsole(&console,false,true);
@@ -841,6 +847,7 @@ void MenuStateOptions::saveConfig(){
config.setString("ScreenShotFileType", listBoxScreenShotType.getSelectedItem()); config.setString("ScreenShotFileType", listBoxScreenShotType.getSelectedItem());
config.setBool("DisableScreenshotConsoleText", !checkBoxDisableScreenshotConsoleText.getValue()); config.setBool("DisableScreenshotConsoleText", !checkBoxDisableScreenshotConsoleText.getValue());
config.setBool("VisibleHud", checkBoxVisibleHud.getValue());
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight"); string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight");
string selectedResolution=listBoxScreenModes.getSelectedItem(); string selectedResolution=listBoxScreenModes.getSelectedItem();

View File

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