Check out ImGM by knno!
This project has been archived as of 8/17/2025, as there are plans to officially introduce ImGui to GameMaker in collaboration with ocornut.
Thank you for all the support throughout the years of this extension's development. I hope it has been able to assist numerous developers with their own project's developments!
Support for this extension is now ceased, please fork the extension to introduce new changes/bug fixes.
A Windows only ImGui wrapper for modern GameMaker, heavily work-in-progress
The itch.io page has pre-built packages for GameMaker
- dll/
main.cppfor DLL initialization & IO/rendering logicimgui_*_gm.cppfor wrapped ImGui->GM definitions
- scripts/
- ImGui/
ImGui.gmlfor ImGui static functions & internal IO/events
- ImGui_Misc/
ImGui_Misc.gmlfor enum definitions and misc ImGui->GM mapping
- ImGui/
- tools/
brief/Program.jsfor ImGui to GM binding generation
Using C++20, Windows SDK v10.0, Node.js v16.18.0, built with Visual Studio Community 2022
- Run
copy_dependencies.batto copy required.cppand.hfiles fromthirdparty/*intodll/ - Open
dll.slnin Visual Studio (support for versions older than 2022 is unknown) - Build for x64, resulting
imgui_gm.dllfile should be automatically copied to../extensions/ImGui_GM/imgui_gm.dlland wrapped functions should be generated bybrief/main.jsinImGui_GM.yyp - Open
ImGui_GM.yypand create a local package containingImGui_GM(extension),ImGui(script), andImGui_Misc(script) - Import local package into your game and create a controller object that calls
ImGui.__Initialize()once,ImGui.__Update()every frame, andImGui.__Render()in a draw event
I'm not sure if toolchain is the correct term here, but it sounds cool so I'll run with it. Here are some extra words on how the extension building works.
- Upon building inside of Visual Studio, the
tools/brief/main.jsscript will be called. This script collects any.cppfiles ending in "_gm.cpp" (Any uses ofGMFUNCoutside of files ending in_gm.cppwill not be read) and parses out functions defined using theGMFUNCmacro. These parsed functions are then added to theextensions/ImGui_GM/ImGui_GM.yyfile and static methods are created in the@section Bindssection of thescripts/ImGui/ImGui.gmlfile automatically. You can use the various macros to define attributes for wrapped functions and their arguments. Seebrief/Wrapper.js'smodifiermethod for how various attributes are handled.
- Import build of ImGui_GM locally or from releases
- Create a persistent object and call the following functions in their respective events:
ImGui.__Initialize()in the create eventImGui.__Update()in any updating event (suggested: Begin Step)ImGui.__Render()in any rendering event (suggested: Draw GUI)
- Create an instance of the object at the start of your game, then call
ImGui.BeginandImGui.Endin the step event to draw. Below is example GML for how to use the library. (Note: This example probably won't be updated often)
ImGui.ShowAboutWindow();
if (ImGui.Begin("Test Window", true)) {
ImGui.Text("Hello World :3");
str = ImGui.InputText("An Input", str);
if (ImGui.Button("Press Me")) {
show_message(string("your input was: {0}", str));
}
ImGui.End();
}- See Coverage heading below or the ImGui script in project for ImGui -> GML wrappers
Currently, this extension makes heavy usage of the ability to pass a device handler and context to extensions... unfortunately, this functionality is only avaliable for DX11 targets.
In the interim, I've created an experimental ImGui_Translator class contains a buffer that gets parts of ImDrawData copied into it every frame. Whilst this still relies on the DX11, there could be room to handle the draw data via GML but due to GameMaker's lack of support for index buffers this seems to be a bigger task than expected.
NOTE: ImGui_Translator has been removed from the project due to performance issues, will look into trying this again at a later time (or if anyone wants to make a PR, this could be fun 😉)
This extension makes extensive use of the changed static behavior in beta runtime v2023.100.0.264 and onward. Be sure to use a runtime that has these changes in them, otherwise usage may not work as expected. If you're unsure about if your runtime supports these new behaviours or not, check if the static_get function exists; if so, you're good! Otherwise, you'll likely need to upgrade (or switch to the beta). As a good rule of thumb, it's best to assume this project will be using the latest beta release of GameMaker. You can also check the .yyp file's metadata for an IDE version.
At the time of writing, the aforementioned changes to static are only avaliable on the beta branch of GameMaker; using stable builds currently unsupported
Last Updated: 12/20/2022
Currently there is 204 wrapper functions on the GameMaker side of things, but there's still a decent amount of missing functionality; namely tables, viewports, and docking functions. Check out ImGui_GM.gml to view all wrapper functions
Also record keeping for myself, here's a rough list of missing functionality at the moment:
- Tables
- Plots/Histogram
- Config Flag editing
- Docking (enabled by default currently, need to create wrappers for docking-related functions)
- Viewports
- Anything else, please submit an issue or create a thread in the itch.io community
-
Functions like
ImGui.Beginmay not return what you expect, see "ImGuiReturnMask Usage" for more info -
Functions that accept an array of items as an argument (such as
ImGui.DragInt3,ImGui.SliderFloat2, etc) will directly modify the given array. Keep this in mind when using them. Analogous functions that accept single elements (such asImGui.DrawInt,ImGui.SliderFloat) will not make any changes directly to the value, and the return value should be used. -
Like the above,
ColorEdit4andColorPicker4take the GML classImColorand mutates it directly; this is worth mentioning asColorEdit3returns a BGR colour -
Honestly, I dunno the difference between a "wrapper" and a "bind", so you'll probably see the two terms are used interchangably
- Omar Cornut for creating Dear ImGui
- rousr for creating ImGuiGML which inspired development of this
- @nkrapivin for providing general assistance with
YYRunnerInterfacemagic - @kraifpatrik's GMD3D11 for serving as reference on how to retrieve textures from GameMaker