MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getWindowProps

Function getWindowProps

src/OpenLoco/src/Ui.cpp:199–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197 }
198
199 static SDL_PropertiesID getWindowProps(const Config::Display& cfg)
200 {
201 SDL_PropertiesID props = SDL_CreateProperties();
202 if (props == 0)
203 {
204 throw Exception::RuntimeError(SDL_GetError());
205 }
206
207 int32_t width = std::max(640, cfg.windowResolution.width);
208 int32_t height = std::max(480, cfg.windowResolution.height);
209
210 const auto saneResolution = getSaneWindowedResolution(cfg.index, cfg.windowResolution);
211 width = saneResolution.width;
212 height = saneResolution.height;
213
214 const auto pos = getCenteredPositionOnDisplay(cfg.index, width, height);
215
216 SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "OpenLoco");
217 SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, pos.x);
218 SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, pos.y);
219 SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, width);
220 SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, height);
221 SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN, true);
222 SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, true);
223
224 return props;
225 }
226
227 // 0x00405409
228 void createWindow(const Config::Display& cfg)

Callers 1

createWindowFunction · 0.85

Calls 2

Tested by

no test coverage detected