Asset - Extension ImGuiGML - ImGui bindings for GMS 2

babyjeans

Member

YoYo Games Marketplace - Itch.io
Free

ImGuiGML is a DLL / GML wrapper of the popular Dear ImGui, library for GameMaker Studio 2

It's currently available only on the Windows platform with macOS and Linux coming soon.

ImGui is a UI library designed for fast implementation and iteration, using an 'Immediate Mode GUI' paradigm You will primarily be putting your GUI functions in step events that are called each step, rather than an event / retained based paradigm of only making updates.

It's available for Free in hopes you all can use it to help speed up your dev and make some neat debugging / editor tools!
 

babyjeans

Member
I've updated ImGuiGML to v1.1.3 which adds:

  • Tab support from the ImGui tabs branch
  • ImGuiColorTextEdit courtesy of BalazsJako's git branch.
And a SLEW of fixes... some help corrections, and making it a bit easier to work with colors between GML and ImGui.
The doc page at http://imguigml.rou.sr/ now as linkable anchors as well, and hopefully will see some ease-of-use improvements REAL soon!
 

babyjeans

Member
I've updated to v1.2.3

v1.2.3
  • API
    • Added imguigml_surface and refactored how sprite and 'image' works. imguigml_image still takes a texture pointer, but there's rarely a reason to use it.
  • Fixes:
    • Fixed draw_add_rect_filled
    • Automatically multiply the normalized pixel percent trimmed from sprites when useing imguigml_sprite
    • imguigml_button now accepts 1 param for size
    • Fix imguigml_color_convert_ gml / u32 functions being backwa
 

babyjeans

Member
Just updated to v1.3.0!

Lots of fixes for various issues...

  • Features
    • Don't draw if a surface/texture doesn't exist (avoids white boxes flashing)
    • Add ability to draw at depth
    • Can draw in Draw event
  • API
    • Added float4 -> gml color conversion functions
  • Fixes:
    • imguigml_texteditor_get_text returned nothing, also fixed indexing text editors
    • Fixed ImGuiGML bashing the cursor so that resize cursors, etc, didn't function properly.
    • Fixed ImGuiGML Display Issues when resizing the window or GUI Layer... more to come on this
  • Various doc fixes!
 

mbeytekin

Member
Is there any problem with "imguigml_begin_drop_target()" function?
Because I couldn't use this function properly. Everytime when use this function all items after that drags to a new debug window..
By the way in original documentation of IMGUI there is "ImGui::BeginDragDropTarget()" function... Does "imguigml_begin_drop_target()" equals "ImGui::BeginDragDropTarget()"


After a quick look to extension codes I found that;

#define imguigml_begin_drop_target
///@function imguigml_end_drag_drop_source()
///@desc call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
__imguigml_ext_call(_extImguiGML_end_drag_drop_source());

This function acts like "end_drag_drop_source"...

How can I fix that?
 
Last edited:

mbeytekin

Member
Is there any problem with "imguigml_begin_drop_target()" function?
Because I couldn't use this function properly. Everytime when use this function all items after that drags to a new debug window..
By the way in original documentation of IMGUI there is "ImGui::BeginDragDropTarget()" function... Does "imguigml_begin_drop_target()" equals "ImGui::BeginDragDropTarget()"


After a quick look to extension codes I found that;

#define imguigml_begin_drop_target
///@function imguigml_end_drag_drop_source()
///@desc call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
__imguigml_ext_call(_extImguiGML_end_drag_drop_source());

This function acts like "end_drag_drop_source"...

How can I fix that?



Ok. I fixed it;

in extImguiGML.gml file

I changed that;

#define imguigml_begin_drop_target
///@function imguigml_begin_drop_target([_flags=0])
///@desc call when the current item is active. If this return true, you can call imguigml_set_drag_drop_payload() + imguigml_end_drag_drop_target()
///@param [_flags=0]
var _flags = argument_count > 0 ? argument[0] : 0;

var in = __Imgui_in;
sr_buffer_write_val(in, _flags, ERousrData.Uint32);
if (!__imguigml_ext_call(_extImguiGML_begin_drop_target()))
return;
var out = __Imgui_out;
return buffer_read(out, buffer_s8) != 0;


Now it works..
 
@babyjeans Thanks for this amazing extension, it's so great to have dear imgui available for GameMaker!

I was lucky enough to get a beta key for 2.3 the other day, just wanted to give a heads-up of some errors when using this extension on 2.3, this is what I got when I tried to compile:

Code:
Script: __extrousrdrawlist_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_drawlist_definitions"
Script: __extrousrui_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_ui_definitions"
Script: __extrousrgeneric_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_generic_definitions"
Script: __extrousrds_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_ds_definitions"
So I couldn't run my game editor on 2.3.

After some experimenting I found a way to get it working, but not sure if this breaks anything else yet.

===== HACKY FIX BELOW ??!! ======

I managed to get it working by deleting the reference to the errors above in the very last line of each file below:
extRousrDs.gml
extRousrGeneric.gml
extRousrUi.gml
extRousrDrawlist.gml

There is a gml_pragma() at the end of these files, and by deleting the part that was causing the error, the game compiles now.

The part to delete looks similar to this, the exact wording will differ depending on the file :

global.__extrousrui_script_index_lookup[@ rousr_ui_definitions] = asset_get_index(\"rousr_ui_definitions\");

Don't try this at home folks, not sure what side-effects if any there will be, but seems to be working for now.

==========================
 

Limekys

Member
@babyjeans Thanks for this amazing extension, it's so great to have dear imgui available for GameMaker!

I was lucky enough to get a beta key for 2.3 the other day, just wanted to give a heads-up of some errors when using this extension on 2.3, this is what I got when I tried to compile:

Code:
Script: __extrousrdrawlist_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_drawlist_definitions"
Script: __extrousrui_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_ui_definitions"
Script: __extrousrgeneric_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_generic_definitions"
Script: __extrousrds_script_index at line 7 : error inside gml_pragma string, cannot use function/script name for a variable, using "rousr_ds_definitions"
So I couldn't run my game editor on 2.3.

After some experimenting I found a way to get it working, but not sure if this breaks anything else yet.

===== HACKY FIX BELOW ??!! ======

I managed to get it working by deleting the reference to the errors above in the very last line of each file below:
extRousrDs.gml
extRousrGeneric.gml
extRousrUi.gml
extRousrDrawlist.gml

There is a gml_pragma() at the end of these files, and by deleting the part that was causing the error, the game compiles now.

The part to delete looks similar to this, the exact wording will differ depending on the file :

global.__extrousrui_script_index_lookup[@ rousr_ui_definitions] = asset_get_index(\"rousr_ui_definitions\");

Don't try this at home folks, not sure what side-effects if any there will be, but seems to be working for now.

==========================
Thanks a lot for this information. Only I made it a little easier. I edited only one file "extRousrDs.gml" and just commented out the last line with "gml_pragma".
 
C

Carotaa

Guest
I really love this extension!
But I got the Compile Error message after I updated gms2 to current V2.3.1.536.


Script: __imguigml_init_font at line 24 : wrong number of arguments for function buffer_set_surface



Help...
 

chamaeleon

Member
I really love this extension!
But I got the Compile Error message after I updated gms2 to current V2.3.1.536.


Script: __imguigml_init_font at line 24 : wrong number of arguments for function buffer_set_surface



Help...
The function buffer_set_surface() has changed in what parameters it takes per the release thread and release notes. Going from memory (faulty possibly?) I think two parameters were removed (and were possibly not actually used at all to begin with). Making the relevant change in the imported extension code should resolve it until an updated version is made available.
 

mbeytekin

Member
Has anyone noticed a high CPU load while using this extension? I made an application with this extension, but after a while I realized that when the begin_step and end_step functions are activated, it spends 25% cpu. If I deactivate imguigml in my program it drops to 0.1%. Do you know any way to fix this?
 
Ok. I fixed it;

in extImguiGML.gml file

I changed that;

#define imguigml_begin_drop_target
///@function imguigml_begin_drop_target([_flags=0])
///@desc call when the current item is active. If this return true, you can call imguigml_set_drag_drop_payload() + imguigml_end_drag_drop_target()
///@param [_flags=0]
var _flags = argument_count > 0 ? argument[0] : 0;

var in = __Imgui_in;
sr_buffer_write_val(in, _flags, ERousrData.Uint32);
if (!__imguigml_ext_call(_extImguiGML_begin_drop_target()))
return;
var out = __Imgui_out;
return buffer_read(out, buffer_s8) != 0;


Now it works..
Thanks for this! I ran into it too and was stumped for a bit till I found your post lol
 

babyjeans

Member
ImGuiGML v1.100.4 is released! Unfortunately there's some issues going on with the Marketplace (for me at least) and it won't let me publish the latest release there, but I have published it on itch.io!
  • First and Foremost, it's been updated to GMS 2.3 - meaning the buffer_set_surface error is gone.
  • I've fixed the drag drop issues y'all mentioned, thanks for bringing that up!
  • It compiles with YYC now, as that seemed to have break.
  • Linux and MacOS versions are now available (in addition to Windows, of course)
  • It's been updated to the latest version of Dear ImGui (however, no new functionality has been wrapped as of yet)
With this one, if you've already got an older version, it's best just to delete it and install the new one fresh. I've removed the "gml" extension that tucked away all the gml wrappers for the C++ extensions, and they're just part of the project now.
 
Top