[PLUGIN] agsimgui 0.3.0 - build GUIs easily for debug purposes!

Started by eri0o, Sat 11/01/2020 14:40:06

Previous topic - Next topic

eri0o

agsimgui  version 0.3.0



Get Latest Release agsimgui.dll | libagsimgui.so | libagsimgui.dylib | GitHub Repo | Demo Windows | Demo Linux

Dear ImGui plugin for Adventure Game Studio



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

// 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

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

    Code: ags
    static void AgsImGui.NewFrame()


    Call this before calling any AgsImGui commands.


  • AgsImGui.EndFrame

    Code: ags
    static void AgsImGui.EndFrame()


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


  • AgsImGui.Render

    Code: ags
    static void AgsImGui.Render()


    This will EndFrame and proceed to generate drawing instructions.


  • AgsImGui.GetStyle

    Code: ags
    static ImGuiStyle* AgsImGui.GetStyle()


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


  • AgsImGui.SetStyle

    Code: ags
    static void AgsImGui.SetStyle(ImGuiStyle* imGuiStyle)


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

    Code: AGS
    
    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

    Code: ags
    static String AgsImGui.GetVersion()


  • AgsImGui.ShowDemoWindow

    Code: ags
    static void AgsImGui.ShowDemoWindow()


  • AgsImGui.ShowAboutWindow

    Code: ags
    static void AgsImGui.ShowAboutWindow()


  • AgsImGui.ShowMetricsWindow

    Code: ags
    static void AgsImGui.ShowMetricsWindow()


  • AgsImGui.ShowUserGuide

    Code: ags
    static void AgsImGui.ShowUserGuide()





    Windows

  • AgsImGui.BeginWindow

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


  • AgsImGui.EndWindow

    Code: ags
    static void EndWindow()





    Child Windows

  • AgsImGui.BeginChild

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static bool AgsImGui.IsItemFocused()


    Is the last item focused for keyboard navigation?

  • AgsImGui.IsItemVisible

    Code: ags
    static bool AgsImGui.IsItemVisible()


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

  • AgsImGui.IsItemEdited

    Code: ags
    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

    Code: ags
    static bool AgsImGui.IsItemActivated()


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

  • AgsImGui.IsItemDeactivated

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static bool AgsImGui.IsItemToggledOpen()


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

  • AgsImGui.IsAnyItemHovered

    Code: ags
    static bool AgsImGui.IsAnyItemHovered()


    is any item hovered?

  • AgsImGui.IsAnyItemActive

    Code: ags
    static bool AgsImGui.IsAnyItemActive()


    is any item active?

  • AgsImGui.IsAnyItemFocused

    Code: ags
    static bool AgsImGui.IsAnyItemFocused()


    is any item focused?

  • AgsImGui.IsWindowAppearing

    Code: ags
    static bool AgsImGui.IsWindowAppearing()


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

  • AgsImGui.IsWindowCollapsed

    Code: ags
    static bool AgsImGui.IsWindowCollapsed()


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

  • AgsImGui.IsWindowFocused

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static void AgsImGui.Text(String text)


    Draws a string of text.

  • AgsImGui.TextColored

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


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

  • AgsImGui.TextDisabled

    Code: ags
    static void AgsImGui.TextDisabled(String text)


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

  • AgsImGui.TextWrapped

    Code: ags
    static void AgsImGui.TextWrapped(String text)


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

  • AgsImGui.LabelText

    Code: ags
    static void AgsImGui.LabelText(String label, String text)


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

  • AgsImGui.Bullet

    Code: ags
    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

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


    Creates a button. Returns true while button is pressed.

  • AgsImGui.SmallButton

    Code: ags
    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

    Code: ags
    static void AgsImGui.Image(int sprite_id)


    Create an image with passed sprite ID.

  • AgsImGui.ImageButton

    Code: ags
    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

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


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

  • AgsImGui.Checkbox

    Code: ags
    static bool AgsImGui.Checkbox(String label, bool initial_value)


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

  • AgsImGui.RadioButton

    Code: ags
    static bool AgsImGui.RadioButton(String label, bool active)


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

  • AgsImGui.Bullet

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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
    Code: ags
    "%f"
    specifiers, so you can use to define how many decimals you want.

  • AgsImGui.DragInt

    Code: ags
    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
    Code: ags
    "%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

    Code: ags
    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
    Code: ags
    "%f"
    specifiers, so you can use to define how many decimals you want.

  • AgsImGui.SliderInt

    Code: ags
    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
    Code: ags
    "%d"
    , you can use it to specify left most zeroes.




    Widgets: Input with Keyboard

  • AgsImGui.InputText

    Code: ags
    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
    
    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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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
    
    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

    Code: ags
    static void EndCombo()


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




    Widgets: List Boxes commands

  • AgsImGui.BeginListBox

    Code: ags
    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
    
    bool option1;
    bool option2;
    if(AgsImGui.BeginListBox("My ListBox",2)){
      option1 = AgsImGui.Selectable("Option 1");
      option2 = AgsImGui.Selectable("Option 2");
      AgsImGui.EndListBox();
    }
    


  • AgsImGui.EndListBox

    Code: ags
    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

    Code: ags
    static bool AgsImGui.TreeNode(String label)


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

  • AgsImGui.TreeNodeWithID

    Code: ags
    static bool AgsImGui.TreeNodeWithID(String str_id, String text)


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

  • AgsImGui.TreeNodeV

    Code: ags
    static bool AgsImGui.TreeNodeV(String str_id, String text)


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

  • AgsImGui.TreeNodeEx

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


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

  • AgsImGui.TreeNodeExWithID

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static void AgsImGuiTreePop()


    ~ Unindent()+PopId().

  • AgsImGui.GetTreeNodeToLabelSpacing

    Code: ags
    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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static void AgsImGui.EndTooltip()


    Always call after a BeginTooltip block!

  • AgsImGui.SetTooltip

    Code: ags
    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
    
    AgsImGui.Button("Clicks for nothing!");
    if(AgsImGui.IsItemHovered()) AgsImGui.SetTooltip("Button is hovered!");
    
    [big]
    [/big]

    Popups and Modals

  • AgsImGui.OpenPopup

    Code: ags
    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
    
    // 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

    Code: ags
    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

    Code: ags
    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

    Code: ags
    static void AgsImGui.EndPopup()


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

  • AgsImGui.IsPopupOpen

    Code: ags
    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

    Code: ags
    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

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


    create and append into a TabBar

  • AgsImGui.EndTabBar

    Code: ags
    static void AgsImGui.EndTabBar()


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

  • AgsImGui.BeginTabItem

    Code: ags
    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

    Code: ags
    static void AgsImGui.EndTabItem()


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

  • AgsImGui.SetTabItemClosed

    Code: ags
    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

    Code: ags
    static bool AgsImGui.BeginMenuBar()


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

  • AgsImGui.EndMenuBar

    Code: ags
    static void AgsImGui.EndMenuBar()


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

  • AgsImGui.BeginMainMenuBar

    Code: ags
    static bool AgsImGui.BeginMainMenuBar()


    Create and append to a full screen menu-bar.

  • AgsImGui.EndMainMenuBar

    Code: ags
    static void AgsImGui.EndMainMenuBar()


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

  • AgsImGui.BeginMenu

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


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

  • AgsImGui.EndMenu

    Code: ags
    static void AgsImGui.EndMenu()


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

  • AgsImGui.MenuItem

    Code: ags
    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

    Code: ags
    static void AgsImGuiHelper.SetClipboarText(String text)


  • AgsImGuiHelper.GetClipboarText

    Code: ags
    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

    Code: ags
    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).
    Code: ags
    ImGuiDir



    • eImGuiDir_Left, left direction.
    • eImGuiDir_Right, right direction.
    • eImGuiDir_Up, up direction.
    • eImGuiDir_Down, down direction.
    Code: ags
    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.
    Code: ags
    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.

    Code: ags
    enum ImGuiInputTextFlags


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

    Check the README on GitHub for the complete enum listing.

    Code: ags
    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
    
    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

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.

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.

Mehrdad

My official site: http://www.pershaland.com/

lorenzo

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!

eri0o

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.

eri0o



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

Code: ags

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

Cassiebsg

There are those who believe that life here began out there...

SMF spam blocked by CleanTalk