Greetings to everyone. In this article I would like to continue discussing about Goknar Engine by the means of input system and renderer. Then I will show how I made a very simple UI with ImGui. Let’s start with the InputManager.

Input Manager

InputManager class is fully biult on delegates. To mention what is a delegate for those who are not familiar with delegates: A delegate is simply a function pointer where you can bind functions and call them when the conditions are met.

I used standard function library because it makes private and/or non-static functions bindable to the delegates.

There is five different delegatable input types which are mouse for mouse clicks, keyboard for keyboard entries, cursor for the cursor position, scroll for the scroll rolls, and char for the character inputs to be used in textbox like components.

I hold these delegates in unordered maps since it is a hashing container type, and has constant time complexity accordingly.

Renderer

Renderer class is the class that renders every renderable object in the screen. It sets buffer data, organizes and initializes OpenGL, and then renders the screen at each frame.

Actually the Renderer class is not completed yet, but it is needed to draw even a simple shape on the screen.

A Simple UI with ImGui

I used ImGui for the editor user interface of the engine. The reason I used ImGui is that ImGui is open-source, easy to use, and cross platform.

Firstly I submoduled ImGui repository on GitHub. Then I copied ImGuiImplOpenGL3 class to my solution to make my job easier. And finally I creat ImGuiEditor class, and add some functions to it.

Result

via Gfycat

GitHub repository: github.com/emrebarisc/GoknarEngine