diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2019-11-13 08:47:39 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2019-11-13 08:47:39 +0200 |
| commit | 958f5052928d63d4f8a84e88fca82f4a8215a952 (patch) | |
| tree | f1c818144ea4e9e9a751b9ac32271f19ffe33b03 | |
| parent | ec91e97895090f2411f73ef8185134822db256a8 (diff) | |
| download | foolib-958f5052928d63d4f8a84e88fca82f4a8215a952.tar.gz foolib-958f5052928d63d4f8a84e88fca82f4a8215a952.zip | |
Add an example
| -rw-r--r-- | examples/config.nims | 1 | ||||
| -rw-r--r-- | examples/simple.nim | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/examples/config.nims b/examples/config.nims new file mode 100644 index 0000000..80091ff --- /dev/null +++ b/examples/config.nims @@ -0,0 +1 @@ +switch("path", "$projectDir/../src") diff --git a/examples/simple.nim b/examples/simple.nim new file mode 100644 index 0000000..d76c716 --- /dev/null +++ b/examples/simple.nim @@ -0,0 +1,36 @@ +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() |
