Created
June 10, 2017 23:39
-
-
Save extrawurst/c39e426ce12a2ec6a546523a2e7e5e2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import derelict.imgui.imgui; | |
void main() | |
{ | |
... load opengl and initialize window ... | |
DerelictImgui.load(); // initialize dynamic bindings | |
ImGuiIO* io = ig_GetIO(); | |
// callback that imgui calls to let us render everything for it | |
// (that makes imgui very platform independent, you can render using opengl, directX ... whatever) | |
io.RenderDrawListsFn = &renderImgui; | |
while(true) | |
{ | |
io.MousePos = ImVec2(123,456); | |
... fill mouse and keyboard input info into the io variable ... | |
ig_NewFrame(); // tell imgui that a new frame begins | |
static float f = 0.0f; | |
float[3] clear_color = [0.3f, 0.4f, 0.8f]; | |
ig_Text("Hello, world!"); | |
ig_SliderFloat("float", &f, 0.0f, 1.0f); | |
ig_ColorEdit3("clear color", clear_color); | |
if (ig_Button("Test Button")) { ... } | |
// close this frames UI and makes imgui call our render callback | |
ig_Render(); | |
} | |
ig_Shutdown(); // shutdown | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment