Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dear Imgui
#4
and to finish off, once its all set up creating a basic window is very simple, you do this.

ImGuiIO& io = ImGui::GetIO();
io.DisplaySize = ImVec2(SCRWIDTH, SCRHEIGHT);
io.DeltaTime = DT;
// we should also pass on mouse and key info into the IO here
// now if just displaying text there's no need to send key and mouse info, but if you want interaction then is simple enough to pass the mouse down and position as well as keys pressed.


// get on with the text/windows
ImGui_ImplOpenGL3_NewFrame();
ImGui::NewFrame(); // do this at the start of any frame
// position the window
ImGui::SetNextWindowPos(ImVec2(200, 200));
ImGui::SetNextWindowSize(ImVec2(400, 200));
// make sure you begin by naming the window
ImGui::Begin("Resolution Info"); // begin starts the window up and provides the name for it, you can fill in all manner of content from this point on and when done use end to close the content
// send text or buttons or sliders or whatver
ImGui::Text("hello there");
// end
ImGui::End();
// you can of course have more than one window....repeat the above at a different point and do a new begin/end sandwich.


// now render it somewhere in your main loop, ideally after you render all your other content.
ImGui::Render();
// and finally render to the GPU
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Messages In This Thread
Dear Imgui - by Brian Beuken - 04-09-2019, 08:48 AM
RE: Dear Imgui - by Brian Beuken - 04-10-2019, 01:04 PM
RE: Dear Imgui - by Brian Beuken - 01-07-2020, 12:32 PM
RE: Dear Imgui - by Brian Beuken - 01-07-2020, 01:56 PM
RE: Dear Imgui - by Brian Beuken - 01-10-2020, 10:25 AM
RE: Dear Imgui - by jomoengineer - 01-19-2020, 05:05 AM
RE: Dear Imgui - by Brian Beuken - 02-02-2020, 12:29 AM
RE: Dear Imgui - by Brian Beuken - 11-28-2020, 06:13 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)