diff --git a/CMakeLists.txt b/CMakeLists.txt index 2da3c8f..9ac7a19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,8 @@ add_library(agsimgui SHARED agsimgui/AgsImVec2.h agsimgui/AgsImVec4.cpp agsimgui/AgsImVec4.h + agsimgui/AgsImGuiStyle.cpp + agsimgui/AgsImGuiStyle.h agsimgui/SerialHelper.cpp agsimgui/SerialHelper.h agsimgui/agsimgui.cpp diff --git a/agsimgui/AgsImGuiStyle.cpp b/agsimgui/AgsImGuiStyle.cpp new file mode 100644 index 0000000..6de2242 --- /dev/null +++ b/agsimgui/AgsImGuiStyle.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 Érico Vieira Porto + * + * This program is free software. You can use and redistribute it + * under the terms and conditions of the MIT License (see LICENCE). + */ + +#include +#include "AgsImGuiStyle.h" + + +//------------------------------------------------------------------------------ + +extern IAGSEngine* engine; + +AgsImGuiStyleInterface AgsImGuiStyle_Interface; +AgsImGuiStyleReader AgsImGuiStyle_Reader; + +const char* AgsImGuiStyleInterface::name = "ImGuiStyle"; + +//------------------------------------------------------------------------------ +#include "SerialHelper.h" +using namespace SerialHelper; + +int AgsImGuiStyleInterface::Dispose(const char* address, bool force) +{ + delete ((AgsImGuiStyle*)address); + return (1); +} + +//------------------------------------------------------------------------------ + +int AgsImGuiStyleInterface::Serialize(const char* address, char* buffer, int bufsize) +{ + AgsImGuiStyle* agsImGuiStyle = (AgsImGuiStyle*)address; + char* ptr = buffer; + char* end = buffer + bufsize; + + + return (ptr - buffer); +} + +//------------------------------------------------------------------------------ + +void AgsImGuiStyleReader::Unserialize(int key, const char* serializedData, int dataSize) +{ + char* ptr = (char*) serializedData; + + float val_x; + float val_y; + + + AgsImGuiStyle* agsImGuiStyle = new AgsImGuiStyle(key); + + engine->RegisterUnserializedObject(key, agsImGuiStyle, &AgsImGuiStyle_Interface); +} + +//.............................................................................. + diff --git a/agsimgui/AgsImGuiStyle.h b/agsimgui/AgsImGuiStyle.h new file mode 100644 index 0000000..4d548eb --- /dev/null +++ b/agsimgui/AgsImGuiStyle.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2020 Érico Vieira Porto + * + * This program is free software. You can use and redistribute it + * under the terms and conditions of the MIT License (see LICENCE). + */ + +#pragma once + +#ifndef _AGSIMGUISTYLE_H +#define _AGSIMGUISTYLE_H + +#include "plugin/agsplugin.h" +#include "imgui/imgui.h" + +struct AgsImGuiStyle: ImGuiStyle { + public : + int id; + AgsImGuiStyle() + : ImGuiStyle(){ + id = -1; + } + + AgsImGuiStyle(int _id) + : ImGuiStyle(){ + id = _id; + } +}; + +//------------------------------------------------------------------------------ +// AGS interface instances + +class AgsImGuiStyleInterface : public IAGSScriptManagedObject +{ +public: + static const char* name; + + AgsImGuiStyleInterface() {}; + + virtual int Dispose(const char* address, bool force); + virtual const char* GetType() { return (name); } + virtual int Serialize(const char* address, char* buffer, int bufsize); + +}; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +class AgsImGuiStyleReader : public IAGSManagedObjectReader +{ +public: + + AgsImGuiStyleReader() {} + + virtual void Unserialize(int key, const char* serializedData, int dataSize); + +}; + +//------------------------------------------------------------------------------ + +extern AgsImGuiStyleInterface AgsImGuiStyle_Interface; +extern AgsImGuiStyleReader AgsImGuiStyle_Reader; + +//------------------------------------------------------------------------------ + +#endif /* _AGSIMGUISTYLE_H */ + +//............ diff --git a/agsimgui/agsimgui.cpp b/agsimgui/agsimgui.cpp index bb23ce6..0015726 100644 --- a/agsimgui/agsimgui.cpp +++ b/agsimgui/agsimgui.cpp @@ -41,6 +41,7 @@ struct IUnknown; // Workaround for "combaseapi.h(229): error C2187: syntax error #include "AgsImVec2.h" #include "AgsImVec4.h" +#include "AgsImGuiStyle.h" #include @@ -187,6 +188,59 @@ namespace agsimgui { const char *ourScriptHeader = " // ags imgui module header \r\n" " \r\n" +" enum ImGuiCol_ \r\n" +" { \r\n" +" ImGuiCol_Text, \r\n" +" ImGuiCol_TextDisabled, \r\n" +" ImGuiCol_WindowBg, // Background of normal windows \r\n" +" ImGuiCol_ChildBg, // Background of child windows \r\n" +" ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows \r\n" +" ImGuiCol_Border, \r\n" +" ImGuiCol_BorderShadow, \r\n" +" ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input \r\n" +" ImGuiCol_FrameBgHovered, \r\n" +" ImGuiCol_FrameBgActive, \r\n" +" ImGuiCol_TitleBg, \r\n" +" ImGuiCol_TitleBgActive, \r\n" +" ImGuiCol_TitleBgCollapsed, \r\n" +" ImGuiCol_MenuBarBg, \r\n" +" ImGuiCol_ScrollbarBg, \r\n" +" ImGuiCol_ScrollbarGrab, \r\n" +" ImGuiCol_ScrollbarGrabHovered, \r\n" +" ImGuiCol_ScrollbarGrabActive, \r\n" +" ImGuiCol_CheckMark, \r\n" +" ImGuiCol_SliderGrab, \r\n" +" ImGuiCol_SliderGrabActive, \r\n" +" ImGuiCol_Button, \r\n" +" ImGuiCol_ButtonHovered, \r\n" +" ImGuiCol_ButtonActive, \r\n" +" ImGuiCol_Header, // Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem \r\n" +" ImGuiCol_HeaderHovered, \r\n" +" ImGuiCol_HeaderActive, \r\n" +" ImGuiCol_Separator, \r\n" +" ImGuiCol_SeparatorHovered, \r\n" +" ImGuiCol_SeparatorActive, \r\n" +" ImGuiCol_ResizeGrip, \r\n" +" ImGuiCol_ResizeGripHovered, \r\n" +" ImGuiCol_ResizeGripActive, \r\n" +" ImGuiCol_Tab, \r\n" +" ImGuiCol_TabHovered, \r\n" +" ImGuiCol_TabActive, \r\n" +" ImGuiCol_TabUnfocused, \r\n" +" ImGuiCol_TabUnfocusedActive, \r\n" +" ImGuiCol_PlotLines, \r\n" +" ImGuiCol_PlotLinesHovered, \r\n" +" ImGuiCol_PlotHistogram, \r\n" +" ImGuiCol_PlotHistogramHovered, \r\n" +" ImGuiCol_TextSelectedBg, \r\n" +" ImGuiCol_DragDropTarget, \r\n" +" ImGuiCol_NavHighlight, // Gamepad/keyboard: current highlighted item \r\n" +" ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB \r\n" +" ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active \r\n" +" ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active \r\n" +" ImGuiCol_COUNT \r\n" +" }; \r\n" +" \r\n" " enum ImGuiFocusedFlags \r\n" " { \r\n" " ImGuiFocusedFlags_None = 0, \r\n" @@ -417,6 +471,123 @@ namespace agsimgui { " \r\n" "}; \r\n" " \r\n" +"builtin managed struct ImGuiStyle \r\n" +" { \r\n" +" /// Creates an empty ImGuiStyle. \r\n" +" import static ImGuiStyle* Create(); // $AUTOCOMPLETESTATICONLY$ \r\n" +" \r\n" +" /// Global alpha applies to everything in Dear ImGui. \r\n" +" import attribute float Alpha; \r\n" +" \r\n" +" /// Padding within a window. +" import attribute ImVec2 WindowPadding; +" \r\n" +" /// Radius of window corners rounding. Set to 0.0f to have rectangular windows. \r\n" +" import attribute float WindowRounding; \r\n" +" \r\n" +" /// Thickness of border around windows. Generally set to 0.0f or 1.0f. \r\n" +" import attribute float WindowBorderSize; \r\n" +" \r\n" +" /// Minimum window size. This is a global setting. For individual windows, use SetNextWindowSizeConstraints(). \r\n" +" import attribute ImVec2 WindowMinSize; \r\n" +" \r\n" +" /// Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. \r\n" +" import attribute ImVec2 WindowTitleAlign; \r\n" +" \r\n" +" /// Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. \r\n" +" import attribute ImGuiDir WindowMenuButtonPosition; \r\n" +" \r\n" +" /// Radius of child window corners rounding. Set to 0.0f to have rectangular windows. \r\n" +" import attribute float ChildRounding; \r\n" +" \r\n" +" /// Thickness of border around child windows. Generally set to 0.0f or 1.0f. \r\n" +" import attribute float ChildBorderSize; \r\n" +" \r\n" +" /// Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) \r\n" +" import attribute float PopupRounding; \r\n" +" \r\n" +" /// Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. \r\n" +" import attribute float PopupBorderSize; \r\n" +" \r\n" +" /// Padding within a framed rectangle (used by most widgets). \r\n" +" import attribute ImVec2 FramePadding; \r\n" +" \r\n" +" /// Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). \r\n" +" import attribute float FrameRounding; \r\n" +" \r\n" +" /// Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). \r\n" +" import attribute float FrameBorderSize; \r\n" +" \r\n" +" /// Horizontal and vertical spacing between widgets/lines. \r\n" +" import attribute ImVec2 ItemSpacing; \r\n" +" \r\n" +" /// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). \r\n" +" import attribute ImVec2 ItemInnerSpacing; \r\n" +" \r\n" +" /// Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. Don't grow this too much! \r\n" +" import attribute ImVec2 TouchExtraPadding; \r\n" +" \r\n" +" /// Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). \r\n" +" import attribute float IndentSpacing; \r\n" +" \r\n" +" /// Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). \r\n" +" import attribute float ColumnsMinSpacing; \r\n" +" \r\n" +" /// Width of the vertical scrollbar, Height of the horizontal scrollbar. \r\n" +" import attribute float ScrollbarSize; \r\n" +" \r\n" +" /// Radius of grab corners for scrollbar. \r\n" +" import attribute float ScrollbarRounding; \r\n" +" \r\n" +" /// Minimum width/height of a grab box for slider/scrollbar. \r\n" +" import attribute float GrabMinSize; \r\n" +" \r\n" +" /// Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. \r\n" +" import attribute float GrabRounding; \r\n" +" \r\n" +" /// Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. \r\n" +" import attribute float TabRounding; \r\n" +" \r\n" +" /// Thickness of border around tabs. \r\n" +" import attribute float TabBorderSize; \r\n" +" \r\n" +" /// Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. \r\n" +" import attribute float TabMinWidthForUnselectedCloseButton; \r\n" +" \r\n" +" /// Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. \r\n" +" import attribute ImGuiDir ColorButtonPosition; \r\n" +" \r\n" +" /// Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). \r\n" +" import attribute ImVec2 ButtonTextAlign; \r\n" +" \r\n" +" /// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. \r\n" +" import attribute ImVec2 SelectableTextAlign; \r\n" +" \r\n" +" /// Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. \r\n" +" import attribute ImVec2 DisplayWindowPadding; \r\n" +" \r\n" +" /// If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! \r\n" +" import attribute ImVec2 DisplaySafeAreaPadding; \r\n" +" \r\n" +" /// Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. \r\n" +" import attribute float MouseCursorScale; \r\n" +" \r\n" +" /// Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. \r\n" +" import attribute bool AntiAliasedLines; \r\n" +" \r\n" +" /// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) \r\n" +" import attribute bool AntiAliasedFill; \r\n" +" \r\n" +" /// Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. \r\n" +" import attribute float CurveTessellationTol; \r\n" +" \r\n" +" /// Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. \r\n" +" import attribute float CircleSegmentMaxError; \r\n" +" \r\n" +" /// Colors \r\n" +" import attribute ImVec4 Colors[ImGuiCol_COUNT]; \r\n" +" }; \r\n" +" \r\n" " struct AgsImGui{ \r\n" " // Main \r\n" " \r\n" @@ -930,6 +1101,10 @@ int inline ToAgsBool(bool b){ return b ? 1 : 0; } +bool inline ToNormalBool(int bi){ + return bi!=0 ? true : false; +} + std::string g_ClipboardTextData = ""; static const char* ImGui_ImplClip_GetClipboardText(void*) @@ -1103,6 +1278,394 @@ AgsImVec4* AgsImVec4_Scale(AgsImVec4* self, uint32_t scale){ // -- end AgsImVec4 +// -- being AgsImGuiStyle + +AgsImVec2* NewAgsImVec2(ImVec2 &imVec2) { + AgsImVec2 *agsImVec2 = new AgsImVec2(imVec2.x,imVec2.y); + agsImVec2->id = engine->RegisterManagedObject(agsImVec2, &AgsImVec2_Interface); + return agsImVec2; +} + +AgsImVec4* NewAgsImVec4(ImVec4 &imVec4) { + AgsImVec4 *agsImVec4 = new AgsImVec4(imVec4.x,imVec4.y, imVec4.z, imVec4.w); + agsImVec4->id = engine->RegisterManagedObject(agsImVec4, &AgsImVec4_Interface); + return agsImVec4; +} + +void SetAgsImVec2(ImVec2 &imVec2, AgsImVec2* agsImVec2){ + imVec2.x = agsImVec2->x; + imVec2.y = agsImVec2->y; +} + +void SetAgsImVec4(ImVec4 &imVec4, AgsImVec4* agsImVec4){ + imVec4.x = agsImVec4->x; + imVec4.y = agsImVec4->y; + imVec4.z = agsImVec4->z; + imVec4.w = agsImVec4->w; +} + +void AgsImGuiStyle_SetAlpha(AgsImGuiStyle* self, uint32_t alpha){ + float f_alpha = ToNormalFloat(alpha); + self->Alpha = f_alpha; +} + +uint32_t AgsImGuiStyle_GetAlpha(AgsImGuiStyle* self){ + return ToAgsFloat(self->Alpha); +} + + +void AgsImGuiStyle_SetWindowPadding(AgsImGuiStyle* self, AgsImVec2* windowPadding){ + SetAgsImVec2(self->WindowPadding, windowPadding); +} + +AgsImVec2* AgsImGuiStyle_GetWindowPadding(AgsImGuiStyle* self){ + return NewAgsImVec2(self->WindowPadding); +} + + +void AgsImGuiStyle_SetWindowRounding(AgsImGuiStyle* self, uint32_t windowRounding){ + float f_windowRounding = ToNormalFloat(windowRounding); + self->WindowRounding = f_windowRounding; +} + +uint32_t AgsImGuiStyle_GetWindowRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->WindowRounding); +} + + +void AgsImGuiStyle_SetWindowBorderSize(AgsImGuiStyle* self, uint32_t windowBorderSize){ + float f_windowBorderSize = ToNormalFloat(windowBorderSize); + self->WindowBorderSize = f_windowBorderSize; +} + +uint32_t AgsImGuiStyle_GetWindowBorderSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->WindowBorderSize); +} + + +void AgsImGuiStyle_SetWindowMinSize(AgsImGuiStyle* self, AgsImVec2* windowMinSize){ + SetAgsImVec2(self->WindowMinSize, windowMinSize); +} + +AgsImVec2* AgsImGuiStyle_GetWindowMinSize(AgsImGuiStyle* self){ + return NewAgsImVec2(self->WindowMinSize); +} + + +void AgsImGuiStyle_SetWindowTitleAlign(AgsImGuiStyle* self, AgsImVec2* windowTitleAlign){ + SetAgsImVec2(self->WindowTitleAlign, windowTitleAlign); +} + +AgsImVec2* AgsImGuiStyle_GetWindowTitleAlign(AgsImGuiStyle* self){ + return NewAgsImVec2(self->WindowTitleAlign); +} + + +void AgsImGuiStyle_SetWindowMenuButtonPosition(AgsImGuiStyle* self, int windowMenuButtonPosition){ + self->WindowMenuButtonPosition = windowMenuButtonPosition; +} + +int AgsImGuiStyle_GetWindowMenuButtonPosition(AgsImGuiStyle* self){ + return self->WindowMenuButtonPosition; +} + + +void AgsImGuiStyle_SetChildRounding(AgsImGuiStyle* self, uint32_t childRounding){ + float f_childRounding = ToNormalFloat(childRounding); + self->ChildRounding = f_childRounding; +} + +uint32_t AgsImGuiStyle_GetChildRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->ChildRounding); +} + + +void AgsImGuiStyle_SetChildBorderSize(AgsImGuiStyle* self, uint32_t childBorderSize){ + float f_childBorderSize = ToNormalFloat(childBorderSize); + self->ChildBorderSize = f_childBorderSize; +} + +uint32_t AgsImGuiStyle_GetChildBorderSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->ChildBorderSize); +} + + +void AgsImGuiStyle_SetPopupRounding(AgsImGuiStyle* self, uint32_t popupRounding){ + float f_popupRounding = ToNormalFloat(popupRounding); + self->PopupRounding = f_popupRounding; +} + +uint32_t AgsImGuiStyle_GetPopupRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->PopupRounding); +} + + +void AgsImGuiStyle_SetPopupBorderSize(AgsImGuiStyle* self, uint32_t popupBorderSize){ + float f_popupBorderSize = ToNormalFloat(popupBorderSize); + self->PopupBorderSize = f_popupBorderSize; +} + +uint32_t AgsImGuiStyle_GetPopupBorderSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->PopupBorderSize); +} + + +void AgsImGuiStyle_SetFramePadding(AgsImGuiStyle* self, AgsImVec2* framePadding){ + SetAgsImVec2(self->FramePadding, framePadding); +} + +AgsImVec2* AgsImGuiStyle_GetFramePadding(AgsImGuiStyle* self){ + return NewAgsImVec2(self->FramePadding); +} + + +void AgsImGuiStyle_SetFrameRounding(AgsImGuiStyle* self, uint32_t frameRounding){ + float f_frameRounding = ToNormalFloat(frameRounding); + self->FrameRounding = f_frameRounding; +} + +uint32_t AgsImGuiStyle_GetFrameRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->FrameRounding); +} + + +void AgsImGuiStyle_SetFrameBorderSize(AgsImGuiStyle* self, uint32_t frameBorderSize){ + float f_frameBorderSize = ToNormalFloat(frameBorderSize); + self->FrameBorderSize = f_frameBorderSize; +} + +uint32_t AgsImGuiStyle_GetFrameBorderSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->FrameBorderSize); +} + + +void AgsImGuiStyle_SetItemSpacing(AgsImGuiStyle* self, AgsImVec2* itemSpacing){ + SetAgsImVec2(self->ItemSpacing, itemSpacing); +} + +AgsImVec2* AgsImGuiStyle_GetItemSpacing(AgsImGuiStyle* self){ + return NewAgsImVec2(self->ItemSpacing); +} + + +void AgsImGuiStyle_SetItemInnerSpacing(AgsImGuiStyle* self, AgsImVec2* itemInnerSpacing){ + SetAgsImVec2(self->ItemInnerSpacing, itemInnerSpacing); +} + +AgsImVec2* AgsImGuiStyle_GetItemInnerSpacing(AgsImGuiStyle* self){ + return NewAgsImVec2(self->ItemInnerSpacing); +} + + +void AgsImGuiStyle_SetTouchExtraPadding(AgsImGuiStyle* self, AgsImVec2* touchExtraPadding){ + SetAgsImVec2(self->TouchExtraPadding, touchExtraPadding); +} + +AgsImVec2* AgsImGuiStyle_GetTouchExtraPadding(AgsImGuiStyle* self){ + return NewAgsImVec2(self->TouchExtraPadding); +} + + +void AgsImGuiStyle_SetIndentSpacing(AgsImGuiStyle* self, uint32_t indentSpacing){ + float f_indentSpacing = ToNormalFloat(indentSpacing); + self->IndentSpacing = f_indentSpacing; +} + +uint32_t AgsImGuiStyle_GetIndentSpacing(AgsImGuiStyle* self){ + return ToAgsFloat(self->IndentSpacing); +} + + +void AgsImGuiStyle_SetColumnsMinSpacing(AgsImGuiStyle* self, uint32_t columnsMinSpacing){ + float f_columnsMinSpacing = ToNormalFloat(columnsMinSpacing); + self->ColumnsMinSpacing = f_columnsMinSpacing; +} + +uint32_t AgsImGuiStyle_GetColumnsMinSpacing(AgsImGuiStyle* self){ + return ToAgsFloat(self->ColumnsMinSpacing); +} + + +void AgsImGuiStyle_SetScrollbarSize(AgsImGuiStyle* self, uint32_t scrollbarSize){ + float f_scrollbarSize = ToNormalFloat(scrollbarSize); + self->ScrollbarSize = f_scrollbarSize; +} + +uint32_t AgsImGuiStyle_GetScrollbarSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->ScrollbarSize); +} + + +void AgsImGuiStyle_SetScrollbarRounding(AgsImGuiStyle* self, uint32_t scrollbarRounding){ + float f_scrollbarRounding = ToNormalFloat(scrollbarRounding); + self->ScrollbarRounding = f_scrollbarRounding; +} + +uint32_t AgsImGuiStyle_GetScrollbarRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->ScrollbarRounding); +} + + +void AgsImGuiStyle_SetGrabMinSize(AgsImGuiStyle* self, uint32_t grabMinSize){ + float f_grabMinSize = ToNormalFloat(grabMinSize); + self->GrabMinSize = f_grabMinSize; +} + +uint32_t AgsImGuiStyle_GetGrabMinSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->GrabMinSize); +} + + +void AgsImGuiStyle_SetGrabRounding(AgsImGuiStyle* self, uint32_t grabRounding){ + float f_grabRounding = ToNormalFloat(grabRounding); + self->GrabRounding = f_grabRounding; +} + +uint32_t AgsImGuiStyle_GetGrabRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->GrabRounding); +} + + +void AgsImGuiStyle_SetTabRounding(AgsImGuiStyle* self, uint32_t tabRounding){ + float f_tabRounding = ToNormalFloat(tabRounding); + self->TabRounding = f_tabRounding; +} + +uint32_t AgsImGuiStyle_GetTabRounding(AgsImGuiStyle* self){ + return ToAgsFloat(self->TabRounding); +} + + +void AgsImGuiStyle_SetTabBorderSize(AgsImGuiStyle* self, uint32_t tabBorderSize){ + float f_tabBorderSize = ToNormalFloat(tabBorderSize); + self->TabBorderSize = f_tabBorderSize; +} + +uint32_t AgsImGuiStyle_GetTabBorderSize(AgsImGuiStyle* self){ + return ToAgsFloat(self->TabBorderSize); +} + + +void AgsImGuiStyle_SetTabMinWidthForUnselectedCloseButton(AgsImGuiStyle* self, uint32_t tabMinWidthForUnselectedCloseButton){ + float f_tabMinWidthForUnselectedCloseButton = ToNormalFloat(tabMinWidthForUnselectedCloseButton); + self->TabMinWidthForUnselectedCloseButton = f_tabMinWidthForUnselectedCloseButton; +} + +uint32_t AgsImGuiStyle_GetTabMinWidthForUnselectedCloseButton(AgsImGuiStyle* self){ + return ToAgsFloat(self->TabMinWidthForUnselectedCloseButton); +} + + +void AgsImGuiStyle_SetColorButtonPosition(AgsImGuiStyle* self, int colorButtonPosition){ + self->ColorButtonPosition = colorButtonPosition; +} + +int AgsImGuiStyle_GetColorButtonPosition(AgsImGuiStyle* self){ + return self->ColorButtonPosition; +} + + +void AgsImGuiStyle_SetButtonTextAlign(AgsImGuiStyle* self, AgsImVec2* buttonTextAlign){ + SetAgsImVec2(self->ButtonTextAlign, buttonTextAlign); +} + +AgsImVec2* AgsImGuiStyle_GetButtonTextAlign(AgsImGuiStyle* self){ + return NewAgsImVec2(self->ButtonTextAlign); +} + + +void AgsImGuiStyle_SetSelectableTextAlign(AgsImGuiStyle* self, AgsImVec2* selectableTextAlign){ + SetAgsImVec2(self->SelectableTextAlign, selectableTextAlign); +} + +AgsImVec2* AgsImGuiStyle_GetSelectableTextAlign(AgsImGuiStyle* self){ + return NewAgsImVec2(self->SelectableTextAlign); +} + + +void AgsImGuiStyle_SetDisplayWindowPadding(AgsImGuiStyle* self, AgsImVec2* displayWindowPadding){ + SetAgsImVec2(self->DisplayWindowPadding, displayWindowPadding); +} + +AgsImVec2* AgsImGuiStyle_GetDisplayWindowPadding(AgsImGuiStyle* self){ + return NewAgsImVec2(self->DisplayWindowPadding); +} + + +void AgsImGuiStyle_SetDisplaySafeAreaPadding(AgsImGuiStyle* self, AgsImVec2* displaySafeAreaPadding){ + SetAgsImVec2(self->DisplaySafeAreaPadding, displaySafeAreaPadding); +} + +AgsImVec2* AgsImGuiStyle_GetDisplaySafeAreaPadding(AgsImGuiStyle* self){ + return NewAgsImVec2(self->DisplaySafeAreaPadding); +} + + +void AgsImGuiStyle_SetMouseCursorScale(AgsImGuiStyle* self, uint32_t mouseCursorScale){ + float f_mouseCursorScale = ToNormalFloat(mouseCursorScale); + self->MouseCursorScale = f_mouseCursorScale; +} + +uint32_t AgsImGuiStyle_GetMouseCursorScale(AgsImGuiStyle* self){ + return ToAgsFloat(self->MouseCursorScale); +} + + +void AgsImGuiStyle_SetAntiAliasedLines(AgsImGuiStyle* self, int antiAliasedLines){ + self->AntiAliasedLines = ToNormalBool(antiAliasedLines); +} + +int AgsImGuiStyle_GetAntiAliasedLines(AgsImGuiStyle* self){ + return ToAgsBool(self->AntiAliasedLines); +} + + +void AgsImGuiStyle_SetAntiAliasedFill(AgsImGuiStyle* self, int antiAliasedFill){ + self->AntiAliasedFill = ToNormalBool(antiAliasedFill); +} + +int AgsImGuiStyle_GetAntiAliasedFill(AgsImGuiStyle* self){ + return ToAgsBool(self->AntiAliasedFill); +} + + +void AgsImGuiStyle_SetCurveTessellationTol(AgsImGuiStyle* self, uint32_t curveTessellationTol){ + float f_curveTessellationTol = ToNormalFloat(curveTessellationTol); + self->CurveTessellationTol = f_curveTessellationTol; +} + +uint32_t AgsImGuiStyle_GetCurveTessellationTol(AgsImGuiStyle* self){ + return ToAgsFloat(self->CurveTessellationTol); +} + + +void AgsImGuiStyle_SetCircleSegmentMaxError(AgsImGuiStyle* self, uint32_t circleSegmentMaxError){ + float f_circleSegmentMaxError= ToNormalFloat(circleSegmentMaxError); + self->CircleSegmentMaxError = f_circleSegmentMaxError; +} + +uint32_t AgsImGuiStyle_GetCircleSegmentMaxError(AgsImGuiStyle* self){ + return ToAgsFloat(self->CircleSegmentMaxError); +} + + +void AgsImGuiStyle_SetColors(AgsImGuiStyle* self, int i, AgsImVec4* color){ + if ((i < 0) || (i > ImGuiCol_COUNT)) + return; + + SetAgsImVec4(self->Colors[i], color); +} + +AgsImVec4* AgsImGuiStyle_GetColors(AgsImGuiStyle* self, int i){ + if ((i < 0) || (i > ImGuiCol_COUNT)) + return nullptr; + + return NewAgsImVec4(self->Colors[i]); +} + + + +// -- end AgsImGuiStyle void AgsImGui_NewFrame(){ if (!screen.initialized) return; @@ -1791,6 +2354,7 @@ int AgsImGuiHelper_GetClipboarImage() { engine->AddManagedObjectReader(AgsImVec2Interface::name, &AgsImVec2_Reader); engine->AddManagedObjectReader(AgsImVec4Interface::name, &AgsImVec4_Reader); + engine->AddManagedObjectReader(AgsImGuiStyleInterface::name, &AgsImGuiStyle_Reader); //register functions if(screen.driver == Screen::Driver::eOpenGL) { @@ -1893,6 +2457,81 @@ int AgsImGuiHelper_GetClipboarImage() { engine->RegisterScriptFunction("ImVec2::Sub^1", (void*)AgsImVec2_Sub); engine->RegisterScriptFunction("ImVec2::Scale^1", (void*)AgsImVec2_Scale); + engine->RegisterScriptFunction("ImGuiStyle::set_Alpha", (void*)AgsImGuiStyle_SetAlpha); + engine->RegisterScriptFunction("ImGuiStyle::get_Alpha", (void*)AgsImGuiStyle_GetAlpha); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowPadding", (void*)AgsImGuiStyle_SetWindowPadding); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowPadding", (void*)AgsImGuiStyle_GetWindowPadding); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowRounding", (void*)AgsImGuiStyle_SetWindowRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowRounding", (void*)AgsImGuiStyle_GetWindowRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowBorderSize", (void*)AgsImGuiStyle_SetWindowBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowBorderSize", (void*)AgsImGuiStyle_GetWindowBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowMinSize", (void*)AgsImGuiStyle_SetWindowMinSize); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowMinSize", (void*)AgsImGuiStyle_GetWindowMinSize); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowTitleAlign", (void*)AgsImGuiStyle_SetWindowTitleAlign); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowTitleAlign", (void*)AgsImGuiStyle_GetWindowTitleAlign); + engine->RegisterScriptFunction("ImGuiStyle::set_WindowMenuButtonPosition", (void*)AgsImGuiStyle_SetWindowMenuButtonPosition); + engine->RegisterScriptFunction("ImGuiStyle::get_WindowMenuButtonPosition", (void*)AgsImGuiStyle_GetWindowMenuButtonPosition); + engine->RegisterScriptFunction("ImGuiStyle::set_ChildRounding", (void*)AgsImGuiStyle_SetChildRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_ChildRounding", (void*)AgsImGuiStyle_GetChildRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_ChildBorderSize", (void*)AgsImGuiStyle_SetChildBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::get_ChildBorderSize", (void*)AgsImGuiStyle_GetChildBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::set_PopupRounding", (void*)AgsImGuiStyle_SetPopupRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_PopupRounding", (void*)AgsImGuiStyle_GetPopupRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_PopupBorderSize", (void*)AgsImGuiStyle_SetPopupBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::get_PopupBorderSize", (void*)AgsImGuiStyle_GetPopupBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::set_FramePadding", (void*)AgsImGuiStyle_SetFramePadding); + engine->RegisterScriptFunction("ImGuiStyle::get_FramePadding", (void*)AgsImGuiStyle_GetFramePadding); + engine->RegisterScriptFunction("ImGuiStyle::set_FrameRounding", (void*)AgsImGuiStyle_SetFrameRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_FrameRounding", (void*)AgsImGuiStyle_GetFrameRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_FrameBorderSize", (void*)AgsImGuiStyle_SetFrameBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::get_FrameBorderSize", (void*)AgsImGuiStyle_GetFrameBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::set_ItemSpacing", (void*)AgsImGuiStyle_SetItemSpacing); + engine->RegisterScriptFunction("ImGuiStyle::get_ItemSpacing", (void*)AgsImGuiStyle_GetItemSpacing); + engine->RegisterScriptFunction("ImGuiStyle::set_ItemInnerSpacing", (void*)AgsImGuiStyle_SetItemInnerSpacing); + engine->RegisterScriptFunction("ImGuiStyle::get_ItemInnerSpacing", (void*)AgsImGuiStyle_GetItemInnerSpacing); + engine->RegisterScriptFunction("ImGuiStyle::set_TouchExtraPadding", (void*)AgsImGuiStyle_SetTouchExtraPadding); + engine->RegisterScriptFunction("ImGuiStyle::get_TouchExtraPadding", (void*)AgsImGuiStyle_GetTouchExtraPadding); + engine->RegisterScriptFunction("ImGuiStyle::set_IndentSpacing", (void*)AgsImGuiStyle_SetIndentSpacing); + engine->RegisterScriptFunction("ImGuiStyle::get_IndentSpacing", (void*)AgsImGuiStyle_GetIndentSpacing); + engine->RegisterScriptFunction("ImGuiStyle::set_ColumnsMinSpacing", (void*)AgsImGuiStyle_SetColumnsMinSpacing); + engine->RegisterScriptFunction("ImGuiStyle::get_ColumnsMinSpacing", (void*)AgsImGuiStyle_GetColumnsMinSpacing); + engine->RegisterScriptFunction("ImGuiStyle::set_ScrollbarSize", (void*)AgsImGuiStyle_SetScrollbarSize); + engine->RegisterScriptFunction("ImGuiStyle::get_ScrollbarSize", (void*)AgsImGuiStyle_GetScrollbarSize); + engine->RegisterScriptFunction("ImGuiStyle::set_ScrollbarRounding", (void*)AgsImGuiStyle_SetScrollbarRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_ScrollbarRounding", (void*)AgsImGuiStyle_GetScrollbarRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_GrabMinSize", (void*)AgsImGuiStyle_SetGrabMinSize); + engine->RegisterScriptFunction("ImGuiStyle::get_GrabMinSize", (void*)AgsImGuiStyle_GetGrabMinSize); + engine->RegisterScriptFunction("ImGuiStyle::set_GrabRounding", (void*)AgsImGuiStyle_SetGrabRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_GrabRounding", (void*)AgsImGuiStyle_GetGrabRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_TabRounding", (void*)AgsImGuiStyle_SetTabRounding); + engine->RegisterScriptFunction("ImGuiStyle::get_TabRounding", (void*)AgsImGuiStyle_GetTabRounding); + engine->RegisterScriptFunction("ImGuiStyle::set_TabBorderSize", (void*)AgsImGuiStyle_SetTabBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::get_TabBorderSize", (void*)AgsImGuiStyle_GetTabBorderSize); + engine->RegisterScriptFunction("ImGuiStyle::set_TabMinWidthForUnselectedCloseButton", (void*)AgsImGuiStyle_SetTabMinWidthForUnselectedCloseButton); + engine->RegisterScriptFunction("ImGuiStyle::get_TabMinWidthForUnselectedCloseButton", (void*)AgsImGuiStyle_GetTabMinWidthForUnselectedCloseButton); + engine->RegisterScriptFunction("ImGuiStyle::set_ColorButtonPosition", (void*)AgsImGuiStyle_SetColorButtonPosition); + engine->RegisterScriptFunction("ImGuiStyle::get_ColorButtonPosition", (void*)AgsImGuiStyle_GetColorButtonPosition); + engine->RegisterScriptFunction("ImGuiStyle::set_ButtonTextAlign", (void*)AgsImGuiStyle_SetButtonTextAlign); + engine->RegisterScriptFunction("ImGuiStyle::get_ButtonTextAlign", (void*)AgsImGuiStyle_GetButtonTextAlign); + engine->RegisterScriptFunction("ImGuiStyle::set_SelectableTextAlign", (void*)AgsImGuiStyle_SetSelectableTextAlign); + engine->RegisterScriptFunction("ImGuiStyle::get_SelectableTextAlign", (void*)AgsImGuiStyle_GetSelectableTextAlign); + engine->RegisterScriptFunction("ImGuiStyle::set_DisplayWindowPadding", (void*)AgsImGuiStyle_SetDisplayWindowPadding); + engine->RegisterScriptFunction("ImGuiStyle::get_DisplayWindowPadding", (void*)AgsImGuiStyle_GetDisplayWindowPadding); + engine->RegisterScriptFunction("ImGuiStyle::set_DisplaySafeAreaPadding", (void*)AgsImGuiStyle_SetDisplaySafeAreaPadding); + engine->RegisterScriptFunction("ImGuiStyle::get_DisplaySafeAreaPadding", (void*)AgsImGuiStyle_GetDisplaySafeAreaPadding); + engine->RegisterScriptFunction("ImGuiStyle::set_MouseCursorScale", (void*)AgsImGuiStyle_SetMouseCursorScale); + engine->RegisterScriptFunction("ImGuiStyle::get_MouseCursorScale", (void*)AgsImGuiStyle_GetMouseCursorScale); + engine->RegisterScriptFunction("ImGuiStyle::set_AntiAliasedLines", (void*)AgsImGuiStyle_SetAntiAliasedLines); + engine->RegisterScriptFunction("ImGuiStyle::get_AntiAliasedLines", (void*)AgsImGuiStyle_GetAntiAliasedLines); + engine->RegisterScriptFunction("ImGuiStyle::set_AntiAliasedFill", (void*)AgsImGuiStyle_SetAntiAliasedFill); + engine->RegisterScriptFunction("ImGuiStyle::get_AntiAliasedFill", (void*)AgsImGuiStyle_GetAntiAliasedFill); + engine->RegisterScriptFunction("ImGuiStyle::set_CurveTessellationTol", (void*)AgsImGuiStyle_SetCurveTessellationTol); + engine->RegisterScriptFunction("ImGuiStyle::get_CurveTessellationTol", (void*)AgsImGuiStyle_GetCurveTessellationTol); + engine->RegisterScriptFunction("ImGuiStyle::set_CircleSegmentMaxError", (void*)AgsImGuiStyle_SetCircleSegmentMaxError); + engine->RegisterScriptFunction("ImGuiStyle::get_CircleSegmentMaxError", (void*)AgsImGuiStyle_GetCircleSegmentMaxError); + engine->RegisterScriptFunction("ImGuiStyle::seti_Colors", (void*)AgsImGuiStyle_SetColors); + engine->RegisterScriptFunction("ImGuiStyle::geti_Colors", (void*)AgsImGuiStyle_GetColors); + engine->RegisterScriptFunction("AgsImGui::NewFrame^0", (void*)AgsImGui_NewFrame); engine->RegisterScriptFunction("AgsImGui::EndFrame^0", (void*)AgsImGui_EndFrame); engine->RegisterScriptFunction("AgsImGui::Render^0", (void*)AgsImGui_Render);