MCPcopy Create free account
hub / github.com/defold/defold / SetPhysicalResolution

Function SetPhysicalResolution

engine/gui/src/gui.cpp:285–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283 }
284
285 void SetPhysicalResolution(HContext context, uint32_t width, uint32_t height)
286 {
287 context->m_PhysicalWidth = width;
288 context->m_PhysicalHeight = height;
289 if (!context->m_UseSafeAreaAdjust)
290 {
291 context->m_AdjustWidth = width;
292 context->m_AdjustHeight = height;
293 context->m_AdjustOffsetX = 0.0f;
294 context->m_AdjustOffsetY = 0.0f;
295 }
296 dmArray<HScene>& scenes = context->m_Scenes;
297 uint32_t scene_count = scenes.Size();
298
299 for (uint32_t i = 0; i < scene_count; ++i)
300 {
301 Scene* scene = scenes[i];
302 scene->m_ResChanged = 1;
303 if (!scene->m_SafeAreaModeOverride)
304 {
305 SetSceneSafeAreaAdjust(scene, context->m_UseSafeAreaAdjust,
306 context->m_AdjustWidth, context->m_AdjustHeight,
307 context->m_AdjustOffsetX, context->m_AdjustOffsetY);
308 }
309 if(scene->m_OnWindowResizeCallback)
310 {
311 scene->m_OnWindowResizeCallback(scene, width, height);
312 }
313 }
314 }
315
316 static void SetSceneSafeAreaAdjust(Scene* scene, bool enabled, uint32_t width, uint32_t height, float offset_x, float offset_y)
317 {

Callers 3

OnWindowResizeFunction · 0.50
TEST_FFunction · 0.50
SetupGuiTestSceneFunction · 0.50

Calls 2

SetSceneSafeAreaAdjustFunction · 0.85
SizeMethod · 0.45

Tested by 2

TEST_FFunction · 0.40
SetupGuiTestSceneFunction · 0.40