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.

==========================
 
Top