prime31 / ImGuiGL-Renderer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C# SDL2 + IMGUI


This is a project for game creation, OpenGL window context creation in SDL2 and input control, implemented in C#
All ImGui draw calls are called from the classic Nuget ImGui.Net package and have linked with intern SDL and SDL_GL calls

Getting Started

It is assumed that you are using SDL2 in your project.
for create an SDL window with an OpenGL context:

(_window, _glContext) = ImGuiGL.CreateWindowAndGLContext("SDL Window", 800, 600);
_renderer = new ImGuiGLRenderer(_window, _glContext);

For rendering (drawing) a new frame
usually at the end of a while loop:

_renderer.ClearColor(0.05f, 0.05f, 0.05f, 1.00f);
_renderer.NewFrame();
ImGui.ShowDemoWindow();
_renderer.Render();
SDL_GL_SwapWindow(_window);

Repo Structure

  • Example: contains a simple example project that displays the ImGui demo in an SDL window and shows the basic structure on how you can setup your own game loop.
  • General: contains the csproj file and ImGui,SDL2 and OpenGL folders.

License

Whatever

Acknowledgements

This code began as a fork of the opengl4sharp lib. Unfortunately, that didn't work out so this ended up being a near total rewrite besides keeping the OpenGL enums.

About


Languages

Language:C# 100.0%