Skip to content

API for ImGui

For more specific examples on how to use the functions you can look through the Example Plugin

GetTyWindowHandle


Syntax

API::GetTyWindowHandle();

Return Value

HWND

Returns the current Ty window handle.

It will be a nullptr if the Ty window hasn't shown yet or TygerFramework had a issue getting the handle (most of the time it should be fine).

DrawingGUI


Syntax

API::DrawingGUI();

Return Value

bool

Returns true if the TygerFramework menu is currently open.

SetImGuiFont


Sets the ImGui font to be the same as TygerFramework's main window

Syntax

API::SetImGuiFont(ImGui::GetIO().Fonts);

Parameters

imguiFont

Type: void*

Your ImGui Font pointer.

SetTygerFrameworkImGuiElements


Doesn't Need ImGui Installed

Sets the elements from the plugin that will be drawn below the plugin section in the TygerFramework ImGui window.

Overwrites the old value if its called again

Syntax

API::SetTygerFrameworkImGuiElements(elements)

Parameters

elements

Type: std::vector<TygerFrameworkImGuiParam>

All the elements that will be rendered in the TygerFramework ImGui window.

TygerFrameworkImGuiParam

Type: struct

  • First element is a enum for which element to draw
  • Second element is a std::string for if the element needs text

Enum values:

  • CollapsingHeader //Needs text for header name
  • Text //Needs text
  • TextWrapped //Needs text
  • SameLine //No text
  • NewLine //No text
  • Spacing //No text
  • SetTooltip //Needs text for tooltip (Adds a tooltip to the previous element)
  • TreePush //Needs text for tree internal name
  • TreePop //No text (Make sure to call when done after using TreePush)

Usage Example

void GUI::SetFrameworkImGuiElements()
{
    namespace fs = std::filesystem;
    //Setting the values for GUI to render on the TygerFramework window
    //Only a few basic elements available as its mainly intended to 
    //just be for adding basic stuff to the TygerFramework window 
    std::vector<TygerFrameworkImGuiParam> TygerFrameworkImguiElements = { 
        {CollapsingHeader, "Example Plugin"},
        {Text, "Files in Ty Directory Example"},
        {SameLine},
        {Text, "(?)"},
        {SetTooltip, "Just an Example of Iterating and Adding Elements"},
        {TreePush, "Example Plugin"} };
    //Looping through elements and adding them 
    //as a example of iterating and adding elements
    for (auto&& entry : fs::directory_iterator{ fs::current_path() }) {
        auto&& path = entry.path();
        TygerFrameworkImguiElements.push_back({ Text, path.filename().string()});
    }

    TygerFrameworkImguiElements.push_back({ TreePop });

    API::SetTygerFrameworkImGuiElements(TygerFrameworkImguiElements);

    API::LogPluginMessage("Set TygerFramework ImGui Functions");
}