GithubHelp home page GithubHelp logo

m4b-framework's Introduction

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. This demo expects that you have SDL2 already installed on your computer and does not provide any SDL2 binaries.
  • General: contains the csproj file and ImGui,SDL2 and OpenGL folders.

Warning

To work with SDL you will need the original sdl2.dll runtime library which was written in C/C++, you can find it on this site, this is what the C# SDL linked to for native and processed calls, you should put sdl2.dll in the folder with your executable exe file. If you need SDL_ttf and SDL_image and so on, then you should also download them in binary .dll format and copy them to the folder with your compiled executable file

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.

m4b-framework's People

Contributors

wild11 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.