Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

nommiin/ImGui_GM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Notice ⚠️

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.

 

 

 

 

 

 

 

 

 

 

 

ImGui_GM

A Windows only ImGui wrapper for modern GameMaker, heavily work-in-progress image

Release

The itch.io page has pre-built packages for GameMaker

Reference

  • dll/
    • main.cpp for DLL initialization & IO/rendering logic
    • imgui_*_gm.cpp for wrapped ImGui->GM definitions
  • scripts/
    • ImGui/
      • ImGui.gml for ImGui static functions & internal IO/events
    • ImGui_Misc/
  • tools/

Building

Using C++20, Windows SDK v10.0, Node.js v16.18.0, built with Visual Studio Community 2022

  1. Run copy_dependencies.bat to copy required .cpp and .h files from thirdparty/* into dll/
  2. Open dll.sln in Visual Studio (support for versions older than 2022 is unknown)
  3. Build for x64, resulting imgui_gm.dll file should be automatically copied to ../extensions/ImGui_GM/imgui_gm.dll and wrapped functions should be generated by brief/main.js in ImGui_GM.yyp
  4. Open ImGui_GM.yyp and create a local package containing ImGui_GM (extension), ImGui (script), and ImGui_Misc (script)
  5. Import local package into your game and create a controller object that calls ImGui.__Initialize() once, ImGui.__Update() every frame, and ImGui.__Render() in a draw event

Toolchain

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.js script will be called. This script collects any .cpp files ending in "_gm.cpp" (Any uses of GMFUNC outside of files ending in _gm.cpp will not be read) and parses out functions defined using the GMFUNC macro. These parsed functions are then added to the extensions/ImGui_GM/ImGui_GM.yy file and static methods are created in the @section Binds section of the scripts/ImGui/ImGui.gml file automatically. You can use the various macros to define attributes for wrapped functions and their arguments. See brief/Wrapper.js's modifier method for how various attributes are handled.

Usage (GameMaker)

⚠️ HEADS UP: Ensure you're using a compatible runtime, see Compatibility heading below for more info

  1. Import build of ImGui_GM locally or from releases
  2. Create a persistent object and call the following functions in their respective events:
  • ImGui.__Initialize() in the create event
  • ImGui.__Update() in any updating event (suggested: Begin Step)
  • ImGui.__Render() in any rendering event (suggested: Draw GUI)
  1. Create an instance of the object at the start of your game, then call ImGui.Begin and ImGui.End in 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();
}
  1. See Coverage heading below or the ImGui script in project for ImGui -> GML wrappers

Compatibility

Platform

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 😉)

Runtime

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

Coverage

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

Notes

  • Functions like ImGui.Begin may 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 as ImGui.DrawInt, ImGui.SliderFloat) will not make any changes directly to the value, and the return value should be used.

  • Like the above, ColorEdit4 and ColorPicker4 take the GML class ImColor and mutates it directly; this is worth mentioning as ColorEdit3 returns 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

Special Thanks

About

[archived] An ImGui wrapper for modern GameMaker

Resources

License

Stars

Watchers

Forks