blob: 849ecef2775adaad093e1d6f2da4649898b7a6b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*******************************************************************************************
*
* raylib-extras [ImGui] example - Simple Integration
*
* This is a simple ImGui Integration
* It is done using C++ but with C style code
* It can be done in C as well if you use the C ImGui wrapper
* https://github.com/cimgui/cimgui
*
* Copyright (c) 2021 Jeffery Myers
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#include "imgui.h"
#include "rlImGui.h"
int main(int argc, char* argv[])
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 1280;
int screenHeight = 800;
SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "raylib-Extras [ImGui] example - simple ImGui Demo");
SetTargetFPS(144);
rlImGuiSetup(true);
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
BeginDrawing();
ClearBackground(DARKGRAY);
// start ImGui Conent
rlImGuiBegin();
// show ImGui Content
bool open = true;
ImGui::ShowDemoWindow(&open);
// end ImGui Content
rlImGuiEnd();
EndDrawing();
//----------------------------------------------------------------------------------
}
rlImGuiShutdown();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
|