From d3ccebef152d92f03845831e1f080968708473da Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Sun, 26 Sep 2010 21:34:00 +0000 Subject: [PATCH] switch for map preview in ingame options some language fixes faction preview is default now in unix systems text is better centered on the buttons --- .../menu/menu_state_connected_game.cpp | 5 ++-- .../menu/menu_state_connected_game.h | 1 + .../menu/menu_state_custom_game.cpp | 5 ++-- .../glest_game/menu/menu_state_custom_game.h | 1 + source/glest_game/menu/menu_state_options.cpp | 25 ++++++++++++++++--- source/glest_game/menu/menu_state_options.h | 3 +++ .../sources/platform/unix/gl_wrap.cpp | 5 ++-- 7 files changed, 35 insertions(+), 10 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 4ff0589f6..76b1ce7da 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -81,7 +81,8 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM NetworkManager &networkManager= NetworkManager::getInstance(); Config &config = Config::getInstance(); defaultPlayerName = config.getString("NetPlayerName",Socket::getHostName().c_str()); - enableFactionTexturePreview = config.getBool("FactionPreview","false"); + enableFactionTexturePreview = config.getBool("FactionPreview","true"); + enableMapPreview = config.getBool("MapPreview","true"); vector teamItems, controlItems, results; int setupPos=590; @@ -599,7 +600,7 @@ void MenuStateConnectedGame::render() { if(program != NULL) program->renderProgramMsgBox(); - if(mapPreview.hasFileLoaded() == true) { + if(enableMapPreview && (mapPreview.hasFileLoaded() == true)) { int mouseX = mainMenu->getMouseX(); int mouseY = mainMenu->getMouseY(); diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 23e0de660..d2d9bfc83 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -115,6 +115,7 @@ private: string defaultPlayerName; bool enableFactionTexturePreview; + bool enableMapPreview; string currentFactionLogo; Texture2D *factionTexture; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 876dbe4b5..321d6ca85 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -62,7 +62,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b NetworkManager &networkManager= NetworkManager::getInstance(); Config &config = Config::getInstance(); defaultPlayerName = config.getString("NetPlayerName",Socket::getHostName().c_str()); - enableFactionTexturePreview = config.getBool("FactionPreview","false"); + enableFactionTexturePreview = config.getBool("FactionPreview","true"); + enableMapPreview = config.getBool("MapPreview","true"); showFullConsole=false; @@ -1097,7 +1098,7 @@ void MenuStateCustomGame::render() { if(program != NULL) program->renderProgramMsgBox(); - if(mapPreview.hasFileLoaded() == true) { + if(enableMapPreview && (mapPreview.hasFileLoaded() == true)) { int mouseX = mainMenu->getMouseX(); int mouseY = mainMenu->getMouseY(); diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index 5716c548a..3e188ba97 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -127,6 +127,7 @@ private: int8 switchSetupRequestFlagType; bool enableFactionTexturePreview; + bool enableMapPreview; string currentFactionLogo; Texture2D *factionTexture; diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index ce2c3e90a..248b59458 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -38,8 +38,8 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos); activeInputLabel=NULL; - int leftline=670; - int rightline=670; + int leftline=700; + int rightline=700; int leftLabelStart=250; int leftColumnStart=leftLabelStart+150; int rightLabelStart=500; @@ -64,7 +64,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): labelSoundFactory.setText(lang.get("SoundAndMusic")); listBoxSoundFactory.registerGraphicComponent(containerName,"listBoxSoundFactory"); - listBoxSoundFactory.init(leftColumnStart, leftline, 80); + listBoxSoundFactory.init(leftColumnStart, leftline, 100); listBoxSoundFactory.pushBackItem("None"); listBoxSoundFactory.pushBackItem("OpenAL"); #ifdef WIN32 @@ -276,6 +276,18 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): listBoxUnitParticles.setSelectedItemIndex(clamp(config.getBool("UnitParticles"), 0, 1)); leftline-=30; + //unit particles + labelMapPreview.registerGraphicComponent(containerName,"labelMapPreview"); + labelMapPreview.init(leftLabelStart,leftline); + labelMapPreview.setText(lang.get("ShowMapPreview")); + + listBoxMapPreview.registerGraphicComponent(containerName,"listBoxMapPreview"); + listBoxMapPreview.init(leftColumnStart,leftline,80); + listBoxMapPreview.pushBackItem(lang.get("No")); + listBoxMapPreview.pushBackItem(lang.get("Yes")); + listBoxMapPreview.setSelectedItemIndex(clamp(config.getBool("MapPreview","true"), 0, 1)); + leftline-=30; + // buttons buttonOk.registerGraphicComponent(containerName,"buttonOk"); buttonOk.init(200, buttonRowPos, 100); @@ -291,7 +303,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): buttonVideoInfo.setText(lang.get("VideoInfo")); buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo"); - buttonVideoInfo.init(620, buttonRowPos, 100); + buttonVideoInfo.init(620, buttonRowPos, 125); GraphicComponent::applyAllCustomProperties(containerName); } @@ -393,6 +405,7 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){ listBoxFilter.mouseClick(x, y); listBoxTextures3D.mouseClick(x, y); listBoxUnitParticles.mouseClick(x, y); + listBoxMapPreview.mouseClick(x, y); listBoxLights.mouseClick(x, y); listBoxSoundFactory.mouseClick(x, y); listBoxVolumeFx.mouseClick(x, y); @@ -422,6 +435,7 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){ listBoxShadows.mouseMove(x, y); listBoxTextures3D.mouseMove(x, y); listBoxUnitParticles.mouseMove(x, y); + listBoxMapPreview.mouseMove(x, y); listBoxLights.mouseMove(x, y); listBoxScreenModes.mouseMove(x, y); listFontSizeAdjustment.mouseMove(x, y); @@ -482,6 +496,7 @@ void MenuStateOptions::render(){ renderer.renderListBox(&listBoxShadows); renderer.renderListBox(&listBoxTextures3D); renderer.renderListBox(&listBoxUnitParticles); + renderer.renderListBox(&listBoxMapPreview); renderer.renderListBox(&listBoxLights); renderer.renderListBox(&listBoxFilter); renderer.renderListBox(&listBoxSoundFactory); @@ -494,6 +509,7 @@ void MenuStateOptions::render(){ renderer.renderLabel(&labelShadows); renderer.renderLabel(&labelTextures3D); renderer.renderLabel(&labelUnitParticles); + renderer.renderLabel(&labelMapPreview); renderer.renderLabel(&labelLights); renderer.renderLabel(&labelFilter); renderer.renderLabel(&labelSoundFactory); @@ -536,6 +552,7 @@ void MenuStateOptions::saveConfig(){ config.setString("Filter", listBoxFilter.getSelectedItem()); config.setBool("Textures3D", listBoxTextures3D.getSelectedItemIndex()); config.setBool("UnitParticles", listBoxUnitParticles.getSelectedItemIndex()); + config.setBool("MapPreview", listBoxMapPreview.getSelectedItemIndex()); config.setInt("MaxLights", listBoxLights.getSelectedItemIndex()+1); config.setString("FactorySound", listBoxSoundFactory.getSelectedItem()); config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem()); diff --git a/source/glest_game/menu/menu_state_options.h b/source/glest_game/menu/menu_state_options.h index cbd7216ff..69b4e9816 100644 --- a/source/glest_game/menu/menu_state_options.h +++ b/source/glest_game/menu/menu_state_options.h @@ -70,6 +70,9 @@ private: GraphicLabel labelFontSizeAdjustment; GraphicListBox listFontSizeAdjustment; + GraphicLabel labelMapPreview; + GraphicListBox listBoxMapPreview; + GraphicMessageBox mainMessageBox; int mainMessageBoxState; diff --git a/source/shared_lib/sources/platform/unix/gl_wrap.cpp b/source/shared_lib/sources/platform/unix/gl_wrap.cpp index 1b6a9ef5b..11eab4761 100644 --- a/source/shared_lib/sources/platform/unix/gl_wrap.cpp +++ b/source/shared_lib/sources/platform/unix/gl_wrap.cpp @@ -56,8 +56,9 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, } else { int p = i - fontInfo->min_char_or_byte2; metrics.setWidth(i, static_cast ( - fontInfo->per_char[p].rbearing - - fontInfo->per_char[p].lbearing)); + fontInfo->per_char[p].width)); +// fontInfo->per_char[p].rbearing +// - fontInfo->per_char[p].lbearing)); } }