Examples: SDL: Initial attempt at implementing the viewport/platform api. (WIP/test API) (#1542)

ImGui_ImplSDL2_Init() now takes a SDL GL context.
This commit is contained in:
omar
2018-02-27 23:30:39 +01:00
parent 4cee46f909
commit cb601d79e8
5 changed files with 261 additions and 50 deletions

View File

@ -31,13 +31,13 @@ int main(int, char**)
SDL_DisplayMode current;
SDL_GetCurrentDisplayMode(0, &current);
SDL_Window *window = SDL_CreateWindow("ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE);
SDL_GLContext glcontext = SDL_GL_CreateContext(window);
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
SDL_GL_SetSwapInterval(1); // Enable vsync
// Setup ImGui binding
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui_ImplSDL2_Init(window);
ImGui_ImplSDL2_Init(window, gl_context);
ImGui_ImplOpenGL2_Init();
//io.NavFlags |= ImGuiNavFlags_EnableKeyboard; // Enable Keyboard Controls
@ -134,7 +134,7 @@ int main(int, char**)
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
SDL_GL_DeleteContext(glcontext);
SDL_GL_DeleteContext(gl_context);
SDL_DestroyWindow(window);
SDL_Quit();