Add imgui
This commit is contained in:
parent
c1921dd3ac
commit
35a646d3e8
@ -1,18 +1,51 @@
|
||||
#include <raylib.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
#include <raylib.h>
|
||||
#include <imgui.h>
|
||||
#include <rlImGui.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char name[] = "view";
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 800;
|
||||
InitWindow(screenWidth, screenHeight, name);
|
||||
|
||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||
InitWindow(screenWidth, screenHeight, "VIEW");
|
||||
SetTargetFPS(60);
|
||||
while (!WindowShouldClose())
|
||||
rlImGuiSetup(true);
|
||||
|
||||
bool showDemoWindow = true;
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
BeginDrawing();
|
||||
ClearBackground(BLUE);
|
||||
rlImGuiBegin();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
|
||||
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("Window"))
|
||||
{
|
||||
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
|
||||
showDemoWindow = !showDemoWindow;
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if (showDemoWindow)
|
||||
ImGui::ShowDemoWindow(&showDemoWindow);
|
||||
|
||||
|
||||
rlImGuiEnd();
|
||||
EndDrawing();
|
||||
}
|
||||
CloseWindow();
|
||||
|
||||
rlImGuiShutdown();
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user