Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: eri0o on Sat 11/01/2020 14:40:06

Title: [PLUGIN] agsimgui 0.3.0 - build GUIs easily for debug purposes!
Post by: eri0o on Sat 11/01/2020 14:40:06
agsimgui  version 0.3.0

(https://dev.azure.com/ericoporto/agsimgui/_apis/build/status/ericoporto.agsimgui?branchName=master)

Get Latest Release agsimgui.dll (https://github.com/ericoporto/agsimgui/releases/download/0.3.0/agsimgui.dll) | libagsimgui.so (https://github.com/ericoporto/agsimgui/releases/download/0.3.0/libagsimgui.so) | libagsimgui.dylib (https://github.com/ericoporto/agsimgui/releases/download/0.3.0/libagsimgui.dylib) | GitHub Repo (https://github.com/ericoporto/agsimgui) | Demo Windows (https://github.com/ericoporto/agsimgui/releases/download/0.3.0/agsimgui_demo_windows.zip) | Demo Linux (https://github.com/ericoporto/agsimgui/releases/download/0.3.0/agsimgui_demo_linux.tar.xz)

Dear ImGui plugin for Adventure Game Studio

(https://user-images.githubusercontent.com/2244442/71694439-f3ac1080-2d8d-11ea-9c98-e6954409b66b.gif)

Supports Directx9 and Software renderer. Using OpenGL will default to Software renderer for ImGui only (it has it's own renderer), but OpenGL support will be provided in the future.

A more complete documentation is available here (https://github.com/ericoporto/agsimgui/blob/master/README.md) because AGS Forums have a 30000 character limit per posting.

Usage example

Run a simple demo window to see what's possible with Dear ImGui.
Code (AGS) Select

// use function room_RepExec() when in Room Script and link it throught the editor
void repeatedly_execute(){
  AgsImGui.NewFrame(); //let's begin a new frame, we end it with a Render
  AgsImGui.ShowDemoWindow(); //Shows a demo of everything possible
  AgsImGui.Render(); // This will generate drawing instructions.
  // AGS will actually draw this on screen later on, on Post Screen Draw stage.
}

Some of what is shown on Demo Window is not yet exposed in the AgsImGui Script API.

Let's do a simple example now.
Code (AGS) Select

bool is_button_clicked;

// use function room_RepExec() when in Room Script and link it throught the editor
void repeatedly_execute(){
  AgsImGui.NewFrame(); //let's begin a new frame, we end it with a Render

AgsImGui.BeginWindow("My first window");   
  ViewFrame* vf = Game.GetViewFrame(player.View, player.Loop, player.Frame);
  is_button_clicked = AgsImGui.ImageButton(vf.Graphic);
  if(AgsImGui.IsItemHovered()) AgsImGui.SetTooltip(String.Format("frame %d",player.Frame));
  player.x = AgsImGui.DragInt("player.x", player.x);
  player.y = AgsImGui.DragInt("player.y", player.y);
  AgsImGui.EndWindow();

AgsImGui.Render(); // This will generate drawing instructions.
  // AGS will actually draw this on screen later on, on Post Screen Draw stage.
}

Note ImGui will save a imgui.ini file to allow window positions and some more data to persist between sections when no guidance is given.



AGS Script API
Spoiler

Main

  • AgsImGui.NewFrame

    static void AgsImGui.NewFrame()

    Call this before calling any AgsImGui commands.


  • AgsImGui.EndFrame

    static void AgsImGui.EndFrame()

    We don't need this if we are using Render, since it will automatically call AgsImGui.EndFrame() too.


  • AgsImGui.Render

    static void AgsImGui.Render()

    This will EndFrame and proceed to generate drawing instructions.


  • AgsImGui.GetStyle

    static ImGuiStyle* AgsImGui.GetStyle()

    Gets the Style customization use in AgsImGui. Check ImGuiStyle for more information.


  • AgsImGui.SetStyle

    static void AgsImGui.SetStyle(ImGuiStyle* imGuiStyle)

    Sets the Style customization use in AgsImGui. Check ImGuiStyle for more information.

    Code (AGS) Select

    ImGuiStyle* style = AgsImGui.GetStyle();
    style.Alpha = 0.5
    style.Colors[eImGuiCol_PopupBg] = ImVec4.Create(1.00, 1.00, 1.00, 1.00); //white
    AgsImGui.SetStyle(style);




    Demo, Debug, Information

  • AgsImGui.GetVersion

    static String AgsImGui.GetVersion()

  • AgsImGui.ShowDemoWindow

    static void AgsImGui.ShowDemoWindow()

  • AgsImGui.ShowAboutWindow

    static void AgsImGui.ShowAboutWindow()

  • AgsImGui.ShowMetricsWindow

    static void AgsImGui.ShowMetricsWindow()

  • AgsImGui.ShowUserGuide

    static void AgsImGui.ShowUserGuide()




    Windows

  • AgsImGui.BeginWindow

    static AgsImGui.ImGuiBeginWindow BeginWindow(String name, bool has_close_button = 0, ImGuiWindowFlags flags = 0)

  • AgsImGui.EndWindow

    static void EndWindow()




    Child Windows

  • AgsImGui.BeginChild

    static bool BeginChild(String str_id, int width = 0, int height = 0, bool border = false, ImGuiWindowFlags flags = 0)

    Child Windows. Always call a matching EndChild() for each BeginChild() call, regardless of its return value. Child windows can embed their own child.

  • AgsImGui.EndChild

    static void EndChild()

    Pop child window from the stack.




    Item/Widgets Utilities

    Most of the functions are referring to the last/previous item we submitted.

  • AgsImGui.IsItemHovered

    static bool AgsImGui.IsItemHovered(ImGuiHoveredFlags flags = 0)

    Is the last item hovered? (and usable, aka not blocked by a popup, etc.). You can specify a flag for more options.

    static bool IsItemHovered(ImGuiHoveredFlags flags = 0)

  • AgsImGui.IsItemActive

    static bool AgsImGui.IsItemActive()

    Is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item.)

  • AgsImGui.IsItemFocused

    static bool AgsImGui.IsItemFocused()

    Is the last item focused for keyboard navigation?

  • AgsImGui.IsItemVisible

    static bool AgsImGui.IsItemVisible()

    Is the last item visible? (items may be out of sight because of clipping/scrolling)

  • AgsImGui.IsItemEdited

    static bool AgsImGui.IsItemEdited()

    Did the last item modify its underlying value this frame? or was pressed? This is generally the same as the bool return value of many widgets.

  • AgsImGui.IsItemActivated

    static bool AgsImGui.IsItemActivated()

    Was the last item just made active (item was previously inactive).

  • AgsImGui.IsItemDeactivated

    static bool AgsImGui.IsItemDeactivated()

    Was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing.

  • AgsImGui.IsItemDeactivatedAfterEdit

    static bool AgsImGui.IsItemDeactivatedAfterEdit()

    Was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing.

  • AgsImGui.IsItemToggledOpen

    static bool AgsImGui.IsItemToggledOpen()

    Was the last item open state toggled? set by TreeNode().

  • AgsImGui.IsAnyItemHovered

    static bool AgsImGui.IsAnyItemHovered()

    is any item hovered?

  • AgsImGui.IsAnyItemActive

    static bool AgsImGui.IsAnyItemActive()

    is any item active?

  • AgsImGui.IsAnyItemFocused

    static bool AgsImGui.IsAnyItemFocused()

    is any item focused?

  • AgsImGui.IsWindowAppearing

    static bool AgsImGui.IsWindowAppearing()

    'current window' = the window we are appending into while inside a Begin()/End() block.

  • AgsImGui.IsWindowCollapsed

    static bool AgsImGui.IsWindowCollapsed()

    return true when window is collapsed. Use this between Begin and End of a window.

  • AgsImGui.IsWindowFocused

    static bool AgsImGui.IsWindowFocused(ImGuiFocusedFlags flags=0)

    is current window focused? or its root/child, depending on flags. see flags for options. Use this between Begin and End of a window.

  • AgsImGui.IsWindowHovered

    static bool AgsImGui.IsWindowHovered(ImGuiHoveredFlags flags=0)

    is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. Use this between Begin and End of a window.




    Widgets: Text

  • AgsImGui.Text

    static void AgsImGui.Text(String text)

    Draws a string of text.

  • AgsImGui.TextColored

    static void AgsImGui.TextColored(int ags_color, String text)

    shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();

  • AgsImGui.TextDisabled

    static void AgsImGui.TextDisabled(String text)

    shortcut for PushStyleColor(ImGuiCol[cur]Text, style.Colors[ImGuiCol[/cur]TextDisabled]); Text(fmt, ...); PopStyleColor();

  • AgsImGui.TextWrapped

    static void AgsImGui.TextWrapped(String text)

    shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();.

  • AgsImGui.LabelText

    static void AgsImGui.LabelText(String label, String text)

    Display text+label aligned the same way as value+label widgets .

  • AgsImGui.Bullet

    static void AgsImGui.Bullet(String text)

    Draws a bullet and a string of text. Shortcut for Bullet()+Text().




    Widgets: Main

    Most widgets return true when the value has been changed or when pressed/selected.

    You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.

  • AgsImGui.Button

    static bool AgsImGui.Button(String label, int width = 0, int height = 0)

    Creates a button. Returns true while button is pressed.

  • AgsImGui.SmallButton

    static bool AgsImGui.SmallButton(String label)

    Creates a button with no padding to be easier to embed within text. Returns true while button is pressed.

  • AgsImGui.Image

    static void AgsImGui.Image(int sprite_id)

    Create an image with passed sprite ID.

  • AgsImGui.ImageButton

    static bool AgsImGui.ImageButton(int sprite_id)

    Create a button with an image with passed sprite ID. Returns true while button is pressed.

  • AgsImGui.ArrowButton

    static bool AgsImGui.ArrowButton(String label, ImGuiDir dir)

    Creates a button with an arrow shape. Returns true while button is pressed.

  • AgsImGui.Checkbox

    static bool AgsImGui.Checkbox(String label, bool initial_value)

    Creates a checkbox button. Returns true when button is marked.

  • AgsImGui.RadioButton

    static bool AgsImGui.RadioButton(String label, bool active)

    Creates a radio button. Returns true while button is marked.

  • AgsImGui.Bullet

    static void AgsImGui.Bullet()

    Draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses .




    Widgets: Selectables

    A selectable highlights when hovered, and can display another color when selected.

  • AgsImGui.Selectable

    static bool AgsImGui.Selectable(String label, bool selected = false, ImGuiSelectableFlags flags = 0, int width = 0, int height = 0)

    bool selected carry the selection state (read-only). When Selectable() is clicked it returns true so you can modify your selection state.




    Widgets: Drag

    CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.

  • AgsImGui.DragFloat

    static float AgsImGui.DragFloat(String label, float value, float min_value = 0, float max_value = 0, float speed = 0, String format = 0)

    Returns the current value of the drag box. Format string uses regular "%f" specifiers, so you can use to define how many decimals you want.

  • AgsImGui.DragInt

    static int AgsImGui.DragInt(String label, int value, int min_value = 0, int max_value = 0, float speed = 0, String format = 0)

    Returns the current value of the drag box. Format string uses regular "%d", you can use it to specify left most zeroes.




    Widgets: Slider

    CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.

  • AgsImGui.SliderFloat

    static float AgsImGui.SliderFloat(String label, float value, float min_value = 0, float max_value = 0, String format = 0)

    Returns the current value of the slider. Format string uses regular "%f" specifiers, so you can use to define how many decimals you want.

  • AgsImGui.SliderInt

    static int AgsImGui.SliderInt(String label, int value, int min_value = 0, int max_value = 0, String format = 0)

    Returns the current value of the slider. Format string uses regular "%d", you can use it to specify left most zeroes.




    Widgets: Input with Keyboard

  • AgsImGui.InputText

    static String AgsImGui.InputText(String label, String text_buffer, int buffer_size, ImGuiInputTextFlags flags =0)

    Pass a string to identify the input field as label, this label is going to be used for ID and can't be empty.

    Remember that we don't save state between frames, so you have to do this yourself by reapplying the output to input as needed.

    This function returns null when the input hasn't changed, and returns a string with all the text, when it has been modified.

    This widget supports Ctrl+Z for undo, Ctrl+X for Cut, Ctrl+C for copy, Ctrl+V for pasting, mouse selection and cursor navigation with arrows.
    Behavior can be modified by passing flags, see the enums section. Flags can be combined with bitwise operations.

    Example:
    Code (AGS) Select

    String input_string;
    function room_RepExec() {
      AgsImGui.NewFrame();
        // buff
      String out_string = AgsImGui.InputText("type here!",input_string, 128);
      if(out_string!=null) input_string = out_string;

      AgsImGui.Render();
    }


    function room_Load() {
      input_string = "Hello String!";
    }


  • AgsImGui.InputTextMultiline

    static String AgsImGui.InputTextMultiline(String label, String text_buffer, int buffer_size, int width=0, int height=0, ImGuiInputTextFlags flags = 0)

    Same as InputText, but allows controlling the input size and supports multiline text.

  • AgsImGui.InputTextWithHint

    static String AgsImGui.InputTextWithHint(String label, String hint, String text_buffer, int buffer_size, ImGuiInputTextFlags flags = 0)

    Same as InputText, but supports passing an input hint text.




    Widgets: Combobox commands

  • AgsImGui.BeginCombo

    static bool AgsImGui.BeginCombo(String label, String preview_value, ImGuiComboFlags flags = 0);

    The BeginCombo()/EndCombo() allows to manage your contents and selection state however you want it, by creating e.g. Selectable() items.

    Example:
    Code (AGS) Select

    bool option1;
    bool option2;
    if(AgsImGui.BeginCombo("My combo","click me!")){
      option1 = AgsImGui.Selectable("Option 1");
      option2 = AgsImGui.Selectable("Option 2");
      AgsImGui.EndCombo();
    }


  • AgsImGui.EndCombo

    static void EndCombo()

    Only call EndCombo() if BeginCombo() returns true!




    Widgets: List Boxes commands

  • AgsImGui.BeginListBox

    static bool AgsImGui.BeginListBox(String label, int items_count, int height_in_items = -1);

    The BeginListBox()/EndListBox() allows to manage your contents and selection state however you want it, by creating e.g. Selectable() items.

    Example:
    Code (AGS) Select

    bool option1;
    bool option2;
    if(AgsImGui.BeginListBox("My ListBox",2)){
      option1 = AgsImGui.Selectable("Option 1");
      option2 = AgsImGui.Selectable("Option 2");
      AgsImGui.EndListBox();
    }


  • AgsImGui.EndListBox

    static void AgsImGui.EndListBox()

    Only call EndListBox() if BeginListBox() returns true!




    Widgets: Trees

    TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents.

  • AgsImGui.TreeNode

    static bool AgsImGui.TreeNode(String label)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreeNodeWithID

    static bool AgsImGui.TreeNodeWithID(String str_id, String text)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreeNodeV

    static bool AgsImGui.TreeNodeV(String str_id, String text)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreeNodeEx

    static bool AgsImGui.TreeNodeEx(String label, ImGuiTreeNodeFlags flags = 0)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreeNodeExWithID

    static bool AgsImGui.TreeNodeExWithID(String str_id, ImGuiTreeNodeFlags flags, String text)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreeNodeExV

    static bool AgsImGui.TreeNodeExV(String str_id, ImGuiTreeNodeFlags flags, String text)

    Show the contents and call TreePop() at the end, if this returns true.

  • AgsImGui.TreePush

    static void AgsImGui.TreePush(String str_id)

    ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired.

  • AgsImGui.TreePop

    static void AgsImGuiTreePop()

    ~ Unindent()+PopId().

  • AgsImGui.GetTreeNodeToLabelSpacing

    static float AgsImGui.GetTreeNodeToLabelSpacing()

    Horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode.

  • AgsImGui.CollapsingHeader

    static bool AgsImGui.CollapsingHeader(String label, ImGuiTreeNodeFlags flags = 0)

    If returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().




    Tooltips

    Tooltip are windows following the mouse which do not take focus away.

    Remember we can only have one active tooltip at all times, and the last one called is the active one.

  • AgsImGui.BeginTooltip

    static void AgsImGui.BeginTooltip()

    Begin/append a tooltip window. to create full-featured tooltip (with any kind of items). Doesn't return nothing.

  • AgsImGui.EndTooltip

    static void AgsImGui.EndTooltip()

    Always call after a BeginTooltip block!

  • AgsImGui.SetTooltip

    static void AgsImGui.SetTooltip(String text)

    Set a text-only tooltip, typically use with AgsImGui.IsItemHovered(). Override any previous call to SetTooltip().

    Example:
    Code (AGS) Select

    AgsImGui.Button("Clicks for nothing!");
    if(AgsImGui.IsItemHovered()) AgsImGui.SetTooltip("Button is hovered!");

    [big]
    [/big]

    Popups and Modals

  • AgsImGui.OpenPopup

    static void AgsImGui.OpenPopup(String str_id)

    call to mark popup as open (don't call every frame!). Popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.

    Popup identifiers are relative to the current ID-stack.

    Example:
    Code (AGS) Select

    // If the button is in the Window, this code goes inside the window.
    if(AgsImGui.BeginPopup("my_popup")){
      AgsImGui.Text("This is a popup");
      AgsImGui.EndPopup();
    }
    if(AgsImGui.Button("open popup"))
    {
      AgsImGui.OpenPopup("my_popup");
    }


  • AgsImGui.BeginPopup

    static bool AgsImGui.BeginPopup(String str_id, ImGuiWindowFlags flags = 0)

    Return true if the popup is open, and you can start outputting to it.
    Only call EndPopup() if BeginPopup() returns true!

    Generally you will want to run this on every frame, and it will return true once the popup has been made open,
    and return false again once it's closed.

  • AgsImGui.BeginPopupModal

    static bool AgsImGui.BeginPopupModal(String name, bool has_close_button = 0, ImGuiWindowFlags flags = 0)

    Modal dialog, a regular window with title bar, block interactions behind the modal window, and you can't close the
    modal window by clicking outside.

  • AgsImGui.EndPopup

    static void AgsImGui.EndPopup()

    Only call EndPopup() if BeginPopupXXX() returns true!

  • AgsImGui.IsPopupOpen

    static bool AgsImGui.IsPopupOpen(String str_id)

    Return true if the popup is open at the current begin-ed level of the popup stack.

  • AgsImGui.CloseCurrentPopup

    static void AgsImGui.CloseCurrentPopup()

    Close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.




    Tab Bars, Tabs

  • AgsImGui.BeginTabBar

    static bool AgsImGui.BeginTabBar(String str_id, ImGuiTabBarFlags flags = 0)

    create and append into a TabBar

  • AgsImGui.EndTabBar

    static void AgsImGui.EndTabBar()

    only call EndTabBar() if BeginTabBar() returns true!

  • AgsImGui.BeginTabItem

    static bool AgsImGui.BeginTabItem(String label, bool has_close_button = 0, ImGuiTabItemFlags flags = 0)

    create a Tab. Returns true if the Tab is selected.

  • AgsImGui.EndTabItem

    static void AgsImGui.EndTabItem()

    only call EndTabItem() if BeginTabItem() returns true!

  • AgsImGui.SetTabItemClosed

    static void AgsImGui.SetTabItemClosed(String tab_or_docked_window_label)

    notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name.




    Menus

  • AgsImGui.BeginMenuBar

    static bool AgsImGui.BeginMenuBar()

    Append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).

  • AgsImGui.EndMenuBar

    static void AgsImGui.EndMenuBar()

    Only call EndMenuBar() if BeginMenuBar() returns true!

  • AgsImGui.BeginMainMenuBar

    static bool AgsImGui.BeginMainMenuBar()

    Create and append to a full screen menu-bar.

  • AgsImGui.EndMainMenuBar

    static void AgsImGui.EndMainMenuBar()

    Only call EndMainMenuBar() if BeginMainMenuBar() returns true!

  • AgsImGui.BeginMenu

    static bool AgsImGui.BeginMenu(String label, bool enabled = true)

    Create a sub-menu entry. Only call EndMenu() if this returns true!

  • AgsImGui.EndMenu

    static void AgsImGui.EndMenu()

    Only call EndMenu() if BeginMenu() returns true!

  • AgsImGui.MenuItem

    static bool AgsImGui.MenuItem(String label, String shortcut, bool selected = false, bool enabled = true)

    return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment!




    General Helpers

  • AgsImGuiHelper.SetClipboarText

    static void AgsImGuiHelper.SetClipboarText(String text)

  • AgsImGuiHelper.GetClipboarText

    static String AgsImGuiHelper.GetClipboarText()





    ImVec2

    This is a format used to describe either x,y points or zero origin rectangles and other things that can be described as vectors.
    It's used more in the attributes of a ImGuiStyle object.


    ImVec4

    This is a format used to describe either x,y,w,z points or any origin rectangles and other things that can be described as vectors with 4 coordinates.
    It's the preferable format for ImGui Colors, and used a lot for this! It's used more in the attributes of a ImGuiStyle object.


    ImGuiStyle

    A big object used to describe the theme in ImGui.


    Enums

    ImGuiCond


    • eImGuiCond_Always, used when condition should always trigger, is usually the default when the AgImGui API requires
      conditions.
    • eImGuiCond_Once, Set the variable once per runtime session (only the first call with succeed).
    • eImGuiCond_FirstUseEver, Set the variable if the object/window has no persistently saved data (no entry in .ini file).
    • eImGuiCond_Appearing, Set the variable if the object/window is appearing after being hidden/inactive (or the first time).
    ImGuiDir


    • eImGuiDir_Left, left direction.
    • eImGuiDir_Right, right direction.
    • eImGuiDir_Up, up direction.
    • eImGuiDir_Down, down direction.
    ImGuiBeginWindow

    obs: This is exclusive to AgsImGui implementation because in AGS we don't have pointers to primitive types.

    In any cases below, you still have to call AgsImGui.EndWindow().


    • eImGuiBeginWindow_OK, the window is open.
    • eImGuiBeginWindow_Collapsed, the window is collapsed (using the arrow at top left).
    • eImGuiBeginWindow_OK_Closed the window is closed. This value is only returned at mouse release frame, after clicking on close button!
    • eImGuiBeginWindow_Collapsed_Closed the window is both collapsed and closed, rare but theoretically possible.
    ImGuiWindowFlags


    • eImGuiWindowFlags_None (= 0), Default.
    • eImGuiWindowFlags_NoTitleBar, Disable title-bar
    • eImGuiWindowFlags_NoResize, Disable user resizing with the lower-right grip
      ...
    • eImGuiWindowFlags_NoInputs, Disable inputs.
    Check the README on GitHub for the complete enum listing.

    enum ImGuiInputTextFlags

    The enums of this type can be combined with bitwise operators.

    Check the README on GitHub for the complete enum listing.

    enum ImGuiCol_

    The enums of this type can be combined with bitwise operators.

    Used for selecting a specific color from the ImGuiStyle.Colors[] property. An example usage would be:

    Code (AGS) Select

    ImGuiStyle* style = ImGui.GetStyle();
    style.Colors[eImGuiCol_WindowBg] = ImVec4.Create(1.0, 0.0, 0.0, 0.0);
    ImGui.SetStyle(style);


    This would use the enum eImGuiCol_WindowBg to access the desired color you want to modify,
    which in the example sets to a red color. Check the README on GitHub for the complete enum listing.

[close]
FAQ

How do I make mouse wheel work?

First, make sure you have mouse wheel support enabled in Global Settings.

Then, in some script, add the code below. Note: If the script is a Room script, it will only work in that room.
Code (AGS Script) Select

void on_mouse_click (int btn){
  if(btn == eMouseWheelNorth){
    AgsImGui.DoMouseWheel(eImGuiDir_Down);
  } else if(btn == eMouseWheelSouth){
    AgsImGui.DoMouseWheel(eImGuiDir_Up);   
  } 
}

For now, mouse wheel events are not exposed in the AGS Plugin API, so you have to do it through script. In the future, if this changes, it will be integrated in the plugin.


License and Author

AgsImGui is made by eri0o provided with MIT LICENSE (https://github.com/ericoporto/agsimgui/blob/master/LICENSE).

Using ocornut Dear ImGui, and also using software renderer with modifications from LAK132, and using other changes to ensure AGS compatibility, provided with MIT License.

Additionally using David Cappelo clip library for providing cross platform clipboard integration, also provided with MIT License.
Title: Re: [PLUGIN] agsimgui 0.1.0 - build GUIs easily for debug purposes!
Post by: Mehrdad on Sat 11/01/2020 17:26:32
It's really great tool!!
You're so awesome @eri0o
Title: Re: [PLUGIN] agsimgui 0.1.0 - build GUIs easily for debug purposes!
Post by: lorenzo on Sat 11/01/2020 18:18:50
I just tried the demo game and it's incredible! I'll try to tinker with it in AGS tomorrow.

You're making some really impressive plugins and modules!
Title: Re: [PLUGIN] agsimgui 0.1.0 - build GUIs easily for debug purposes!
Post by: eri0o on Sat 11/01/2020 21:43:21
I am happy you guys liked it! This is not designed to make pretty stuff, but should help build useful tools!

It doesn't have actual docs, the original implementation is documented alongside the code, so the things I wrote in the README may not be clear enough, so any questions fire up and I will try to make instructions clearer!

If you guys feel you want something to help scripting your debug GUIs that is not there, there's either a chance it's there and I forgot to document it, or that I didn't exposed in the API yet.
Title: Re: [PLUGIN] agsimgui 0.3.0 - build GUIs easily for debug purposes!
Post by: eri0o on Sun 07/06/2020 20:07:07
(https://i.imgur.com/heu87DJ.png) (https://i.imgur.com/h4hvYvz.png)

It's possible now to modify colors and other Theme configurations. Here's an example:

Code (ags) Select

function room_Load()
{

  ImVec4* white = ImVec4.Create(1.00, 1.00, 1.00, 1.00);
  ImVec4* transparent = ImVec4.Create(0.00, 0.00, 0.00, 0.00);
  ImVec4* dark = ImVec4.Create(0.00, 0.00, 0.00, 0.20);
  ImVec4* darker = ImVec4.Create(0.00, 0.00, 0.00, 0.50);

  ImVec4* background = ImVec4.Create(0.95, 0.95, 0.95, 1.00);
  ImVec4* text = ImVec4.Create(0.10, 0.10, 0.10, 1.00);
  ImVec4* border = ImVec4.Create(0.64, 0.60, 0.60, 1.00);
  ImVec4* grab = ImVec4.Create(0.69, 0.69, 0.69, 1.00);
  ImVec4* header = ImVec4.Create(0.86, 0.86, 0.86, 1.00);
  ImVec4* active = ImVec4.Create(0.90, 0.47, 0.64, 1.00);
  ImVec4* hover = ImVec4.Create(0.40, 0.87, 0.84, 0.20);
 
  AgsImGui.StyleColorsLight();

  ImGuiStyle* style = AgsImGui.GetStyle();
 
  style.Colors[eImGuiCol_Text] = text;
  style.Colors[eImGuiCol_WindowBg] = background;
  style.Colors[eImGuiCol_ChildBg] = background;
  style.Colors[eImGuiCol_PopupBg] = white;

  style.Colors[eImGuiCol_Border] = border;
  style.Colors[eImGuiCol_BorderShadow] = transparent;

  style.Colors[eImGuiCol_Button] = header;
  style.Colors[eImGuiCol_ButtonHovered] = hover;
  style.Colors[eImGuiCol_ButtonActive] = active;

  style.Colors[eImGuiCol_FrameBg] = white;
  style.Colors[eImGuiCol_FrameBgHovered] = hover;
  style.Colors[eImGuiCol_FrameBgActive] = active;

  style.Colors[eImGuiCol_MenuBarBg] = header;
  style.Colors[eImGuiCol_Header] = header;
  style.Colors[eImGuiCol_HeaderHovered] = hover;
  style.Colors[eImGuiCol_HeaderActive] = active;

  style.Colors[eImGuiCol_CheckMark] = text;
  style.Colors[eImGuiCol_SliderGrab] = grab;
  style.Colors[eImGuiCol_SliderGrabActive] = darker;

  style.Colors[eImGuiCol_ScrollbarBg] = header;
  style.Colors[eImGuiCol_ScrollbarGrab] = grab;
  style.Colors[eImGuiCol_ScrollbarGrabHovered] = dark;
  style.Colors[eImGuiCol_ScrollbarGrabActive] = darker;
 
  AgsImGui.SetStyle(style);
}


With this you can completely customize the experience of AgsImGui which should make easier to use it for Gameplay purposes.

https://streamable.com/gsrwmb

Also, this release adds Tree entries, which are powerful to create debug GUIs to modify complex objects.

Unfortunately, AGS Forums are limited to 30001 characters per Post, so the top entry can't contain full API documentation anymore.

Please reach to the docs in GitHub for information on the available elements in the AgsImGui Plugin API: github.com/ericoporto/agsimgui (https://github.com/ericoporto/agsimgui)
Title: Re: [PLUGIN] agsimgui 0.3.0 - build GUIs easily for debug purposes!
Post by: Cassiebsg on Sun 07/06/2020 21:11:35
That is very cool video.  (nod)  :-D