6 changed files with 137 additions and 21 deletions
@ -1 +1 @@ |
|||||||
Subproject commit dd0659c0298a8ee3925f8f6ca01ae37091d2ba32 |
Subproject commit 6be56bc532c12fe02c8de9218c97c2d354f64a2e |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
|
||||||
|
#include <GL/glew.h> |
||||||
|
|
||||||
|
#include <imgui.h> |
||||||
|
#include <backends/imgui_impl_opengl3.h> |
||||||
|
#include <backends/imgui_impl_sdl.h> |
||||||
|
|
||||||
|
#include "gooey.h" |
||||||
|
|
||||||
|
|
||||||
|
bool |
||||||
|
gooInit(SDL_Window* window, SDL_GLContext gl_context) |
||||||
|
{ |
||||||
|
IMGUI_CHECKVERSION(); |
||||||
|
ImGui::CreateContext(); |
||||||
|
ImGuiIO& io = ImGui::GetIO(); |
||||||
|
io.IniFilename = NULL; // don't save window state to imgui.ini
|
||||||
|
ImGui::StyleColorsDark(); |
||||||
|
|
||||||
|
bool ret = true; |
||||||
|
ret = ret && ImGui_ImplSDL2_InitForOpenGL(window, gl_context); |
||||||
|
ret = ret && ImGui_ImplOpenGL3_Init(); |
||||||
|
|
||||||
|
return ret; |
||||||
|
} |
||||||
|
|
||||||
|
void |
||||||
|
gooFree() |
||||||
|
{ |
||||||
|
ImGui_ImplOpenGL3_Shutdown(); |
||||||
|
ImGui_ImplSDL2_Shutdown(); |
||||||
|
ImGui::DestroyContext(); |
||||||
|
} |
||||||
|
|
||||||
|
void |
||||||
|
gooDraw(SDL_Window* window) |
||||||
|
{ |
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplOpenGL3_NewFrame(); |
||||||
|
ImGui_ImplSDL2_NewFrame(window); |
||||||
|
ImGui::NewFrame(); |
||||||
|
|
||||||
|
ImGui::Begin("Hello, world!"); |
||||||
|
ImGui::Text("This is some useful text."); |
||||||
|
ImGui::Button("Hey"); |
||||||
|
ImGui::End(); |
||||||
|
|
||||||
|
ImGui::Render(); |
||||||
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
#pragma once |
||||||
|
|
||||||
|
#include <SDL2/SDL.h> |
||||||
|
|
||||||
|
|
||||||
|
bool |
||||||
|
gooInit(SDL_Window* window, SDL_GLContext gl_context); |
||||||
|
|
||||||
|
void |
||||||
|
gooFree(); |
||||||
|
|
||||||
|
void |
||||||
|
gooDraw(SDL_Window* window); |
||||||
|
|
||||||
Loading…
Reference in new issue