britown

Creative-Type Impersonator

🌸请别在工作死🌸


I sometimes like working on never-to-be-finished video game projects


Right now I'm making a game called Chronicles.


Wanna make a game? Here is a list of great C++ libraries to use.


I maintain a Letterboxd in much the way that I assume people maintain bonsai trees.


This is Owen:
Owen
And this is Molly:
Molly
Furthermore, this is Max:
Molly

I love Dear ImGui. I use it every day and it's probably the most important contribution to independent development in the last decade. So when it came time to start thinking about making in-game UI, why not just create a similar immediate-mode system so that I can just make all my EGA RPG text and buttons and interactions work with literally the same API I use for my tools.


The code for the popup dialog there is

   egaui::setNextWindowPos({ 380, 32 });
   egaui::setNextWindowSize({ 300, 100 });
   if (egaui::begin("test 2!")) {

      egaui::text("Testing some UI");

      egaui::indent();

      egaui::beginGroup();
         egaui::alignTextToFramePadding();
         egaui::text("A button");
         egaui::alignTextToFramePadding();
         egaui::text("Another button");
      egaui::endGroup();

      egaui::sameLine();

      egaui::beginGroup();
         egaui::button("Btn 1");
         egaui::button("Btn 2");
      egaui::endGroup();
      
      egaui::unindent();

      egaui::setCursorPosX(egaui::getContentRegionMax().x - egaui::calcTextSize("Right Aligned").x);
      egaui::alignTextToFramePadding();
      egaui::text("Right Aligned");
   }
   egaui::end();
syntax highlighting by codehost

What's great about this., is this API is simple enough that later down the road when I start thinking of LUA/Scripting integration, creating bindings to enable scripts to define arbitrary UI becomes trivial. Custom menus and dialog trees and everything will be able to developed in the same asset system everything else uses.

Of course the real fun of all of this is that this API exists running inside a game instance that is being rendered to a full ImGui window:

edit: added a better looking window frame :3


You must log in to comment.

in reply to @britown's post:

As a Professional UI Programmer, I love ImGUI, because companies pay me the big bucks to untangle their game UI and port it to something sensible. 😁

Jokes aside, I think your UI looks great already! The problem with using ImGUI on the kinds of projects I work on (i.e. Big Stupid AAA Games) is that ImGUI encourages you to intertwine your data with your presentation, which means all layout changes have to be done by programmers, and you can't easily reuse data across screens.

But that's absolutely fine for smaller projects!

Thank you! I'm actually involved in a weird experiment where the startup I work at uses ImGui for the entirety of our desktop windows application. It's pretty heavily modified to make that possible but like you said a big part of it is how to architect our data layer to keep it separate from logic and UI.

Programmer UI work is a blessing and a curse. You get rapid prototyping and fast turnaround on tweaks but you're much more prone to variations in look and feel. The main thing that makes it work is wrapping common constructs into reusable modular chunks. We also have a separate scripting layer that always spits out deterministic UI so that non devs can take over some parts.

Being part of a startup, the roles can afford to be a little loose, we have dedicated UI/UX devs (me) that liason to PM and user advocate groups and iterate on standards.