Immediate Mode GUI (and Dear ImGui) and AGS

Started by eri0o, Mon 30/12/2019 10:16:01

Previous topic - Next topic

eri0o

Has anyone ever written a Immediate GUI module for AGS?

From Wikipedia

Quote
Immediate mode GUI in computer graphics is a GUI implemented using an immediate mode pattern, where the event processing is directly controlled by the application.

There are two major pattern of API design in graphics libraries - retained mode and immediate mode.[1] In the retained mode, the rendering primitives are managed by the GUI system/library, often hidden from the application code. In the immediate mode, the application code is holding on its own rendering primitives.

I have thought about it, and while I realized it would be theoretically possible using Overlays and reading mouse and keyboard status, I was too overwhelmed and decided to just at first write a plug-in.

Now, this, as always, isn't really in a working state. I mean, it runs and draws things on screen, but it doesn't handle input yet.

I present agsimgui. The GitHub repository is here.



This GUI is more oriented to building in game development tools for the person testing systems and stuff in game rather than actually being used by the final user. Because of my limitations what eventually will be the API, will be a smaller subset of actual Dear ImGui capabilities.

Crimson Wizard

#1
Quote from: eri0o on Mon 30/12/2019 10:16:01
Has anyone ever written a Immediate GUI module for AGS?

Even after reading the wikipedia article I don't understand what this implies. Could you explain in more simple words?
There were numerous scripts made that draw custom GUIs, with controls etc, as well as custom dialog options - do these count?

Quote from: eri0o on Mon 30/12/2019 10:16:01
I have thought about it, and while I realized it would be theoretically possible using Overlays and reading mouse and keyboard status

Why overlays though, and not a GUI where you draw over a background? IMHO that would make it easier to arrange z-order.

Having an ImGUI plugin could be rather useful anyway, I don't know why have not someone did this before, that could perhaps solve number of problems with advanced controls.

eri0o

#2
Probably not correct explanation, but usually when dealing with GUIs you create these objects and manipulate them, keeping these objects around. Immediate GUI, is really immediate, or practically stateless, in the sense that if in a frame a GUI element "exists", it will exist for that sole frame, and if the next it doesn't, well it won't. Basically, short from themeing, and the stack blocks, there's no state, it's like a REST API, but for GUIs. Sounds weird, but I find using it easier for things that have a small scope. Surely, if I needed a huge complex GUI with multiple modals it would be best to write something like agsqt :P.

The sprite returned by the plug-in could be used as a GUI background, just not done in the example, because for simplicity, the plan is to have multiple rooms to showcase the possibilities.

The plug-in is still at young phase, and ImGui has many extensions written over the years. Theoretically, all these extensions could be imported, so if you or anyone have requests, just throw. They include a huge myriad of things, including even a Markdown Editor (write AGS docs in ags xD).

There's an old old module that I never saw people talking about except Edmundito, who had played with it's code recently, called God mode, that enabled modifying characters at run time and some other things. I think of Dear ImGui possibilities of making easier to do that.

eri0o

#3
Got input handling working!



I actually fixed most rendering issues and enabled rendering sprites in buttons and stuff. I think I will get this done as fast as I can, but it will be using software renderer. ImGui also has Directx9 and OpenGL 2 backends (and even an Allegro 5 that helps a bit to understand what needs to be done slightly for Allegro 4...), but actually reading graphics API documentation and understanding this is not on my short term scope. I still get 60 fps on my PC with relatively large resolutions (fullhd) this way, so it's a optimization I will postpone, if someone understands this, maybe glueing this stuff together (Directx and OpenGL) is possible somehow.

Added keyboard input handling! streamable.com/egizi

And we can edit text now! streamable.com/rjpgf

eri0o

#4
I added a sketch README here on the project github.com/ericoporto/agsimgui

If someone could read it and see if it makes sense. It will be easier to explain when someone tells the doubts. :)

The goal of this plug-in is to help building in game debug tools to ease development of more complex systems like minigames and non Adventure Games under AGS, as well to make easier to develop GUI tools in AGS itself for gamedevlopment purposes. It's not built for player facing GUIs.

I added more examples and more documentation.





I had an idea for a in game text Editor, paired with a Character.BSay(String text) function. Everytime it runs, it checks if the string is in a map, if it's not, we store it in a circular String array, advance it's index. At anytime you can load an in game text editor and offer a substitute text for a text from the buffer. Then you can replay interactions, with this new text. Finally, you can save a file with key strings in odd lines and mapped value strings in even lines. It may be an interesting candidate to ship with the demo.

Plug-in has its first release, so forum topic should now be here-> https://www.adventuregamestudio.co.uk/forums/index.php?topic=57699.0

SMF spam blocked by CleanTalk