ImGui_GM icon indicating copy to clipboard operation
ImGui_GM copied to clipboard

Update to latest version of GameMaker, ImGui Extension, and Wrappers

Open knno opened this issue 5 months ago • 0 comments

Introduction

Hi, In this PR, I have contributed to keep the code up to date with latest GameMaker file format, latest ImGui code, latest wrappers code and othe things that are going to be mentioned below.

My main idea was to merge experimental-viewports to main and have a single branch that works.

Summary

In general, mainly fixed alot of issues and introduced new things. Though this is a breaking change! we now have ImGui.__Render and ImGui.__Draw to actually draw the DrawData

Updating existing projects

  • Make sure to update your UI code to match the latest ImGui syntax.
  • Instead of __Update add __NewFrame and add __EndFrame when done.
  • Instead of __Draw add __Render and __Draw anywhere after it before the next new frame.

Details

  • GameMaker Side

    • Wrote a custom ImGuiState constructor that manages the buffers, surfaces and other context variables for the DLL.
    • Wrote a custom ImGuiBaseMainWindow constructor that is extendable for using multiple "main" viewports or windows in the future. (Not required for simple multi-viewports.)
      • Users don't have to worry about creating a state or window, they are automatically done like in the Basic Usage section of the README.
    • Wrote a GameMaker side of ImGuiWindowClass that can be used inside GM and with the DLL as a window class without having to manage it in the DLL.
    • Updated the objExample events, and added configurable variables in the Create event.
    • Wrote an example ImGuiSelectionBasicStorage and an example UI code for using multi-select.
    • README has been updated extensively with the newly Advanced Usage and other information.
    • Added a coverage badge with badgen... looks cool.
  • DLL Side

    • Organized files into folders for easier navigation and editing.
      • Wrappers are in dll\gm.
      • ImGui copied dependencies are in dll\imgui.
      • Others are in the dll directory.
    • Added a g_ImGuiExtFlags global variable that can be set from the GM side. To define what to use as renderer. This only needs to be set once in the start.
    • Wrote many wrappers. > 90% functions wrapped.

Notes

  • I tried to keep the code clean and optimized. Of course, that doesn't mean there isn't a possibility of something redundant. I am not sure about premake or if anything has become broken now due to compatibility. Sorry if it is.
  • If I missed anything, or for questions or issues, please comment on this pull request or submit an issue in my github fork here
  • The wiki has been updated too; I don't know how to create a pull request for it.
  • Input: Users can use input wrappers to detect input in multi-viewport mode.
var is_lmb = ImGui.IsMouseClicked(ImGuiMouseButton.Left); // This code checks within game window and outside. No need to OR it with a `mouse_check_button_pressed`.

knno avatar Sep 26 '24 13:09 knno