Menu Share

Using ImGui for Game Development

by | Published on
category C / C++

In this article I will discuss one of the most popular libraries in the C++ world. You guessed it! It is Dear ImGui the bloat-free graphical user iterface for C++.

Table of Contents

Introduction

For those of you that are beginners into game programming or game development in general you will probably be mostly familiar with the easy to use game engines like Unity, Unreal, Godot, etc. But most developers that do games from scratch have to develop their own programming tools for level editing or even basic stuff like visualizing data from the game.

Here comes the library that we all love – Dear ImGui. This library provides mostly a specification of how certain things should be drawn and how certain events should be handled but still allows you to implement your own backend graphics API. It does come bundled with a few backends like OpenGL or Vulkan and some windowing backends but you are free to implement your own (like I did with BIG2 wher I implemented BGFX).

This is an UI library. This means that this library helps you render controls like inputs, buttons, windows inside windows, tables, lists, properties, etc. It really covers a lot. And when you’re building a basic game engine or even trying to do a simple game (like for a game jam) you don’t have time to implement these yourself. It can even be used as a UI for your game menu if you style it well enough.

How does it look?

It is really important to take looks into account though. And this library nails it.

Of course you will meet better libraries like Qt that do a quite better job and first impression. But ImGui is stylable and you can change almost everything like color, fonts, rounding, spacing, layout… And whatever you cannot change you could implement yourself through the internal API they provide.

Who uses ImGui?

ImGui is useful for anyone wanting to do easy graphics. I’ve seen it used in the gaming industry and in academic environments. It is also very useful for quick prototyping since it is so easy to implement. There are also complicated projects and whole game engines like The Cherno‘s Hazel engine that are developed using ImGui.

So if you didn’t already know it until now – you should use it on your next project as well. It is the standard in almost any graphical C++ project for creating UI and it is completely free and open-source.

Where can I start?

You can always start by going to the main repository. Just look how many stars it has. It covers how to get it installed and setup. You can also take a look at my examples of how to manage cmake dependencies. You can also take a look at my BIG2 stack on github where I provide some examples and an easy setup. And last but not least you can check out courses on the topic. I recently published a course on udemy that covers ImGui and basic graphics setup.

Leave a comment

Your email address will not be published. Required fields are marked *