blob: e3e1e2f1525be1e0288b94b245f2ec4f30d154c7 (
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
|
# Hack to make the example compile when --app:gui option is given to nim
when defined(windows):
{.emit:"""/*INCLUDESECTION*/
#include <raylib.h>
#undef ShowWindow
#define CloseWindow WINDOWS_CloseWindow
#define ShowCursor WINDOWS_ShowCursor
#define ShowWindow WINDOWS_ShowWindow
#define Rectangle WINDOWS_Rectangle
#include <windows.h>
#undef CloseWindow
#undef ShowCursor
#undef ShowWindow
#undef Rectangle
""".}
import foolib/[raylib, imgui]
InitWindow(1024, 768, "hello")
SetTargetFPS(60)
discard imgui.CreateContext()
imgui.StyleColorsDark()
when defined(macos):
discard ImGui_ImplOpenGL3_Init("#version 150")
else:
discard ImGui_ImplOpenGL3_Init("#version 130")
discard ImGui_ImplRaylib_Init()
while not WindowShouldClose():
ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplRaylib_NewFrame()
imgui.NewFrame()
BeginDrawing()
ClearBackground(WHITE)
imgui.ShowDemoWindow(nil)
imgui.Render()
ImGui_ImplOpenGL3_RenderDrawData(imgui.GetDrawData())
EndDrawing()
ImGui_ImplRaylib_Shutdown()
ImGui_ImplOpenGL3_Shutdown()
CloseWindow()
|