Examples: SDL: Minor fixes to follow syntax of other examples (#495)

This commit is contained in:
ocornut 2016-03-25 22:25:20 +01:00
parent 8a61c0afea
commit e6c2c1fcfd
2 changed files with 6 additions and 8 deletions

View File

@ -350,12 +350,11 @@ void ImGui_ImplSdlGL3_NewFrame()
// Setup display size (every frame to accommodate for window resizing)
int w, h;
int display_w, display_h;
SDL_GetWindowSize(g_Window, &w, &h);
SDL_GL_GetDrawableSize(g_Window, &display_w, &display_h);
io.DisplaySize = ImVec2((float)w, (float)h);
int glW, glH;
SDL_GL_GetDrawableSize(window, &glW, &glH);
io.DisplayFramebufferScale = ImVec2(glW / io.DisplaySize.x, glH / io.DisplaySize.y);
io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0);
// Setup time step
Uint32 time = SDL_GetTicks();

View File

@ -237,12 +237,11 @@ void ImGui_ImplSdl_NewFrame(SDL_Window *window)
// Setup display size (every frame to accommodate for window resizing)
int w, h;
int display_w, display_h;
SDL_GetWindowSize(window, &w, &h);
SDL_GL_GetDrawableSize(window, &display_w, &display_h);
io.DisplaySize = ImVec2((float)w, (float)h);
int glW, glH;
SDL_GL_GetDrawableSize(window, &glW, &glH);
io.DisplayFramebufferScale = ImVec2(glW / io.DisplaySize.x, glH / io.DisplaySize.y);
io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0);
// Setup time step
Uint32 time = SDL_GetTicks();