Changeset 25966
- Timestamp:
- Oct 17, 2021, 12:58:51 PM (3 years ago)
- Location:
- ps/trunk
- Files:
-
- 5 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/mod/gui/common/functions_msgbox.js
r22676 r25966 16 16 } 17 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 18 36 function openURL(url) 19 37 { -
ps/trunk/binaries/data/mods/mod/gui/msgbox/msgbox.js
r22676 r25966 25 25 let captions = data.buttonCaptions || [translate("OK")]; 26 26 27 // Set button captions and visibility28 27 let mbButton = []; 29 captions.forEach((caption, i) => { 30 mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i + 1)); 31 mbButton[i].caption = caption; 32 mbButton[i].hidden = false; 33 mbButton[i].onPress = () => { 34 Engine.PopGuiPage(i); 35 }; 36 37 // Convention: Cancel is the first button 38 if (i == 0) 39 mbCancelHotkey.onPress = mbButton[i].onPress; 40 }); 41 42 // Distribute buttons horizontally 43 let y1 = "100%-46"; 44 let y2 = "100%-18"; 45 switch (captions.length) 46 { 47 case 1: 48 mbButton[0].size = "18 " + y1 + " 100%-18 " + y2; 49 break; 50 case 2: 51 mbButton[0].size = "18 " + y1 + " 50%-5 " + y2; 52 mbButton[1].size = "50%+5 " + y1 + " 100%-18 " + y2; 53 break; 54 case 3: 55 mbButton[0].size = "18 " + y1 + " 33%-5 " + y2; 56 mbButton[1].size = "33%+5 " + y1 + " 66%-5 " + y2; 57 mbButton[2].size = "66%+5 " + y1 + " 100%-18 " + y2; 58 break; 59 } 28 setButtonCaptionsAndVisibitily(mbButton, captions, mbCancelHotkey, "mbButton"); 29 distributeButtonsHorizontally(mbButton, captions); 60 30 } -
ps/trunk/binaries/data/mods/public/gui/options/options.js
r24445 r25966 147 147 } 148 148 }, 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 149 178 "slider": 150 179 { … … 243 272 optionType.sanitizeValue(value, control, option); 244 273 274 275 245 276 control.tooltip = option.tooltip + (optionType.tooltip ? "\n" + optionType.tooltip(value, option) : ""); 246 277 278 247 279 Engine.ConfigDB_CreateValue("user", option.config, String(value)); 248 280 Engine.ConfigDB_SetChanges("user", true); … … 250 282 g_ChangedKeys.add(option.config); 251 283 fireConfigChangeHandlers(new Set([option.config])); 284 285 286 252 287 253 288 if (option.function) … … 314 349 Engine.ConfigDB_WriteFile("user", "config/user.cfg"); 315 350 revertChanges(); 351 352 353 354 355 356 357 358 359 360 361 362 316 363 } 317 364 -
ps/trunk/binaries/data/mods/public/gui/options/options.json
r25866 r25966 151 151 "min": 20, 152 152 "max": 100 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 153 171 } 154 172 ] -
ps/trunk/binaries/data/mods/public/gui/options/options.xml
r23947 r25966 34 34 <object name="option_control_number[n]" size="65% 0 100%-8 100%" type="input" style="ModernInput"/> 35 35 <object name="option_control_dropdown[n]" size="65% 0 100%-8 100%" type="dropdown" style="ModernDropDown" tooltip_style="tooltipInstant"/> 36 36 37 <object name="option_control_slider[n]" size="65% 0 100%-8 100%" type="slider" style="ModernSlider"/> 37 38 </object> -
ps/trunk/source/gui/CGUI.cpp
r25746 r25966 43 43 #include "ps/Profile.h" 44 44 #include "ps/Pyrogenesis.h" 45 45 46 #include "ps/XML/Xeromyces.h" 46 47 #include "scriptinterface/ScriptContext.h" … … 155 156 // constant conversions when operating in a 156 157 // float-based environment. 157 m_MousePos = CVector2D((float)ev->ev.motion.x / g_ GuiScale, (float)ev->ev.motion.y / g_GuiScale);158 m_MousePos = CVector2D((float)ev->ev.motion.x / g_); 158 159 159 160 SGUIMessage msg(GUIM_MOUSE_MOTION); … … 180 181 if (ev->ev.type == SDL_MOUSEBUTTONDOWN || ev->ev.type == SDL_MOUSEBUTTONUP) 181 182 { 182 m_MousePos = CVector2D((float)ev->ev.button.x / g_ GuiScale, (float)ev->ev.button.y / g_GuiScale);183 m_MousePos = CVector2D((float)ev->ev.button.x / g_); 183 184 } 184 185 … … 421 422 CSize2D CGUI::GetWindowSize() const 422 423 { 423 return CSize2D{static_cast<float>(g_xres) / g_ GuiScale, static_cast<float>(g_yres) / g_GuiScale};424 return CSize2D{static_cast<float>(g_xres) / g_}; 424 425 } 425 426 -
ps/trunk/source/gui/CGUIText.cpp
r25645 r25966 27 27 #include "gui/SettingTypes/CGUIString.h" 28 28 #include "ps/CStrInternStatic.h" 29 29 30 #include "renderer/Renderer.h" 30 31 … … 32 33 33 34 extern int g_xres, g_yres; 34 extern float g_GuiScale;35 35 36 36 // TODO Gee: CRect => CPoint ? … … 440 440 clipping.right = std::floor(clipping.right); 441 441 442 442 443 glEnable(GL_SCISSOR_TEST); 443 444 glScissor( 444 std::ceil(clipping.left * g_GuiScale),445 std::ceil(g_yres - clipping.bottom * g_GuiScale),446 std::floor(clipping.GetWidth() * g_GuiScale),447 std::floor(clipping.GetHeight() * g_GuiScale));445 std::ceil(clipping.left * cale), 446 std::ceil(g_yres - clipping.bottom * cale), 447 std::floor(clipping.GetWidth() * cale), 448 std::floor(clipping.GetHeight() * cale)); 448 449 } 449 450 -
ps/trunk/source/gui/GUIMatrix.cpp
r22605 r25966 1 /* Copyright (C) 20 19Wildfire Games.1 /* Copyright (C) 20 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 19 19 20 20 #include "GUIMatrix.h" 21 21 #include "ps/VideoMode.h" 22 22 #include "maths/Matrix3D.h" 23 23 24 24 extern int g_xres, g_yres; 25 extern float g_GuiScale;26 25 27 26 CMatrix3D GetDefaultGuiMatrix() 28 27 { 29 float xres = g_xres / g_ GuiScale;30 float yres = g_yres / g_ GuiScale;28 float xres = g_xres / g_; 29 float yres = g_yres / g_; 31 30 32 31 CMatrix3D m; -
ps/trunk/source/gui/ObjectTypes/CInput.cpp
r25693 r25966 32 32 #include "ps/Globals.h" 33 33 #include "ps/Hotkey.h" 34 34 35 #include "renderer/Renderer.h" 35 36 … … 1239 1240 if (cliparea != CRect()) 1240 1241 { 1242 1241 1243 glEnable(GL_SCISSOR_TEST); 1242 1244 glScissor( 1243 cliparea.left * g_GuiScale,1244 g_yres - cliparea.bottom * g_GuiScale,1245 cliparea.GetWidth() * g_GuiScale,1246 cliparea.GetHeight() * g_GuiScale);1245 cliparea.left * cale, 1246 g_yres - cliparea.bottom * cale, 1247 cliparea.GetWidth() * cale, 1248 cliparea.GetHeight() * cale); 1247 1249 } 1248 1250 -
ps/trunk/source/ps/CConsole.cpp
r25648 r25966 46 46 #include "ps/Profile.h" 47 47 #include "ps/Pyrogenesis.h" 48 48 49 #include "scriptinterface/ScriptInterface.h" 49 50 #include "scriptinterface/JSON.h" … … 117 118 m_fY = 0; 118 119 float height = h * 0.6f; 119 m_fWidth = w / g_ GuiScale;120 m_fHeight = height / g_ GuiScale;120 m_fWidth = w / g_; 121 m_fHeight = height / g_; 121 122 } 122 123 -
ps/trunk/source/ps/GameSetup/Config.cpp
r25936 r25966 30 30 31 31 int g_xres, g_yres; 32 float g_GuiScale = 1.0f;33 32 34 33 bool g_Quickstart = false; … … 43 42 { 44 43 CFG_GET_VAL("pauseonfocusloss", g_PauseOnFocusLoss); 45 46 CFG_GET_VAL("gui.scale", g_GuiScale);47 44 } 48 49 45 50 46 static void ProcessCommandLineArgs(const CmdLineArgs& args) -
ps/trunk/source/ps/GameSetup/Config.h
r25936 r25966 25 25 26 26 extern int g_xres, g_yres; 27 extern float g_GuiScale;28 27 29 28 extern bool g_Quickstart; -
ps/trunk/source/ps/VideoMode.cpp
r25936 r25966 179 179 return; 180 180 } 181 const float scale = g_ GuiScale;181 const float scale = g_; 182 182 if (scale != 1.0) 183 183 { … … 223 223 CFG_GET_VAL("windowed", windowed); 224 224 m_ConfigFullscreen = !windowed; 225 226 225 227 226 228 CFG_GET_VAL("xres", m_ConfigW); … … 517 519 } 518 520 521 522 523 524 525 526 527 528 529 530 531 532 519 533 bool CVideoMode::SetFullscreen(bool fullscreen) 520 534 { -
ps/trunk/source/ps/VideoMode.h
r25936 r25966 53 53 54 54 /** 55 56 57 58 59 55 60 * Switch to fullscreen or windowed mode. 56 61 */ … … 90 95 int GetDesktopFreq() const; 91 96 97 98 92 99 SDL_Window* GetWindow(); 93 100 … … 117 124 int m_PreferredBPP = 0; 118 125 int m_PreferredFreq = 0; 126 127 119 128 120 129 // Config file settings (0 if unspecified) -
ps/trunk/source/ps/scripting/JSInterface_ConfigDB.cpp
r25866 r25966 22 22 #include "ps/ConfigDB.h" 23 23 #include "ps/CLogger.h" 24 24 25 #include "scriptinterface/FunctionWrapper.h" 25 26 #include "scriptinterface/ScriptRequest.h" … … 194 195 } 195 196 197 198 199 200 201 196 202 void RegisterScriptFunctions(const ScriptRequest& rq) 197 203 { … … 208 214 ScriptFunction::Register<&Reload>(rq, "ConfigDB_Reload"); 209 215 ScriptFunction::Register<&PauseOnFocusLoss>(rq, "PauseOnFocusLoss"); 210 } 211 } 216 ScriptFunction::Register<&SetGUIScale>(rq, "SetGUIScale"); 217 } 218 }
Note:
See TracChangeset
for help on using the changeset viewer.