This commit is contained in:
Nikola Petrov 2025-02-06 16:12:15 +01:00
parent 7014243974
commit 0d27eb2c86
2 changed files with 43 additions and 0 deletions

View File

@ -82,3 +82,7 @@ set(public_headers
file(COPY ${public_headers} DESTINATION "include") file(COPY ${public_headers} DESTINATION "include")
add_executable(main demo.cpp)
target_link_libraries(main raylib imgui)
target_include_directories(main PRIVATE build/include/)

39
demo.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <raylib.h>
#include <imgui.h>
#include <rlImGui.h>
int main(int argc, char *argv[])
{
int screenWidth = 1000;
int screenHeight = 1000;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "VIEW");
SetTargetFPS(60);
rlImGuiSetup(true);
bool showDemoWindow = true;
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
while (!WindowShouldClose())
{
BeginDrawing();
rlImGuiBegin();
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
ClearBackground(RAYWHITE);
if (ImGui::BeginMainMenuBar())
{
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
showDemoWindow = !showDemoWindow;
ImGui::EndMainMenuBar();
}
if (showDemoWindow)
ImGui::ShowDemoWindow(&showDemoWindow);
rlImGuiEnd();
EndDrawing();
}
rlImGuiShutdown();
CloseWindow();
return 0;
}