Repository: patrickriordan/imgui_lua_bindings Branch: master Commit: 8e3421a7dbf4 Files: 6 Total size: 175.2 KB Directory structure: gitextract_o1rk1woc/ ├── Makefile ├── README.md ├── generate_imgui_bindings.pl ├── imgui_iterator.inl ├── imgui_lua_bindings.cpp └── parse_blocks.pl ================================================ FILE CONTENTS ================================================ ================================================ FILE: Makefile ================================================ all: g++ -c -I.. -I../imgui -I../lua/src imgui_lua_bindings.cpp -o imgui_lua_bindings.o ================================================ FILE: README.md ================================================ # These are imgui bindings for lua. ImGui https://github.com/ocornut/imgui These bindings support a lot of common imgui operations except for initializing imgui. This repo only deals with binding ImGui with lua and doesn't deal with setting up the ImGui impl files required to run ImGui, check out the ImGui repo for help with that. For LOVE bindings check out https://github.com/slages/love-imgui (uses these C++ bindings and does the rest of the work for you). Function support for dear imgui 1.60: Normal Imgui functions: Supported: 204 Unsupported: 117 Imgui DrawList functions: Supported: 36 Unsupported: 12 ## How to call these imgui bindings from lua It mostly is the same as calling from C++ except for dealing with pointers and ImVecs Function definition in C++ ```c++ IMGUI_API bool RadioButton(const char* label, bool active); ``` How to call function in lua ```lua ret = imgui.RadioButton("String goes here", isActive) ``` ## Pointers: Lua doesn't have pointers but it has multiple return values so instead of giving it a pointer, you give it a value and it will pass back the new value. Function definition in C++ ```c++ IMGUI_API void ShowTestWindow(bool* opened = NULL); ``` How to call function in lua ```lua opened = imgui.ShowTestWindow(opened) ``` This can make some functions a bit weird. For example Begin. Function definition in C++ ```c++ IMGUI_API bool Begin(const char* name, bool* p_opened = NULL, ImGuiWindowFlags flags = 0); ``` How to call function in lua (Note: optional arguments still work) ```lua shoulddraw, p_opened = imgui.Begin("Name", p_opened) ``` Begin normally returns whether it's desirable to draw or not as well as setting the value of p_opened to whether the window is open or not. Still use the first return value to decide to whether to call the ImGui functions for that window and imgui.End(). ## ImVecs: Those are arguments are expanded to separate variables instead of one object. Function definition in C++ ```c+++ IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); ``` How to call function in lua ```lua imgui.SetNextWindowPos(100, 50) ``` ## DrawList functions: All functions that operate on drawlists are called with the prefix DrawList Function definition in C++ ```c++ IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); ``` How to call function in lua ```lua imgui.DrawList_AddLine( imgui.DrawList_AddLine(minX, minY, maxX, maxY, 0xFF0000FF, 2) ``` Note you must specifiy the color in hex for now 0x(ALPHA)(BLUE)(GREEN)(RED) 0xFF0000FF = full opacity red ## Enums: Enums are exposed through a "constant" table. They're namespaced with "ImGui" stripped from the name. ```c++ ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiSetCond_FirstUseEver); ImGui::Begin("Demo", p_open, ImGuiWindowFlags_ShowBorders); ImGui::End() ``` ```lua imgui.SetNextWindowSize(550,680, imgui.constant.SetCond.FirstUseEver) imgui.Begin("Demo", true, imgui.constant.WindowFlags.ShowBorders) imgui.End() ``` ## How to build: Generate iterator file (or use the one for 1.50 already in the repo) ``` ./generate_imgui_bindings.pl <../imgui/imgui.h >imgui_iterator.inl ``` This creates a file with info about imgui functions from the imgui.h file. Then copy the macro definitions in imgui_lua_bindings.cpp and include imgui_iterator.inl in that the cpp file. This will generate static int impl_FunctionName(lua_State*L) {} functions for each imgui function. Bind these to lua functions and you're good to go. (Check out imgui_lua_bindings.cpp for a full example) The imgui_lua_bindings.cpp has two functions RunString and LoadImguiBindings To use the functions there first assign the global lState to a valid lua_State, then call LoadImguiBindings then run as many strings as you want. ## What is ENABLE_IM_LUA_END_STACK? I made something to keep track of the imgui begin stack so that I could continue using imGui functions if an error ocurred in the lua script. If you don't care about that don't define ENABLE_IM_LUA_END_STACK. I'm using a std::deque of ints to store what the last begin calls were and then if the script errors I unwrap them with ends so that imgui won't complain when I render. ## License? I don't feel like writing a license so here's it in laymans terms... You can use this code for whatever just don't redistribute the exact same source code and try to sell it, or claim that the source code was made by you. You can compile this source code and sell it. You can change this source code and sell the modified version. You can include this source code in whatever open source project (let me know please!). You can include it in whatever closed source project. Just be chill and if you make a billion dollars send me an email or something. ## Contributing If you have any improvements create a pull request! If you want a function supported or disagree with how the bindings work make an issue! ================================================ FILE: generate_imgui_bindings.pl ================================================ #!/usr/bin/perl use strict; use warnings; use diagnostics; # This works for IMGUI 1.60 and does not get all functions # # to use ./generate_imgui_bindings.pl <../imgui/imgui.h >imgui_iterator.inl # and define macros properly as in example imgui_lua_bindings.cpp # # check imgui_iterator for explanations of why some functions are not supported yet require "./parse_blocks.pl"; sub generateNamespaceImgui { my ($imguiCodeBlock) = @_; my $lineCaptureRegex = qr" *(IMGUI_API) *((const char\*)|([^ ]+)) *([^\(]+)\(([^\;]*)\);"; my $doEndStackOptions = 1; my $terminator = "} \/\/ namespace ImGui"; my $callPrefix = ""; my $functionSuffix = ""; #define bannedNames with keys of functions to exclude them # EXAMPLE: my %bannedNames = ( "NewFrame" => "banned", "Render" => "banned", "Shutdown" => "banned" ); # # This is only useful for ENABLE_IM_LUA_END_STACK # We hold a list of differnet 'things' that can be pushed to the stack # i.e. Group for BeginGroup # It usually works like this BeginBlah EndBlah # We have to redefine stuff when it doesn't work so cleanly my %beginN = ( "TreeNode" => "Tree", "TreePush" => "Tree", "PushStyleVar" => "StyleVar" ); my %changeN = ( "Tree" => "TreePop", "StyleVar"=> "PopStyleVar" ); my %endN = ( "TreePop" => "Tree", "PopStyleVar" => "StyleVar" ); my %endOverride = ( "PopupModal" => "Popup", "PopupContextItem" => "Popup", "PopupContextWindow" => "Popup", "PopupContextVoid" => "Popup" ); generateImguiGeneric( $lineCaptureRegex, $doEndStackOptions, $terminator, $callPrefix, $functionSuffix, \%bannedNames, \%beginN, \%changeN, \%endN, \%endOverride, $imguiCodeBlock) } sub generateDrawListFunctions { my ($imguiCodeBlock) = @_; my $lineCaptureRegex = qr" *(IMGUI_API|inline) *((const char\*)|([^ ]+)) *([^\(]+)\(([^\;]*)\);"; my $doEndStackOptions = 0; my $terminator = 0; my $callPrefix = "DRAW_LIST_"; my $functionSuffix = "_DRAW_LIST"; #define bannedNames with keys of functions to exclude them # EXAMPLE: my %bannedNames = ( ); # # This is only useful for ENABLE_IM_LUA_END_STACK # We hold a list of differnet 'things' that can be pushed to the stack # i.e. Group for BeginGroup # It usually works like this BeginBlah EndBlah # We have to redefine stuff when it doesn't work so cleanly my %beginN = ( ); my %changeN = ( ); my %endN = ( ); my %endOverride = ( ); generateImguiGeneric( $lineCaptureRegex, $doEndStackOptions, $terminator, $callPrefix, $functionSuffix, \%bannedNames, \%beginN, \%changeN, \%endN, \%endOverride, $imguiCodeBlock) } sub generateImguiGeneric { my $lineCaptureRegex = shift; my $doEndStackOptions = shift; my $terminator = shift; my $callPrefix = shift; my $functionSuffix = shift; #define bannedNames with keys of functions to exclude them # EXAMPLE: my $bannedNamesRef = shift; my %bannedNames = %{$bannedNamesRef}; # # This is only useful for ENABLE_IM_LUA_END_STACK # We hold a list of differnet 'things' that can be pushed to the stack # i.e. Group for BeginGroup # It usually works like this BeginBlah EndBlah # We have to redefine stuff when it doesn't work so cleanly my $beginNRef = shift; my %beginN = %{$beginNRef}; my $changeNRef = shift; my %changeN = %{$changeNRef}; my $endNRef = shift; my %endN = %{$endNRef}; my $endOverrideRef = shift; my %endOverride = %{$endOverrideRef}; my ($imguiCodeBlock) = @_; my $numSupported = 0; my $numUnsupported = 0; my $line; my %funcNames; my %endTypeToInt; my @endTypes; my @functionsAlreadyAdded; foreach $line (split /\n/, $imguiCodeBlock) { #replace ImVec2(x, y) with ImVec2 x, y so it's easier for regex (and ImVec4) $line =~ s/ImVec2\(([^,]*),([^\)]*)\)/ImVec2 $1 $2/g; $line =~ s/ImVec4\(([^,]*),([^\)]*),([^\)]*),([^\)]*)\)/ImVec4 $1 $2 $3 $4/g; #delete this so it's eaiser for regexes $line =~ s/ IM_PRINTFARGS\(.\);/;/g; if ($line =~ m/$lineCaptureRegex/) { print "//" . $line . "\n"; # this will be set to 0 if something is not supported yet my $shouldPrint = 1; my @args = split(',', $6); # things to do before calling real c++ function my @before; # arguments to real c++ function my @funcArgs; # things to do after callign real c++ function my @after; # real c++ function name my $funcName = $5; #say STDERR "Parsing function: " . $funcName; if (grep(/^$funcName$/, @functionsAlreadyAdded)) { #say STDERR $funcName; } push @functionsAlreadyAdded, $funcName; if (defined($bannedNames{$funcName})) { print "//Not allowed to use this function\n"; $shouldPrint = 0; } # c++ type of return value my $retType = $2; # macro used for calling function my $callMacro; # if it has a return value (yes I know this is not the cleanest code) my $hasRet = 1; if ($retType =~ /^void$/) { $callMacro = "${callPrefix}CALL_FUNCTION_NO_RET"; $hasRet = 0; } elsif ($retType =~ /^const char\*$/) { $callMacro = "${callPrefix}CALL_FUNCTION"; push(@funcArgs, "const char*"); push(@after, "PUSH_STRING(ret)"); } elsif ($retType =~ /^bool$/) { $callMacro = "${callPrefix}CALL_FUNCTION"; push(@funcArgs, "bool"); push(@after, "PUSH_BOOL(ret)"); } elsif ($retType =~ /^float$/) { $callMacro = "${callPrefix}CALL_FUNCTION"; push(@funcArgs, "float"); push(@after, "PUSH_NUMBER(ret)"); } elsif ($retType =~ /^ImVec2$/) { $callMacro = "${callPrefix}CALL_FUNCTION"; push(@funcArgs, "ImVec2"); push(@after, "PUSH_NUMBER(ret.x)"); push(@after, "PUSH_NUMBER(ret.y)"); } elsif ($retType =~ /^(unsigned int|ImGuiID|ImU32)$/) { $callMacro = "${callPrefix}CALL_FUNCTION"; push(@funcArgs, "unsigned int"); push(@after, "PUSH_NUMBER(ret)"); } else { print "// Unsupported return type $retType\n"; $shouldPrint = 0; } for (my $i = 0; $i < @args; $i++) { # bool * x = NULL or bool * x if ($args[$i] =~ m/^ *bool *\* *([^ =\[]*)( = NULL|) *$/) { my $name = $1; if ($2 =~ m/^ = NULL$/) { push(@before, "OPTIONAL_BOOL_POINTER_ARG($name)"); } else { push(@before, "BOOL_POINTER_ARG($name)"); } push(@funcArgs, $name); push(@after, "END_BOOL_POINTER($name)"); # float * x } elsif ($args[$i] =~ m/^ *float *\* *([^ =\[]*)$/) { my $name = $1; push(@before, "FLOAT_POINTER_ARG($name)"); push(@funcArgs, $name); push(@after, "END_FLOAT_POINTER($name)"); #float a or float a = number } elsif ($args[$i] =~ m/^ *float *([^ =\[]*)( *= *[^ ]*|)$/) { my $name = $1; if ($2 =~ m/^ *= *([^ ]*)$/) { push(@before, "OPTIONAL_NUMBER_ARG($name, $1)"); } else { push(@before, "NUMBER_ARG($name)"); } push(@funcArgs, $name); # const char* a or const char* a = NULL or "blah" } elsif ($args[$i] =~ m/^ *const char\* *([^ =\[]*)( *= *(NULL|".*")|) *$/) { my $name = $1; if ($2 =~ m/^ *= *NULL$/) { push(@before, "OPTIONAL_LABEL_ARG($name)"); } else { push(@before, "LABEL_ARG($name)"); } push(@funcArgs, $name); #const ImVec2& with default or not } elsif ($args[$i] =~ m/^ *const ImVec2& ([^ ]*) *(= * ImVec2 [^ ]* [^ ]*|) *$/) { my $name = $1; if ($2 =~ m/^= * ImVec2 ([^ ]*) ([^ ]*)$/) { push(@before, "OPTIONAL_IM_VEC_2_ARG($name, $1, $2)"); } else { push(@before, "IM_VEC_2_ARG($name)"); } push(@funcArgs, $name); # ImVec2 } elsif ($args[$i] =~ m/^ *ImVec2 ([^ ]*) *$/) { my $name = $1; push(@before, "IM_VEC_2_ARG($name)"); push(@funcArgs, $name); #const ImVec4& with default or not } elsif ($args[$i] =~ m/^ *const ImVec4& ([^ ]*) *(= * ImVec4 [^ ]* [^ ]* [^ ]* [^ ]*|) *$/) { my $name = $1; if ($2 =~ m/^= * ImVec4 ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)$/) { push(@before, "OPTIONAL_IM_VEC_4_ARG($name, $1, $2, $3, $4)"); } else { push(@before, "IM_VEC_4_ARG($name)"); } push(@funcArgs, $name); # one of the various enums # we are handling these as ints } elsif ($args[$i] =~ m/^ *(ImGuiWindowFlags|ImGuiCol|ImGuiStyleVar|ImGuiKey|ImGuiAlign|ImGuiColorEditMode|ImGuiMouseCursor|ImGuiSetCond|ImGuiInputTextFlags|ImGuiSelectableFlags) ([^ ]*)( = 0|) *$/) { #These are ints my $name = $2; if ($3 =~ m/^ = 0$/) { push(@before, "OPTIONAL_INT_ARG($name, 0)"); } else { push(@before, "INT_ARG($name)"); } push(@funcArgs, $name); #int with default value or not } elsif ($args[$i] =~ m/^ *int ([^ =\[]*)( = [^ ]*|) *$/) { my $name = $1; if ($2 =~ m/^ = ([^ ]*)$/) { push(@before, "OPTIONAL_INT_ARG($name, $1)"); } else { push(@before, "INT_ARG($name)"); } push(@funcArgs, $name); #unsigned int with default value or not } elsif ($args[$i] =~ m/^ *(unsigned +int|ImGuiID|ImU32) ([^ =\[]*)( = [^ ]*|) *$/) { my $name = $2; if ($2 =~ m/^ = ([^ ]*)$/) { push(@before, "OPTIONAL_UINT_ARG($name, $1)"); } else { push(@before, "UINT_ARG($name)"); } push(@funcArgs, $name); #ImTextureID or const ImTextureID& # const ImTextureID& is the same thing as var # as lua is concerned } elsif ($args[$i] =~ m/^ *(ImTextureID|const ImTextureID&) ([^ =\[]*) *$/) { my $name = $2; push(@before, "IM_TEXTURE_ID_ARG($name)"); push(@funcArgs, $name); # bool with default value or not } elsif ($args[$i] =~ m/^ *bool ([^ =\[]*)( *= *true| *= *false|) *$/) { my $name = $1; if ($2 =~ m/^ *= *([^ ]*)$/) { push(@before, "OPTIONAL_BOOL_ARG($name, $1)"); } else { push(@before, "BOOL_ARG($name)"); } push(@funcArgs, $name); # int * x } elsif ($args[$i] =~ m/^ *int *\* *([^ =\[]*)$/) { my $name = $1; push(@before, "INT_POINTER_ARG($name)"); push(@funcArgs, $name); push(@after, "END_INT_POINTER($name)"); # unsigned int * x } elsif ($args[$i] =~ m/^ *unsigned +int *\* *([^ =\[]*)$/) { my $name = $1; push(@before, "UINT_POINTER_ARG($name)"); push(@funcArgs, $name); push(@after, "END_UINT_POINTER($name)"); # we don't support variadic functions yet but we let you use it without extra variables } elsif ($args[$i] =~ m/^ *\.\.\. *$/) { print "// Variadic functions aren't suppported but here it is anyway\n"; } else { print "// Unsupported arg type " . $args[$i] . "\n"; $shouldPrint = 0; } } if ($shouldPrint != 0) { my $luaFunc = $funcName; # Stupid way of implementing overriding while($funcNames{$luaFunc}) { $luaFunc .= "_" . scalar(@args); } $funcNames{$luaFunc} = 1; print "IMGUI_FUNCTION${functionSuffix}($luaFunc)\n"; for (my $i = 0; $i < @before; $i++) { print $before[$i] . "\n"; } print $callMacro . "($funcName"; for (my $i = 0; $i < @funcArgs; $i++) { print ", " . $funcArgs[$i]; } print ")\n"; #for begin and end stack stuff if ($funcName =~ m/^Begin(.*)$/ || defined($beginN{$funcName})) { my $curEndType; if (defined($beginN{$funcName})) { $curEndType = $beginN{$funcName}; } else { $curEndType = $1; } if (defined($endOverride{$curEndType})) { $curEndType = $endOverride{$curEndType}; } if (!defined($endTypeToInt{$curEndType})) { $endTypeToInt{$curEndType} = scalar(@endTypes); push(@endTypes, $curEndType); } my $curEndTypeInt = $endTypeToInt{$curEndType}; if ($hasRet) { print "IF_RET_ADD_END_STACK($curEndTypeInt)\n"; } else { print "ADD_END_STACK($curEndTypeInt)\n"; } } elsif ($funcName =~ m/^End(.*)$/ || defined($endN{$funcName})) { my $curEndType; if (defined($endN{$funcName})) { $curEndType = $endN{$funcName}; } else { $curEndType = $1; } if (defined($endOverride{$curEndType})) { $curEndType = $endOverride{$curEndType}; } if (!defined($endTypeToInt{$curEndType})) { $endTypeToInt{$curEndType} = scalar(@endTypes); push(@endTypes, $curEndType); } my $curEndTypeInt = $endTypeToInt{$curEndType}; print "POP_END_STACK($curEndTypeInt)\n" } for (my $i = 0; $i < @after; $i++) { print $after[$i] . "\n"; } print "END_IMGUI_FUNC\n"; $numSupported += 1; } else { $numUnsupported += 1; } } elsif ($terminator) { if ($line =~ m/^${terminator}$/) { last; } } } #for end stack stuff if ($doEndStackOptions) { print "END_STACK_START\n"; for (my $i = 0; $i < @endTypes; $i++) { my $endFunc; if (defined($changeN{$endTypes[$i]})) { $endFunc = $changeN{$endTypes[$i]}; } else { $endFunc = "End" . $endTypes[$i]; } print "END_STACK_OPTION($i, " . $endFunc .")\n"; } print "END_STACK_END\n"; } #debug info print STDERR "Supported: $numSupported Unsupported: $numUnsupported\n"; } sub generateEnums { my $enumName = shift; my ($imguiCodeBlock) = @_; my $lineCaptureRegex = qr"^ *(ImGui)([^, _]+)_([a-zA-Z0-9]+)\b"; print "START_ENUM($enumName)\n"; my $line; foreach $line (split /\n/, $imguiCodeBlock) { if ($line =~ m/$lineCaptureRegex/) { die "Malformed enum at $enumName" unless ($2 eq $enumName); print "//" . $line . "\n"; print "MAKE_ENUM($1$2_$3,$3)\n"; } } print "END_ENUM($enumName)\n"; } my ($blocksref, $blocknamesref) = parse_blocks(); my @blocks = @$blocksref; my @blocknames = @$blocknamesref; # @spaderthomas 3/1/2020: ImGui also puts its deprecated functions in namespace ImGui, # so we'll end up parsing a couple functions twice and causing compiler errors. # # This flag just means that we've parsed the main one, so don't parse the next one. If ImGui # splits up its header to multiple instances of namespace ImGui, this would break. my $alreadyParsedMainImguiNamespace = 0; for (my $i=0; $i < scalar @blocks; $i++) { print "//" . $blocknames[$i] . "\n"; if (($blocknames[$i] eq "namespace ImGui\n") and not $alreadyParsedMainImguiNamespace) { $alreadyParsedMainImguiNamespace = 1; generateNamespaceImgui($blocks[$i]); } if ($blocknames[$i] =~ m/enum ImGui(.*)_\n/) { generateEnums($1, $blocks[$i]); } if ($blocknames[$i] eq "struct ImDrawList\n") { generateDrawListFunctions($blocks[$i]); } } ================================================ FILE: imgui_iterator.inl ================================================ //struct ImVec2 //struct ImVec4 //namespace ImGui // IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL); // Unsupported return type ImGuiContext* // Unsupported arg type ImFontAtlas* shared_font_atlas = NULL // IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context // Unsupported arg type ImGuiContext* ctx = NULL // IMGUI_API ImGuiContext* GetCurrentContext(); // Unsupported return type ImGuiContext* // IMGUI_API void SetCurrentContext(ImGuiContext* ctx); // Unsupported arg type ImGuiContext* ctx // IMGUI_API ImGuiIO& GetIO(); // Unsupported return type ImGuiIO& // IMGUI_API ImGuiStyle& GetStyle(); // Unsupported return type ImGuiStyle& // IMGUI_API void NewFrame(); // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame(). //Not allowed to use this function // IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data. (Obsolete: optionally call io.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.) //Not allowed to use this function // IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. (Obsolete: this used to be passed to your io.RenderDrawListsFn() function.) // Unsupported return type ImDrawData* // IMGUI_API void EndFrame(); // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead! IMGUI_FUNCTION(EndFrame) CALL_FUNCTION_NO_RET(EndFrame) POP_END_STACK(0) END_IMGUI_FUNC // IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_FUNCTION(ShowDemoWindow) OPTIONAL_BOOL_POINTER_ARG(p_open) CALL_FUNCTION_NO_RET(ShowDemoWindow, p_open) END_BOOL_POINTER(p_open) END_IMGUI_FUNC // IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. IMGUI_FUNCTION(ShowMetricsWindow) OPTIONAL_BOOL_POINTER_ARG(p_open) CALL_FUNCTION_NO_RET(ShowMetricsWindow, p_open) END_BOOL_POINTER(p_open) END_IMGUI_FUNC // IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) // Unsupported arg type ImGuiStyle* ref = NULL // IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles. IMGUI_FUNCTION(ShowStyleSelector) LABEL_ARG(label) CALL_FUNCTION(ShowStyleSelector, bool, label) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts. IMGUI_FUNCTION(ShowFontSelector) LABEL_ARG(label) CALL_FUNCTION_NO_RET(ShowFontSelector, label) END_IMGUI_FUNC // IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). IMGUI_FUNCTION(ShowUserGuide) CALL_FUNCTION_NO_RET(ShowUserGuide) END_IMGUI_FUNC // IMGUI_API const char* GetVersion(); // get a version string e.g. "1.23" IMGUI_FUNCTION(GetVersion) CALL_FUNCTION(GetVersion, const char*) PUSH_STRING(ret) END_IMGUI_FUNC // IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default) // Unsupported arg type ImGuiStyle* dst = NULL // IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style // Unsupported arg type ImGuiStyle* dst = NULL // IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font // Unsupported arg type ImGuiStyle* dst = NULL // IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); IMGUI_FUNCTION(Begin) LABEL_ARG(name) OPTIONAL_BOOL_POINTER_ARG(p_open) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(Begin, bool, name, p_open, flags) IF_RET_ADD_END_STACK(1) PUSH_BOOL(ret) END_BOOL_POINTER(p_open) END_IMGUI_FUNC // IMGUI_API void End(); IMGUI_FUNCTION(End) CALL_FUNCTION_NO_RET(End) POP_END_STACK(1) END_IMGUI_FUNC // IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2 0 0, bool border = false, ImGuiWindowFlags flags = 0); // Begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2 0 400. IMGUI_FUNCTION(BeginChild) LABEL_ARG(str_id) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) OPTIONAL_BOOL_ARG(border, false) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(BeginChild, bool, str_id, size, border, flags) IF_RET_ADD_END_STACK(2) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2 0 0, bool border = false, ImGuiWindowFlags flags = 0); IMGUI_FUNCTION(BeginChild_4) UINT_ARG(id) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) OPTIONAL_BOOL_ARG(border, false) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(BeginChild, bool, id, size, border, flags) IF_RET_ADD_END_STACK(2) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void EndChild(); IMGUI_FUNCTION(EndChild) CALL_FUNCTION_NO_RET(EndChild) POP_END_STACK(2) END_IMGUI_FUNC // IMGUI_API bool IsWindowAppearing(); IMGUI_FUNCTION(IsWindowAppearing) CALL_FUNCTION(IsWindowAppearing, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsWindowCollapsed(); IMGUI_FUNCTION(IsWindowCollapsed) CALL_FUNCTION(IsWindowCollapsed, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options. // Unsupported arg type ImGuiFocusedFlags flags=0 // IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! // Unsupported arg type ImGuiHoveredFlags flags=0 // IMGUI_API ImDrawList* GetWindowDrawList(); // get draw list associated to the window, to append your own drawing primitives // Unsupported return type ImDrawList* // IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList API) IMGUI_FUNCTION(GetWindowPos) CALL_FUNCTION(GetWindowPos, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetWindowSize(); // get current window size IMGUI_FUNCTION(GetWindowSize) CALL_FUNCTION(GetWindowSize, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x) IMGUI_FUNCTION(GetWindowWidth) CALL_FUNCTION(GetWindowWidth, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y) IMGUI_FUNCTION(GetWindowHeight) CALL_FUNCTION(GetWindowHeight, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates IMGUI_FUNCTION(GetContentRegionMax) CALL_FUNCTION(GetContentRegionMax, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos() IMGUI_FUNCTION(GetContentRegionAvail) CALL_FUNCTION(GetContentRegionAvail, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API float GetContentRegionAvailWidth(); // IMGUI_FUNCTION(GetContentRegionAvailWidth) CALL_FUNCTION(GetContentRegionAvailWidth, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates IMGUI_FUNCTION(GetWindowContentRegionMin) CALL_FUNCTION(GetWindowContentRegionMin, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates IMGUI_FUNCTION(GetWindowContentRegionMax) CALL_FUNCTION(GetWindowContentRegionMax, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API float GetWindowContentRegionWidth(); // IMGUI_FUNCTION(GetWindowContentRegionWidth) CALL_FUNCTION(GetWindowContentRegionWidth, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2 0 0); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints. // Unsupported arg type ImGuiSizeCallback custom_callback = NULL // Unsupported arg type void* custom_callback_data = NULL // IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin() IMGUI_FUNCTION(SetNextWindowContentSize) IM_VEC_2_ARG(size) CALL_FUNCTION_NO_RET(SetNextWindowContentSize, size) END_IMGUI_FUNC // IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin() IMGUI_FUNCTION(SetNextWindowFocus) CALL_FUNCTION_NO_RET(SetNextWindowFocus) END_IMGUI_FUNC // IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. IMGUI_FUNCTION(SetNextWindowBgAlpha) NUMBER_ARG(alpha) CALL_FUNCTION_NO_RET(SetNextWindowBgAlpha, alpha) END_IMGUI_FUNC // IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2 0 0 to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed(). // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus(). IMGUI_FUNCTION(SetWindowFocus) CALL_FUNCTION_NO_RET(SetWindowFocus) END_IMGUI_FUNC // IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows IMGUI_FUNCTION(SetWindowFontScale) NUMBER_ARG(scale) CALL_FUNCTION_NO_RET(SetWindowFontScale, scale) END_IMGUI_FUNC // IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus. IMGUI_FUNCTION(SetWindowFocus_1) LABEL_ARG(name) CALL_FUNCTION_NO_RET(SetWindowFocus, name) END_IMGUI_FUNC // IMGUI_API float GetScrollX(); // get scrolling amount [0..GetScrollMaxX()] IMGUI_FUNCTION(GetScrollX) CALL_FUNCTION(GetScrollX, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetScrollY(); // get scrolling amount [0..GetScrollMaxY()] IMGUI_FUNCTION(GetScrollY) CALL_FUNCTION(GetScrollY, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.X - WindowSize.X IMGUI_FUNCTION(GetScrollMaxX) CALL_FUNCTION(GetScrollMaxX, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y IMGUI_FUNCTION(GetScrollMaxY) CALL_FUNCTION(GetScrollMaxY, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()] IMGUI_FUNCTION(SetScrollX) NUMBER_ARG(scroll_x) CALL_FUNCTION_NO_RET(SetScrollX, scroll_x) END_IMGUI_FUNC // IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()] IMGUI_FUNCTION(SetScrollY) NUMBER_ARG(scroll_y) CALL_FUNCTION_NO_RET(SetScrollY, scroll_y) END_IMGUI_FUNC // IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. IMGUI_FUNCTION(SetScrollHere) OPTIONAL_NUMBER_ARG(center_y_ratio, 0.5f) CALL_FUNCTION_NO_RET(SetScrollHere, center_y_ratio) END_IMGUI_FUNC // IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. IMGUI_FUNCTION(SetScrollFromPosY) NUMBER_ARG(pos_y) OPTIONAL_NUMBER_ARG(center_y_ratio, 0.5f) CALL_FUNCTION_NO_RET(SetScrollFromPosY, pos_y, center_y_ratio) END_IMGUI_FUNC // IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font // Unsupported arg type ImFont* font // IMGUI_API void PopFont(); IMGUI_FUNCTION(PopFont) CALL_FUNCTION_NO_RET(PopFont) END_IMGUI_FUNC // IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col); IMGUI_FUNCTION(PushStyleColor) INT_ARG(idx) UINT_ARG(col) CALL_FUNCTION_NO_RET(PushStyleColor, idx, col) END_IMGUI_FUNC // IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col); IMGUI_FUNCTION(PushStyleColor_2) INT_ARG(idx) IM_VEC_4_ARG(col) CALL_FUNCTION_NO_RET(PushStyleColor, idx, col) END_IMGUI_FUNC // IMGUI_API void PopStyleColor(int count = 1); IMGUI_FUNCTION(PopStyleColor) OPTIONAL_INT_ARG(count, 1) CALL_FUNCTION_NO_RET(PopStyleColor, count) END_IMGUI_FUNC // IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); IMGUI_FUNCTION(PushStyleVar) INT_ARG(idx) NUMBER_ARG(val) CALL_FUNCTION_NO_RET(PushStyleVar, idx, val) ADD_END_STACK(3) END_IMGUI_FUNC // IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); IMGUI_FUNCTION(PushStyleVar_2) INT_ARG(idx) IM_VEC_2_ARG(val) CALL_FUNCTION_NO_RET(PushStyleVar, idx, val) ADD_END_STACK(3) END_IMGUI_FUNC // IMGUI_API void PopStyleVar(int count = 1); IMGUI_FUNCTION(PopStyleVar) OPTIONAL_INT_ARG(count, 1) CALL_FUNCTION_NO_RET(PopStyleVar, count) POP_END_STACK(3) END_IMGUI_FUNC // IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwhise use GetColorU32() to get style color with style alpha baked in. // Unsupported return type const // IMGUI_API ImFont* GetFont(); // get current font // Unsupported return type ImFont* // IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied IMGUI_FUNCTION(GetFontSize) CALL_FUNCTION(GetFontSize, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API IMGUI_FUNCTION(GetFontTexUvWhitePixel) CALL_FUNCTION(GetFontTexUvWhitePixel, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier IMGUI_FUNCTION(GetColorU32) INT_ARG(idx) OPTIONAL_NUMBER_ARG(alpha_mul, 1.0f) CALL_FUNCTION(GetColorU32, unsigned int, idx, alpha_mul) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied IMGUI_FUNCTION(GetColorU32_1) IM_VEC_4_ARG(col) CALL_FUNCTION(GetColorU32, unsigned int, col) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied IMGUI_FUNCTION(GetColorU32_1_1) UINT_ARG(col) CALL_FUNCTION(GetColorU32, unsigned int, col) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side) IMGUI_FUNCTION(PushItemWidth) NUMBER_ARG(item_width) CALL_FUNCTION_NO_RET(PushItemWidth, item_width) END_IMGUI_FUNC // IMGUI_API void PopItemWidth(); IMGUI_FUNCTION(PopItemWidth) CALL_FUNCTION_NO_RET(PopItemWidth) END_IMGUI_FUNC // IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position IMGUI_FUNCTION(CalcItemWidth) CALL_FUNCTION(CalcItemWidth, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space IMGUI_FUNCTION(PushTextWrapPos) OPTIONAL_NUMBER_ARG(wrap_pos_x, 0.0f) CALL_FUNCTION_NO_RET(PushTextWrapPos, wrap_pos_x) END_IMGUI_FUNC // IMGUI_API void PopTextWrapPos(); IMGUI_FUNCTION(PopTextWrapPos) CALL_FUNCTION_NO_RET(PopTextWrapPos) END_IMGUI_FUNC // IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets IMGUI_FUNCTION(PushAllowKeyboardFocus) BOOL_ARG(allow_keyboard_focus) CALL_FUNCTION_NO_RET(PushAllowKeyboardFocus, allow_keyboard_focus) END_IMGUI_FUNC // IMGUI_API void PopAllowKeyboardFocus(); IMGUI_FUNCTION(PopAllowKeyboardFocus) CALL_FUNCTION_NO_RET(PopAllowKeyboardFocus) END_IMGUI_FUNC // IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. IMGUI_FUNCTION(PushButtonRepeat) BOOL_ARG(repeat) CALL_FUNCTION_NO_RET(PushButtonRepeat, repeat) END_IMGUI_FUNC // IMGUI_API void PopButtonRepeat(); IMGUI_FUNCTION(PopButtonRepeat) CALL_FUNCTION_NO_RET(PopButtonRepeat) END_IMGUI_FUNC // IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. IMGUI_FUNCTION(Separator) CALL_FUNCTION_NO_RET(Separator) END_IMGUI_FUNC // IMGUI_API void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f); // call between widgets or groups to layout them horizontally IMGUI_FUNCTION(SameLine) OPTIONAL_NUMBER_ARG(pos_x, 0.0f) OPTIONAL_NUMBER_ARG(spacing_w, -1.0f) CALL_FUNCTION_NO_RET(SameLine, pos_x, spacing_w) END_IMGUI_FUNC // IMGUI_API void NewLine(); // undo a SameLine() IMGUI_FUNCTION(NewLine) CALL_FUNCTION_NO_RET(NewLine) END_IMGUI_FUNC // IMGUI_API void Spacing(); // add vertical spacing IMGUI_FUNCTION(Spacing) CALL_FUNCTION_NO_RET(Spacing) END_IMGUI_FUNC // IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size IMGUI_FUNCTION(Dummy) IM_VEC_2_ARG(size) CALL_FUNCTION_NO_RET(Dummy, size) END_IMGUI_FUNC // IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by style.IndentSpacing or indent_w if != 0 IMGUI_FUNCTION(Indent) OPTIONAL_NUMBER_ARG(indent_w, 0.0f) CALL_FUNCTION_NO_RET(Indent, indent_w) END_IMGUI_FUNC // IMGUI_API void Unindent(float indent_w = 0.0f); // move content position back to the left, by style.IndentSpacing or indent_w if != 0 IMGUI_FUNCTION(Unindent) OPTIONAL_NUMBER_ARG(indent_w, 0.0f) CALL_FUNCTION_NO_RET(Unindent, indent_w) END_IMGUI_FUNC // IMGUI_API void BeginGroup(); // lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) IMGUI_FUNCTION(BeginGroup) CALL_FUNCTION_NO_RET(BeginGroup) ADD_END_STACK(4) END_IMGUI_FUNC // IMGUI_API void EndGroup(); IMGUI_FUNCTION(EndGroup) CALL_FUNCTION_NO_RET(EndGroup) POP_END_STACK(4) END_IMGUI_FUNC // IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position IMGUI_FUNCTION(GetCursorPos) CALL_FUNCTION(GetCursorPos, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API float GetCursorPosX(); // " IMGUI_FUNCTION(GetCursorPosX) CALL_FUNCTION(GetCursorPosX, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetCursorPosY(); // " IMGUI_FUNCTION(GetCursorPosY) CALL_FUNCTION(GetCursorPosY, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetCursorPos(const ImVec2& local_pos); // " IMGUI_FUNCTION(SetCursorPos) IM_VEC_2_ARG(local_pos) CALL_FUNCTION_NO_RET(SetCursorPos, local_pos) END_IMGUI_FUNC // IMGUI_API void SetCursorPosX(float x); // " IMGUI_FUNCTION(SetCursorPosX) NUMBER_ARG(x) CALL_FUNCTION_NO_RET(SetCursorPosX, x) END_IMGUI_FUNC // IMGUI_API void SetCursorPosY(float y); // " IMGUI_FUNCTION(SetCursorPosY) NUMBER_ARG(y) CALL_FUNCTION_NO_RET(SetCursorPosY, y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetCursorStartPos(); // initial cursor position IMGUI_FUNCTION(GetCursorStartPos) CALL_FUNCTION(GetCursorStartPos, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API) IMGUI_FUNCTION(GetCursorScreenPos) CALL_FUNCTION(GetCursorScreenPos, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API void SetCursorScreenPos(const ImVec2& screen_pos); // cursor position in absolute screen coordinates [0..io.DisplaySize] IMGUI_FUNCTION(SetCursorScreenPos) IM_VEC_2_ARG(screen_pos) CALL_FUNCTION_NO_RET(SetCursorScreenPos, screen_pos) END_IMGUI_FUNC // IMGUI_API void AlignTextToFramePadding(); // vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item) IMGUI_FUNCTION(AlignTextToFramePadding) CALL_FUNCTION_NO_RET(AlignTextToFramePadding) END_IMGUI_FUNC // IMGUI_API float GetTextLineHeight(); // ~ FontSize IMGUI_FUNCTION(GetTextLineHeight) CALL_FUNCTION(GetTextLineHeight, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetTextLineHeightWithSpacing(); // ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text) IMGUI_FUNCTION(GetTextLineHeightWithSpacing) CALL_FUNCTION(GetTextLineHeightWithSpacing, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetFrameHeight(); // ~ FontSize + style.FramePadding.y * 2 IMGUI_FUNCTION(GetFrameHeight) CALL_FUNCTION(GetFrameHeight, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) IMGUI_FUNCTION(GetFrameHeightWithSpacing) CALL_FUNCTION(GetFrameHeightWithSpacing, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the entire stack! IMGUI_FUNCTION(PushID) LABEL_ARG(str_id) CALL_FUNCTION_NO_RET(PushID, str_id) END_IMGUI_FUNC // IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); IMGUI_FUNCTION(PushID_2) LABEL_ARG(str_id_begin) LABEL_ARG(str_id_end) CALL_FUNCTION_NO_RET(PushID, str_id_begin, str_id_end) END_IMGUI_FUNC // IMGUI_API void PushID(const void* ptr_id); // Unsupported arg type const void* ptr_id // IMGUI_API void PushID(int int_id); IMGUI_FUNCTION(PushID_1) INT_ARG(int_id) CALL_FUNCTION_NO_RET(PushID, int_id) END_IMGUI_FUNC // IMGUI_API void PopID(); IMGUI_FUNCTION(PopID) CALL_FUNCTION_NO_RET(PopID) END_IMGUI_FUNC // IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself IMGUI_FUNCTION(GetID) LABEL_ARG(str_id) CALL_FUNCTION(GetID, unsigned int, str_id) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end); IMGUI_FUNCTION(GetID_2) LABEL_ARG(str_id_begin) LABEL_ARG(str_id_end) CALL_FUNCTION(GetID, unsigned int, str_id_begin, str_id_end) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API ImGuiID GetID(const void* ptr_id); // Unsupported arg type const void* ptr_id // IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. IMGUI_FUNCTION(TextUnformatted) LABEL_ARG(text) OPTIONAL_LABEL_ARG(text_end) CALL_FUNCTION_NO_RET(TextUnformatted, text, text_end) END_IMGUI_FUNC // IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // simple formatted text // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1); // Unsupported arg type va_list args) IM_FMTLIST(1 // IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor(); // Unsupported arg type ...) IM_FMTARGS(2 // IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(2); // Unsupported arg type va_list args) IM_FMTLIST(2 // IMGUI_API void TextDisabled(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API void TextDisabledV(const char* fmt, va_list args) IM_FMTLIST(1); // Unsupported arg type va_list args) IM_FMTLIST(1 // IMGUI_API void TextWrapped(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize(). // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API void TextWrappedV(const char* fmt, va_list args) IM_FMTLIST(1); // Unsupported arg type va_list args) IM_FMTLIST(1 // IMGUI_API void LabelText(const char* label, const char* fmt, ...) IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets // Unsupported arg type ...) IM_FMTARGS(2 // IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); // Unsupported arg type va_list args) IM_FMTLIST(2 // IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); // Unsupported arg type va_list args) IM_FMTLIST(1 // IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2 0 0); // button IMGUI_FUNCTION(Button) LABEL_ARG(label) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) CALL_FUNCTION(Button, bool, label, size) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text IMGUI_FUNCTION(SmallButton) LABEL_ARG(label) CALL_FUNCTION(SmallButton, bool, label) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // Unsupported arg type ImGuiDir dir // IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) IMGUI_FUNCTION(InvisibleButton) LABEL_ARG(str_id) IM_VEC_2_ARG(size) CALL_FUNCTION(InvisibleButton, bool, str_id, size) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2 0 0, const ImVec2& uv1 = ImVec2 1 1, const ImVec4& tint_col = ImVec4 1 1 1 1, const ImVec4& border_col = ImVec4 0 0 0 0); IMGUI_FUNCTION(Image) IM_TEXTURE_ID_ARG(user_texture_id) IM_VEC_2_ARG(size) OPTIONAL_IM_VEC_2_ARG(uv0, 0, 0) OPTIONAL_IM_VEC_2_ARG(uv1, 1, 1) OPTIONAL_IM_VEC_4_ARG(tint_col, 1, 1, 1, 1) OPTIONAL_IM_VEC_4_ARG(border_col, 0, 0, 0, 0) CALL_FUNCTION_NO_RET(Image, user_texture_id, size, uv0, uv1, tint_col, border_col) END_IMGUI_FUNC // IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2 0 0, const ImVec2& uv1 = ImVec2 1 1, int frame_padding = -1, const ImVec4& bg_col = ImVec4 0 0 0 0, const ImVec4& tint_col = ImVec4 1 1 1 1); // <0 frame_padding uses default frame padding settings. 0 for no padding IMGUI_FUNCTION(ImageButton) IM_TEXTURE_ID_ARG(user_texture_id) IM_VEC_2_ARG(size) OPTIONAL_IM_VEC_2_ARG(uv0, 0, 0) OPTIONAL_IM_VEC_2_ARG(uv1, 1, 1) OPTIONAL_INT_ARG(frame_padding, -1) OPTIONAL_IM_VEC_4_ARG(bg_col, 0, 0, 0, 0) OPTIONAL_IM_VEC_4_ARG(tint_col, 1, 1, 1, 1) CALL_FUNCTION(ImageButton, bool, user_texture_id, size, uv0, uv1, frame_padding, bg_col, tint_col) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool Checkbox(const char* label, bool* v); IMGUI_FUNCTION(Checkbox) LABEL_ARG(label) BOOL_POINTER_ARG(v) CALL_FUNCTION(Checkbox, bool, label, v) PUSH_BOOL(ret) END_BOOL_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value); IMGUI_FUNCTION(CheckboxFlags) LABEL_ARG(label) UINT_POINTER_ARG(flags) UINT_ARG(flags_value) CALL_FUNCTION(CheckboxFlags, bool, label, flags, flags_value) PUSH_BOOL(ret) END_UINT_POINTER(flags) END_IMGUI_FUNC // IMGUI_API bool RadioButton(const char* label, bool active); IMGUI_FUNCTION(RadioButton) LABEL_ARG(label) BOOL_ARG(active) CALL_FUNCTION(RadioButton, bool, label, active) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool RadioButton(const char* label, int* v, int v_button); IMGUI_FUNCTION(RadioButton_3) LABEL_ARG(label) INT_POINTER_ARG(v) INT_ARG(v_button) CALL_FUNCTION(RadioButton, bool, label, v, v_button) PUSH_BOOL(ret) END_INT_POINTER(v) END_IMGUI_FUNC // IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2 0 0, int stride = sizeof(float)); // Unsupported arg type const float* values // Unsupported arg type ImVec2 graph_size = ImVec2 0 0 // IMGUI_API void PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2 0 0); // Unsupported arg type float (*values_getter)(void* data // Unsupported arg type void* data // Unsupported arg type ImVec2 graph_size = ImVec2 0 0 // IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2 0 0, int stride = sizeof(float)); // Unsupported arg type const float* values // Unsupported arg type ImVec2 graph_size = ImVec2 0 0 // IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2 0 0); // Unsupported arg type float (*values_getter)(void* data // Unsupported arg type void* data // Unsupported arg type ImVec2 graph_size = ImVec2 0 0 // IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2 -1 0, const char* overlay = NULL); IMGUI_FUNCTION(ProgressBar) NUMBER_ARG(fraction) OPTIONAL_IM_VEC_2_ARG(size_arg, -1, 0) OPTIONAL_LABEL_ARG(overlay) CALL_FUNCTION_NO_RET(ProgressBar, fraction, size_arg, overlay) END_IMGUI_FUNC // IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses IMGUI_FUNCTION(Bullet) CALL_FUNCTION_NO_RET(Bullet) END_IMGUI_FUNC // IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); // Unsupported arg type ImGuiComboFlags flags = 0 // IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! IMGUI_FUNCTION(EndCombo) CALL_FUNCTION_NO_RET(EndCombo) POP_END_STACK(5) END_IMGUI_FUNC // IMGUI_API bool Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1); // Unsupported arg type const char* const items[] // IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" IMGUI_FUNCTION(Combo) LABEL_ARG(label) INT_POINTER_ARG(current_item) LABEL_ARG(items_separated_by_zeros) OPTIONAL_INT_ARG(popup_max_height_in_items, -1) CALL_FUNCTION(Combo, bool, label, current_item, items_separated_by_zeros, popup_max_height_in_items) PUSH_BOOL(ret) END_INT_POINTER(current_item) END_IMGUI_FUNC // IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1); // Unsupported arg type bool(*items_getter)(void* data // Unsupported arg type const char** out_text) // Unsupported arg type void* data // IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound IMGUI_FUNCTION(DragFloat) LABEL_ARG(label) FLOAT_POINTER_ARG(v) OPTIONAL_NUMBER_ARG(v_speed, 1.0f) OPTIONAL_NUMBER_ARG(v_min, 0.0f) OPTIONAL_NUMBER_ARG(v_max, 0.0f) LABEL_ARG(display_format) OPTIONAL_NUMBER_ARG(power, 1.0f) CALL_FUNCTION(DragFloat, bool, label, v, v_speed, v_min, v_max, display_format, power) PUSH_BOOL(ret) END_FLOAT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[2] // IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[3] // IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[4] // IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", const char* display_format_max = NULL, float power = 1.0f); IMGUI_FUNCTION(DragFloatRange2) LABEL_ARG(label) FLOAT_POINTER_ARG(v_current_min) FLOAT_POINTER_ARG(v_current_max) OPTIONAL_NUMBER_ARG(v_speed, 1.0f) OPTIONAL_NUMBER_ARG(v_min, 0.0f) OPTIONAL_NUMBER_ARG(v_max, 0.0f) LABEL_ARG(display_format) OPTIONAL_LABEL_ARG(display_format_max) OPTIONAL_NUMBER_ARG(power, 1.0f) CALL_FUNCTION(DragFloatRange2, bool, label, v_current_min, v_current_max, v_speed, v_min, v_max, display_format, display_format_max, power) PUSH_BOOL(ret) END_FLOAT_POINTER(v_current_min) END_FLOAT_POINTER(v_current_max) END_IMGUI_FUNC // IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_min >= v_max we have no bound IMGUI_FUNCTION(DragInt) LABEL_ARG(label) INT_POINTER_ARG(v) OPTIONAL_NUMBER_ARG(v_speed, 1.0f) OPTIONAL_INT_ARG(v_min, 0) OPTIONAL_INT_ARG(v_max, 0) LABEL_ARG(display_format) CALL_FUNCTION(DragInt, bool, label, v, v_speed, v_min, v_max, display_format) PUSH_BOOL(ret) END_INT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // Unsupported arg type int v[2] // IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // Unsupported arg type int v[3] // IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // Unsupported arg type int v[4] // IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f", const char* display_format_max = NULL); IMGUI_FUNCTION(DragIntRange2) LABEL_ARG(label) INT_POINTER_ARG(v_current_min) INT_POINTER_ARG(v_current_max) OPTIONAL_NUMBER_ARG(v_speed, 1.0f) OPTIONAL_INT_ARG(v_min, 0) OPTIONAL_INT_ARG(v_max, 0) LABEL_ARG(display_format) OPTIONAL_LABEL_ARG(display_format_max) CALL_FUNCTION(DragIntRange2, bool, label, v_current_min, v_current_max, v_speed, v_min, v_max, display_format, display_format_max) PUSH_BOOL(ret) END_INT_POINTER(v_current_min) END_INT_POINTER(v_current_max) END_IMGUI_FUNC // IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); // Unsupported arg type char* buf // Unsupported arg type size_t buf_size // Unsupported arg type ImGuiTextEditCallback callback = NULL // Unsupported arg type void* user_data = NULL // IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2 0 0, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); // Unsupported arg type char* buf // Unsupported arg type size_t buf_size // Unsupported arg type ImGuiTextEditCallback callback = NULL // Unsupported arg type void* user_data = NULL // IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); IMGUI_FUNCTION(InputFloat) LABEL_ARG(label) FLOAT_POINTER_ARG(v) OPTIONAL_NUMBER_ARG(step, 0.0f) OPTIONAL_NUMBER_ARG(step_fast, 0.0f) OPTIONAL_INT_ARG(decimal_precision, -1) OPTIONAL_INT_ARG(extra_flags, 0) CALL_FUNCTION(InputFloat, bool, label, v, step, step_fast, decimal_precision, extra_flags) PUSH_BOOL(ret) END_FLOAT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type float v[2] // IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type float v[3] // IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type float v[4] // IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0); IMGUI_FUNCTION(InputInt) LABEL_ARG(label) INT_POINTER_ARG(v) OPTIONAL_INT_ARG(step, 1) OPTIONAL_INT_ARG(step_fast, 100) OPTIONAL_INT_ARG(extra_flags, 0) CALL_FUNCTION(InputInt, bool, label, v, step, step_fast, extra_flags) PUSH_BOOL(ret) END_INT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type int v[2] // IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type int v[3] // IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type int v[4] // IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* display_format = "%.6f", ImGuiInputTextFlags extra_flags = 0); // Unsupported arg type double* v // Unsupported arg type double step = 0.0f // Unsupported arg type double step_fast = 0.0f // IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders IMGUI_FUNCTION(SliderFloat) LABEL_ARG(label) FLOAT_POINTER_ARG(v) NUMBER_ARG(v_min) NUMBER_ARG(v_max) LABEL_ARG(display_format) OPTIONAL_NUMBER_ARG(power, 1.0f) CALL_FUNCTION(SliderFloat, bool, label, v, v_min, v_max, display_format, power) PUSH_BOOL(ret) END_FLOAT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[2] // IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[3] // IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // Unsupported arg type float v[4] // IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); IMGUI_FUNCTION(SliderAngle) LABEL_ARG(label) FLOAT_POINTER_ARG(v_rad) OPTIONAL_NUMBER_ARG(v_degrees_min, -360.0f) OPTIONAL_NUMBER_ARG(v_degrees_max, +360.0f) CALL_FUNCTION(SliderAngle, bool, label, v_rad, v_degrees_min, v_degrees_max) PUSH_BOOL(ret) END_FLOAT_POINTER(v_rad) END_IMGUI_FUNC // IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f"); IMGUI_FUNCTION(SliderInt) LABEL_ARG(label) INT_POINTER_ARG(v) INT_ARG(v_min) INT_ARG(v_max) LABEL_ARG(display_format) CALL_FUNCTION(SliderInt, bool, label, v, v_min, v_max, display_format) PUSH_BOOL(ret) END_INT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f"); // Unsupported arg type int v[2] // IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f"); // Unsupported arg type int v[3] // IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f"); // Unsupported arg type int v[4] // IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); IMGUI_FUNCTION(VSliderFloat) LABEL_ARG(label) IM_VEC_2_ARG(size) FLOAT_POINTER_ARG(v) NUMBER_ARG(v_min) NUMBER_ARG(v_max) LABEL_ARG(display_format) OPTIONAL_NUMBER_ARG(power, 1.0f) CALL_FUNCTION(VSliderFloat, bool, label, size, v, v_min, v_max, display_format, power) PUSH_BOOL(ret) END_FLOAT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f"); IMGUI_FUNCTION(VSliderInt) LABEL_ARG(label) IM_VEC_2_ARG(size) INT_POINTER_ARG(v) INT_ARG(v_min) INT_ARG(v_max) LABEL_ARG(display_format) CALL_FUNCTION(VSliderInt, bool, label, size, v, v_min, v_max, display_format) PUSH_BOOL(ret) END_INT_POINTER(v) END_IMGUI_FUNC // IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); // Unsupported arg type float col[3] // Unsupported arg type ImGuiColorEditFlags flags = 0 // IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); // Unsupported arg type float col[4] // Unsupported arg type ImGuiColorEditFlags flags = 0 // IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); // Unsupported arg type float col[3] // Unsupported arg type ImGuiColorEditFlags flags = 0 // IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); // Unsupported arg type float col[4] // Unsupported arg type ImGuiColorEditFlags flags = 0 // Unsupported arg type const float* ref_col = NULL // IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2 0 0); // display a colored square/button, hover for details, return true when pressed. // Unsupported arg type ImGuiColorEditFlags flags = 0 // Unsupported arg type ImVec2 size = ImVec2 0 0 // IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. // Unsupported arg type ImGuiColorEditFlags flags // IMGUI_API bool TreeNode(const char* label); // if returning 'true' the node is open and the tree id is pushed into the id stack. user is responsible for calling TreePop(). IMGUI_FUNCTION(TreeNode) LABEL_ARG(label) CALL_FUNCTION(TreeNode, bool, label) IF_RET_ADD_END_STACK(6) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet(). // Unsupported arg type ...) IM_FMTARGS(2 // IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // " // Unsupported arg type const void* ptr_id // Unsupported arg type ...) IM_FMTARGS(2 // IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2); // Unsupported arg type va_list args) IM_FMTLIST(2 // IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2); // Unsupported arg type const void* ptr_id // Unsupported arg type va_list args) IM_FMTLIST(2 // IMGUI_API bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0); // Unsupported arg type ImGuiTreeNodeFlags flags = 0 // IMGUI_API bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); // Unsupported arg type ImGuiTreeNodeFlags flags // Unsupported arg type ...) IM_FMTARGS(3 // IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); // Unsupported arg type const void* ptr_id // Unsupported arg type ImGuiTreeNodeFlags flags // Unsupported arg type ...) IM_FMTARGS(3 // IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); // Unsupported arg type ImGuiTreeNodeFlags flags // Unsupported arg type va_list args) IM_FMTLIST(3 // IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); // Unsupported arg type const void* ptr_id // Unsupported arg type ImGuiTreeNodeFlags flags // Unsupported arg type va_list args) IM_FMTLIST(3 // IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call Push/Pop yourself for layout purpose IMGUI_FUNCTION(TreePush) LABEL_ARG(str_id) CALL_FUNCTION_NO_RET(TreePush, str_id) ADD_END_STACK(6) END_IMGUI_FUNC // IMGUI_API void TreePush(const void* ptr_id = NULL); // " // Unsupported arg type const void* ptr_id = NULL // IMGUI_API void TreePop(); // ~ Unindent()+PopId() IMGUI_FUNCTION(TreePop) CALL_FUNCTION_NO_RET(TreePop) POP_END_STACK(6) END_IMGUI_FUNC // IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing() IMGUI_FUNCTION(TreeAdvanceToLabelPos) CALL_FUNCTION_NO_RET(TreeAdvanceToLabelPos) END_IMGUI_FUNC // IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode IMGUI_FUNCTION(GetTreeNodeToLabelSpacing) CALL_FUNCTION(GetTreeNodeToLabelSpacing, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state. // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API bool CollapsingHeader(const char* 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(). // Unsupported arg type ImGuiTreeNodeFlags flags = 0 // IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header // Unsupported arg type ImGuiTreeNodeFlags flags = 0 // IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2 0 0); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height IMGUI_FUNCTION(Selectable) LABEL_ARG(label) OPTIONAL_BOOL_ARG(selected, false) OPTIONAL_INT_ARG(flags, 0) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) CALL_FUNCTION(Selectable, bool, label, selected, flags, size) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2 0 0); // "bool* p_selected" point to the selection state (read-write), as a convenient helper. IMGUI_FUNCTION(Selectable_4) LABEL_ARG(label) BOOL_POINTER_ARG(p_selected) OPTIONAL_INT_ARG(flags, 0) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) CALL_FUNCTION(Selectable, bool, label, p_selected, flags, size) PUSH_BOOL(ret) END_BOOL_POINTER(p_selected) END_IMGUI_FUNC // IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1); // Unsupported arg type const char* const items[] // IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1); // Unsupported arg type bool (*items_getter)(void* data // Unsupported arg type const char** out_text) // Unsupported arg type void* data // IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2 0 0); // use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards. IMGUI_FUNCTION(ListBoxHeader) LABEL_ARG(label) OPTIONAL_IM_VEC_2_ARG(size, 0, 0) CALL_FUNCTION(ListBoxHeader, bool, label, size) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // " IMGUI_FUNCTION(ListBoxHeader_3) LABEL_ARG(label) INT_ARG(items_count) OPTIONAL_INT_ARG(height_in_items, -1) CALL_FUNCTION(ListBoxHeader, bool, label, items_count, height_in_items) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void ListBoxFooter(); // terminate the scrolling region IMGUI_FUNCTION(ListBoxFooter) CALL_FUNCTION_NO_RET(ListBoxFooter) END_IMGUI_FUNC // IMGUI_API void Value(const char* prefix, bool b); IMGUI_FUNCTION(Value) LABEL_ARG(prefix) BOOL_ARG(b) CALL_FUNCTION_NO_RET(Value, prefix, b) END_IMGUI_FUNC // IMGUI_API void Value(const char* prefix, int v); IMGUI_FUNCTION(Value_2) LABEL_ARG(prefix) INT_ARG(v) CALL_FUNCTION_NO_RET(Value, prefix, v) END_IMGUI_FUNC // IMGUI_API void Value(const char* prefix, unsigned int v); IMGUI_FUNCTION(Value_2_2) LABEL_ARG(prefix) UINT_ARG(v) CALL_FUNCTION_NO_RET(Value, prefix, v) END_IMGUI_FUNC // IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL); IMGUI_FUNCTION(Value_3) LABEL_ARG(prefix) NUMBER_ARG(v) OPTIONAL_LABEL_ARG(float_format) CALL_FUNCTION_NO_RET(Value, prefix, v, float_format) END_IMGUI_FUNC // IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set text tooltip under mouse-cursor, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip(). // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); // Unsupported arg type va_list args) IM_FMTLIST(1 // IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of contents). IMGUI_FUNCTION(BeginTooltip) CALL_FUNCTION_NO_RET(BeginTooltip) ADD_END_STACK(7) END_IMGUI_FUNC // IMGUI_API void EndTooltip(); IMGUI_FUNCTION(EndTooltip) CALL_FUNCTION_NO_RET(EndTooltip) POP_END_STACK(7) END_IMGUI_FUNC // IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. IMGUI_FUNCTION(BeginMainMenuBar) CALL_FUNCTION(BeginMainMenuBar, bool) IF_RET_ADD_END_STACK(8) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void EndMainMenuBar(); // only call EndMainMenuBar() if BeginMainMenuBar() returns true! IMGUI_FUNCTION(EndMainMenuBar) CALL_FUNCTION_NO_RET(EndMainMenuBar) POP_END_STACK(8) END_IMGUI_FUNC // IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). IMGUI_FUNCTION(BeginMenuBar) CALL_FUNCTION(BeginMenuBar, bool) IF_RET_ADD_END_STACK(9) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void EndMenuBar(); // only call EndMenuBar() if BeginMenuBar() returns true! IMGUI_FUNCTION(EndMenuBar) CALL_FUNCTION_NO_RET(EndMenuBar) POP_END_STACK(9) END_IMGUI_FUNC // IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true! IMGUI_FUNCTION(BeginMenu) LABEL_ARG(label) OPTIONAL_BOOL_ARG(enabled, true) CALL_FUNCTION(BeginMenu, bool, label, enabled) IF_RET_ADD_END_STACK(10) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void EndMenu(); // only call EndMenu() if BeginMenu() returns true! IMGUI_FUNCTION(EndMenu) CALL_FUNCTION_NO_RET(EndMenu) POP_END_STACK(10) END_IMGUI_FUNC // IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment IMGUI_FUNCTION(MenuItem) LABEL_ARG(label) OPTIONAL_LABEL_ARG(shortcut) OPTIONAL_BOOL_ARG(selected, false) OPTIONAL_BOOL_ARG(enabled, true) CALL_FUNCTION(MenuItem, bool, label, shortcut, selected, enabled) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL IMGUI_FUNCTION(MenuItem_4) LABEL_ARG(label) LABEL_ARG(shortcut) BOOL_POINTER_ARG(p_selected) OPTIONAL_BOOL_ARG(enabled, true) CALL_FUNCTION(MenuItem, bool, label, shortcut, p_selected, enabled) PUSH_BOOL(ret) END_BOOL_POINTER(p_selected) END_IMGUI_FUNC // IMGUI_API void OpenPopup(const char* 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. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). IMGUI_FUNCTION(OpenPopup) LABEL_ARG(str_id) CALL_FUNCTION_NO_RET(OpenPopup, str_id) END_IMGUI_FUNC // IMGUI_API bool BeginPopup(const char* 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! IMGUI_FUNCTION(BeginPopup) LABEL_ARG(str_id) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(BeginPopup, bool, str_id, flags) IF_RET_ADD_END_STACK(11) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! IMGUI_FUNCTION(BeginPopupContextItem) OPTIONAL_LABEL_ARG(str_id) OPTIONAL_INT_ARG(mouse_button, 1) CALL_FUNCTION(BeginPopupContextItem, bool, str_id, mouse_button) IF_RET_ADD_END_STACK(11) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, int mouse_button = 1, bool also_over_items = true); // helper to open and begin popup when clicked on current window. IMGUI_FUNCTION(BeginPopupContextWindow) OPTIONAL_LABEL_ARG(str_id) OPTIONAL_INT_ARG(mouse_button, 1) OPTIONAL_BOOL_ARG(also_over_items, true) CALL_FUNCTION(BeginPopupContextWindow, bool, str_id, mouse_button, also_over_items) IF_RET_ADD_END_STACK(11) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (where there are no imgui windows). IMGUI_FUNCTION(BeginPopupContextVoid) OPTIONAL_LABEL_ARG(str_id) OPTIONAL_INT_ARG(mouse_button, 1) CALL_FUNCTION(BeginPopupContextVoid, bool, str_id, mouse_button) IF_RET_ADD_END_STACK(11) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) IMGUI_FUNCTION(BeginPopupModal) LABEL_ARG(name) OPTIONAL_BOOL_POINTER_ARG(p_open) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(BeginPopupModal, bool, name, p_open, flags) IF_RET_ADD_END_STACK(11) PUSH_BOOL(ret) END_BOOL_POINTER(p_open) END_IMGUI_FUNC // IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true! IMGUI_FUNCTION(EndPopup) CALL_FUNCTION_NO_RET(EndPopup) POP_END_STACK(11) END_IMGUI_FUNC // IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1); // helper to open popup when clicked on last item. return true when just opened. IMGUI_FUNCTION(OpenPopupOnItemClick) OPTIONAL_LABEL_ARG(str_id) OPTIONAL_INT_ARG(mouse_button, 1) CALL_FUNCTION(OpenPopupOnItemClick, bool, str_id, mouse_button) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsPopupOpen(const char* str_id); // return true if the popup is open IMGUI_FUNCTION(IsPopupOpen) LABEL_ARG(str_id) CALL_FUNCTION(IsPopupOpen, bool, str_id) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. IMGUI_FUNCTION(CloseCurrentPopup) CALL_FUNCTION_NO_RET(CloseCurrentPopup) END_IMGUI_FUNC // IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true); IMGUI_FUNCTION(Columns) OPTIONAL_INT_ARG(count, 1) OPTIONAL_LABEL_ARG(id) OPTIONAL_BOOL_ARG(border, true) CALL_FUNCTION_NO_RET(Columns, count, id, border) END_IMGUI_FUNC // IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished IMGUI_FUNCTION(NextColumn) CALL_FUNCTION_NO_RET(NextColumn) END_IMGUI_FUNC // IMGUI_API int GetColumnIndex(); // get current column index // Unsupported return type int // IMGUI_API float GetColumnWidth(int column_index = -1); // get column width (in pixels). pass -1 to use current column IMGUI_FUNCTION(GetColumnWidth) OPTIONAL_INT_ARG(column_index, -1) CALL_FUNCTION(GetColumnWidth, float, column_index) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetColumnWidth(int column_index, float width); // set column width (in pixels). pass -1 to use current column IMGUI_FUNCTION(SetColumnWidth) INT_ARG(column_index) NUMBER_ARG(width) CALL_FUNCTION_NO_RET(SetColumnWidth, column_index, width) END_IMGUI_FUNC // IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f IMGUI_FUNCTION(GetColumnOffset) OPTIONAL_INT_ARG(column_index, -1) CALL_FUNCTION(GetColumnOffset, float, column_index) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column IMGUI_FUNCTION(SetColumnOffset) INT_ARG(column_index) NUMBER_ARG(offset_x) CALL_FUNCTION_NO_RET(SetColumnOffset, column_index, offset_x) END_IMGUI_FUNC // IMGUI_API int GetColumnsCount(); // Unsupported return type int // IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty IMGUI_FUNCTION(LogToTTY) OPTIONAL_INT_ARG(max_depth, -1) CALL_FUNCTION_NO_RET(LogToTTY, max_depth) END_IMGUI_FUNC // IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file IMGUI_FUNCTION(LogToFile) OPTIONAL_INT_ARG(max_depth, -1) OPTIONAL_LABEL_ARG(filename) CALL_FUNCTION_NO_RET(LogToFile, max_depth, filename) END_IMGUI_FUNC // IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard IMGUI_FUNCTION(LogToClipboard) OPTIONAL_INT_ARG(max_depth, -1) CALL_FUNCTION_NO_RET(LogToClipboard, max_depth) END_IMGUI_FUNC // IMGUI_API void LogFinish(); // stop logging (close file, etc.) IMGUI_FUNCTION(LogFinish) CALL_FUNCTION_NO_RET(LogFinish) END_IMGUI_FUNC // IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard IMGUI_FUNCTION(LogButtons) CALL_FUNCTION_NO_RET(LogButtons) END_IMGUI_FUNC // IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) // Unsupported arg type ...) IM_FMTARGS(1 // IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource() // Unsupported arg type ImGuiDragDropFlags flags = 0 // IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. // Unsupported arg type const void* data // Unsupported arg type size_t size // Unsupported arg type ImGuiCond cond = 0 // IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true! IMGUI_FUNCTION(EndDragDropSource) CALL_FUNCTION_NO_RET(EndDragDropSource) POP_END_STACK(12) END_IMGUI_FUNC // IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() IMGUI_FUNCTION(BeginDragDropTarget) CALL_FUNCTION(BeginDragDropTarget, bool) IF_RET_ADD_END_STACK(13) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. // Unsupported return type const // Unsupported arg type ImGuiDragDropFlags flags = 0 // IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true! IMGUI_FUNCTION(EndDragDropTarget) CALL_FUNCTION_NO_RET(EndDragDropTarget) POP_END_STACK(13) END_IMGUI_FUNC // IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect); IMGUI_FUNCTION(PushClipRect) IM_VEC_2_ARG(clip_rect_min) IM_VEC_2_ARG(clip_rect_max) BOOL_ARG(intersect_with_current_clip_rect) CALL_FUNCTION_NO_RET(PushClipRect, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) END_IMGUI_FUNC // IMGUI_API void PopClipRect(); IMGUI_FUNCTION(PopClipRect) CALL_FUNCTION_NO_RET(PopClipRect) END_IMGUI_FUNC // IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item". IMGUI_FUNCTION(SetItemDefaultFocus) CALL_FUNCTION_NO_RET(SetItemDefaultFocus) END_IMGUI_FUNC // IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. IMGUI_FUNCTION(SetKeyboardFocusHere) OPTIONAL_INT_ARG(offset, 0) CALL_FUNCTION_NO_RET(SetKeyboardFocusHere, offset) END_IMGUI_FUNC // IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options. // Unsupported arg type ImGuiHoveredFlags flags = 0 // IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) IMGUI_FUNCTION(IsItemActive) CALL_FUNCTION(IsItemActive, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation? IMGUI_FUNCTION(IsItemFocused) CALL_FUNCTION(IsItemFocused, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) IMGUI_FUNCTION(IsItemClicked) OPTIONAL_INT_ARG(mouse_button, 0) CALL_FUNCTION(IsItemClicked, bool, mouse_button) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.) IMGUI_FUNCTION(IsItemVisible) CALL_FUNCTION(IsItemVisible, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsAnyItemHovered(); IMGUI_FUNCTION(IsAnyItemHovered) CALL_FUNCTION(IsAnyItemHovered, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsAnyItemActive(); IMGUI_FUNCTION(IsAnyItemActive) CALL_FUNCTION(IsAnyItemActive, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsAnyItemFocused(); IMGUI_FUNCTION(IsAnyItemFocused) CALL_FUNCTION(IsAnyItemFocused, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API ImVec2 GetItemRectMin(); // get bounding rectangle of last item, in screen space IMGUI_FUNCTION(GetItemRectMin) CALL_FUNCTION(GetItemRectMin, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetItemRectMax(); // " IMGUI_FUNCTION(GetItemRectMax) CALL_FUNCTION(GetItemRectMax, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space IMGUI_FUNCTION(GetItemRectSize) CALL_FUNCTION(GetItemRectSize, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. IMGUI_FUNCTION(SetItemAllowOverlap) CALL_FUNCTION_NO_RET(SetItemAllowOverlap) END_IMGUI_FUNC // IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped. IMGUI_FUNCTION(IsRectVisible) IM_VEC_2_ARG(size) CALL_FUNCTION(IsRectVisible, bool, size) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. IMGUI_FUNCTION(IsRectVisible_2) IM_VEC_2_ARG(rect_min) IM_VEC_2_ARG(rect_max) CALL_FUNCTION(IsRectVisible, bool, rect_min, rect_max) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API float GetTime(); IMGUI_FUNCTION(GetTime) CALL_FUNCTION(GetTime, float) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API int GetFrameCount(); // Unsupported return type int // IMGUI_API ImDrawList* GetOverlayDrawList(); // this draw list will be the last rendered one, useful to quickly draw overlays shapes/text // Unsupported return type ImDrawList* // IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances // Unsupported return type ImDrawListSharedData* // IMGUI_API const char* GetStyleColorName(ImGuiCol idx); IMGUI_FUNCTION(GetStyleColorName) INT_ARG(idx) CALL_FUNCTION(GetStyleColorName, const char*, idx) PUSH_STRING(ret) END_IMGUI_FUNC // IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) // Unsupported arg type ImGuiStorage* storage // IMGUI_API ImGuiStorage* GetStateStorage(); // Unsupported return type ImGuiStorage* // IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); IMGUI_FUNCTION(CalcTextSize) LABEL_ARG(text) OPTIONAL_LABEL_ARG(text_end) OPTIONAL_BOOL_ARG(hide_text_after_double_hash, false) OPTIONAL_NUMBER_ARG(wrap_width, -1.0f) CALL_FUNCTION(CalcTextSize, ImVec2, text, text_end, hide_text_after_double_hash, wrap_width) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can. IMGUI_FUNCTION(CalcListClipping) INT_ARG(items_count) NUMBER_ARG(items_height) INT_POINTER_ARG(out_items_display_start) INT_POINTER_ARG(out_items_display_end) CALL_FUNCTION_NO_RET(CalcListClipping, items_count, items_height, out_items_display_start, out_items_display_end) END_INT_POINTER(out_items_display_start) END_INT_POINTER(out_items_display_end) END_IMGUI_FUNC // IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame IMGUI_FUNCTION(BeginChildFrame) UINT_ARG(id) IM_VEC_2_ARG(size) OPTIONAL_INT_ARG(flags, 0) CALL_FUNCTION(BeginChildFrame, bool, id, size, flags) IF_RET_ADD_END_STACK(14) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window) IMGUI_FUNCTION(EndChildFrame) CALL_FUNCTION_NO_RET(EndChildFrame) POP_END_STACK(14) END_IMGUI_FUNC // IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); // Unsupported return type ImVec4 // IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); IMGUI_FUNCTION(ColorConvertFloat4ToU32) IM_VEC_4_ARG(in) CALL_FUNCTION(ColorConvertFloat4ToU32, unsigned int, in) PUSH_NUMBER(ret) END_IMGUI_FUNC // IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); // Unsupported arg type float& out_h // Unsupported arg type float& out_s // Unsupported arg type float& out_v // IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); // Unsupported arg type float& out_r // Unsupported arg type float& out_g // Unsupported arg type float& out_b // IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key] // Unsupported return type int // IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]! IMGUI_FUNCTION(IsKeyDown) INT_ARG(user_key_index) CALL_FUNCTION(IsKeyDown, bool, user_key_index) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate IMGUI_FUNCTION(IsKeyPressed) INT_ARG(user_key_index) OPTIONAL_BOOL_ARG(repeat, true) CALL_FUNCTION(IsKeyPressed, bool, user_key_index, repeat) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsKeyReleased(int user_key_index); // was key released (went from Down to !Down).. IMGUI_FUNCTION(IsKeyReleased) INT_ARG(user_key_index) CALL_FUNCTION(IsKeyReleased, bool, user_key_index) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate // Unsupported return type int // IMGUI_API bool IsMouseDown(int button); // is mouse button held IMGUI_FUNCTION(IsMouseDown) INT_ARG(button) CALL_FUNCTION(IsMouseDown, bool, button) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsAnyMouseDown(); // is any mouse button held IMGUI_FUNCTION(IsAnyMouseDown) CALL_FUNCTION(IsAnyMouseDown, bool) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMouseClicked(int button, bool repeat = false); // did mouse button clicked (went from !Down to Down) IMGUI_FUNCTION(IsMouseClicked) INT_ARG(button) OPTIONAL_BOOL_ARG(repeat, false) CALL_FUNCTION(IsMouseClicked, bool, button, repeat) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMouseDoubleClicked(int button); // did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime. IMGUI_FUNCTION(IsMouseDoubleClicked) INT_ARG(button) CALL_FUNCTION(IsMouseDoubleClicked, bool, button) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMouseReleased(int button); // did mouse button released (went from Down to !Down) IMGUI_FUNCTION(IsMouseReleased) INT_ARG(button) CALL_FUNCTION(IsMouseReleased, bool, button) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold IMGUI_FUNCTION(IsMouseDragging) OPTIONAL_INT_ARG(button, 0) OPTIONAL_NUMBER_ARG(lock_threshold, -1.0f) CALL_FUNCTION(IsMouseDragging, bool, button, lock_threshold) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup. IMGUI_FUNCTION(IsMouseHoveringRect) IM_VEC_2_ARG(r_min) IM_VEC_2_ARG(r_max) OPTIONAL_BOOL_ARG(clip, true) CALL_FUNCTION(IsMouseHoveringRect, bool, r_min, r_max, clip) PUSH_BOOL(ret) END_IMGUI_FUNC // IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // // Unsupported arg type const ImVec2* mouse_pos = NULL // IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls IMGUI_FUNCTION(GetMousePos) CALL_FUNCTION(GetMousePos, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve backup of mouse position at the time of opening popup we have BeginPopup() into IMGUI_FUNCTION(GetMousePosOnOpeningCurrentPopup) CALL_FUNCTION(GetMousePosOnOpeningCurrentPopup, ImVec2) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // dragging amount since clicking. if lock_threshold < -1.0f uses io.MouseDraggingThreshold IMGUI_FUNCTION(GetMouseDragDelta) OPTIONAL_INT_ARG(button, 0) OPTIONAL_NUMBER_ARG(lock_threshold, -1.0f) CALL_FUNCTION(GetMouseDragDelta, ImVec2, button, lock_threshold) PUSH_NUMBER(ret.x) PUSH_NUMBER(ret.y) END_IMGUI_FUNC // IMGUI_API void ResetMouseDragDelta(int button = 0); // IMGUI_FUNCTION(ResetMouseDragDelta) OPTIONAL_INT_ARG(button, 0) CALL_FUNCTION_NO_RET(ResetMouseDragDelta, button) END_IMGUI_FUNC // IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you // Unsupported return type ImGuiMouseCursor // IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type IMGUI_FUNCTION(SetMouseCursor) INT_ARG(type) CALL_FUNCTION_NO_RET(SetMouseCursor, type) END_IMGUI_FUNC // IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. IMGUI_FUNCTION(CaptureKeyboardFromApp) OPTIONAL_BOOL_ARG(capture, true) CALL_FUNCTION_NO_RET(CaptureKeyboardFromApp, capture) END_IMGUI_FUNC // IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). IMGUI_FUNCTION(CaptureMouseFromApp) OPTIONAL_BOOL_ARG(capture, true) CALL_FUNCTION_NO_RET(CaptureMouseFromApp, capture) END_IMGUI_FUNC // IMGUI_API const char* GetClipboardText(); IMGUI_FUNCTION(GetClipboardText) CALL_FUNCTION(GetClipboardText, const char*) PUSH_STRING(ret) END_IMGUI_FUNC // IMGUI_API void SetClipboardText(const char* text); IMGUI_FUNCTION(SetClipboardText) LABEL_ARG(text) CALL_FUNCTION_NO_RET(SetClipboardText, text) END_IMGUI_FUNC // IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void(*free_func)(void* ptr, void* user_data), void* user_data = NULL); // Unsupported arg type void* (*alloc_func)(size_t sz // Unsupported arg type void* user_data) // Unsupported arg type void(*free_func)(void* ptr // Unsupported arg type void* user_data) // Unsupported arg type void* user_data = NULL // IMGUI_API void* MemAlloc(size_t size); // Unsupported return type void* // Unsupported arg type size_t size // IMGUI_API void MemFree(void* ptr); // Unsupported arg type void* ptr END_STACK_START END_STACK_OPTION(0, EndFrame) END_STACK_OPTION(1, End) END_STACK_OPTION(2, EndChild) END_STACK_OPTION(3, PopStyleVar) END_STACK_OPTION(4, EndGroup) END_STACK_OPTION(5, EndCombo) END_STACK_OPTION(6, TreePop) END_STACK_OPTION(7, EndTooltip) END_STACK_OPTION(8, EndMainMenuBar) END_STACK_OPTION(9, EndMenuBar) END_STACK_OPTION(10, EndMenu) END_STACK_OPTION(11, EndPopup) END_STACK_OPTION(12, EndDragDropSource) END_STACK_OPTION(13, EndDragDropTarget) END_STACK_OPTION(14, EndChildFrame) END_STACK_END //enum ImGuiWindowFlags_ START_ENUM(WindowFlags) // ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar MAKE_ENUM(ImGuiWindowFlags_NoTitleBar,NoTitleBar) // ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip MAKE_ENUM(ImGuiWindowFlags_NoResize,NoResize) // ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window MAKE_ENUM(ImGuiWindowFlags_NoMove,NoMove) // ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically) MAKE_ENUM(ImGuiWindowFlags_NoScrollbar,NoScrollbar) // ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. MAKE_ENUM(ImGuiWindowFlags_NoScrollWithMouse,NoScrollWithMouse) // ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it MAKE_ENUM(ImGuiWindowFlags_NoCollapse,NoCollapse) // ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame MAKE_ENUM(ImGuiWindowFlags_AlwaysAutoResize,AlwaysAutoResize) // ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file MAKE_ENUM(ImGuiWindowFlags_NoSavedSettings,NoSavedSettings) // ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through. MAKE_ENUM(ImGuiWindowFlags_NoInputs,NoInputs) // ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar MAKE_ENUM(ImGuiWindowFlags_MenuBar,MenuBar) // ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. MAKE_ENUM(ImGuiWindowFlags_HorizontalScrollbar,HorizontalScrollbar) // ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state MAKE_ENUM(ImGuiWindowFlags_NoFocusOnAppearing,NoFocusOnAppearing) // ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) MAKE_ENUM(ImGuiWindowFlags_NoBringToFrontOnFocus,NoBringToFrontOnFocus) // ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) MAKE_ENUM(ImGuiWindowFlags_AlwaysVerticalScrollbar,AlwaysVerticalScrollbar) // ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) MAKE_ENUM(ImGuiWindowFlags_AlwaysHorizontalScrollbar,AlwaysHorizontalScrollbar) // ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) MAKE_ENUM(ImGuiWindowFlags_AlwaysUseWindowPadding,AlwaysUseWindowPadding) // ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // [BETA] Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui. MAKE_ENUM(ImGuiWindowFlags_ResizeFromAnySide,ResizeFromAnySide) // ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window MAKE_ENUM(ImGuiWindowFlags_NoNavInputs,NoNavInputs) // ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) MAKE_ENUM(ImGuiWindowFlags_NoNavFocus,NoNavFocus) // ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, MAKE_ENUM(ImGuiWindowFlags_NoNav,NoNav) // ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!) MAKE_ENUM(ImGuiWindowFlags_NavFlattened,NavFlattened) // ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild() MAKE_ENUM(ImGuiWindowFlags_ChildWindow,ChildWindow) // ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip() MAKE_ENUM(ImGuiWindowFlags_Tooltip,Tooltip) // ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup() MAKE_ENUM(ImGuiWindowFlags_Popup,Popup) // ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() MAKE_ENUM(ImGuiWindowFlags_Modal,Modal) // ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For internal use by BeginMenu() MAKE_ENUM(ImGuiWindowFlags_ChildMenu,ChildMenu) END_ENUM(WindowFlags) //enum ImGuiInputTextFlags_ START_ENUM(InputTextFlags) // ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ MAKE_ENUM(ImGuiInputTextFlags_CharsDecimal,CharsDecimal) // ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef MAKE_ENUM(ImGuiInputTextFlags_CharsHexadecimal,CharsHexadecimal) // ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z MAKE_ENUM(ImGuiInputTextFlags_CharsUppercase,CharsUppercase) // ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs MAKE_ENUM(ImGuiInputTextFlags_CharsNoBlank,CharsNoBlank) // ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus MAKE_ENUM(ImGuiInputTextFlags_AutoSelectAll,AutoSelectAll) // ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified) MAKE_ENUM(ImGuiInputTextFlags_EnterReturnsTrue,EnterReturnsTrue) // ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling) MAKE_ENUM(ImGuiInputTextFlags_CallbackCompletion,CallbackCompletion) // ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling) MAKE_ENUM(ImGuiInputTextFlags_CallbackHistory,CallbackHistory) // ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer. MAKE_ENUM(ImGuiInputTextFlags_CallbackAlways,CallbackAlways) // ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character. MAKE_ENUM(ImGuiInputTextFlags_CallbackCharFilter,CallbackCharFilter) // ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field MAKE_ENUM(ImGuiInputTextFlags_AllowTabInput,AllowTabInput) // ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). MAKE_ENUM(ImGuiInputTextFlags_CtrlEnterForNewLine,CtrlEnterForNewLine) // ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally MAKE_ENUM(ImGuiInputTextFlags_NoHorizontalScroll,NoHorizontalScroll) // ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode MAKE_ENUM(ImGuiInputTextFlags_AlwaysInsertMode,AlwaysInsertMode) // ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode MAKE_ENUM(ImGuiInputTextFlags_ReadOnly,ReadOnly) // ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*' MAKE_ENUM(ImGuiInputTextFlags_Password,Password) // ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). MAKE_ENUM(ImGuiInputTextFlags_NoUndoRedo,NoUndoRedo) // ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input) MAKE_ENUM(ImGuiInputTextFlags_CharsScientific,CharsScientific) // ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline() MAKE_ENUM(ImGuiInputTextFlags_Multiline,Multiline) END_ENUM(InputTextFlags) //enum ImGuiTreeNodeFlags_ START_ENUM(TreeNodeFlags) // ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected MAKE_ENUM(ImGuiTreeNodeFlags_Selected,Selected) // ImGuiTreeNodeFlags_Framed = 1 << 1, // Full colored frame (e.g. for CollapsingHeader) MAKE_ENUM(ImGuiTreeNodeFlags_Framed,Framed) // ImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one MAKE_ENUM(ImGuiTreeNodeFlags_AllowItemOverlap,AllowItemOverlap) // ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack MAKE_ENUM(ImGuiTreeNodeFlags_NoTreePushOnOpen,NoTreePushOnOpen) // ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) MAKE_ENUM(ImGuiTreeNodeFlags_NoAutoOpenOnLog,NoAutoOpenOnLog) // ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open MAKE_ENUM(ImGuiTreeNodeFlags_DefaultOpen,DefaultOpen) // ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node MAKE_ENUM(ImGuiTreeNodeFlags_OpenOnDoubleClick,OpenOnDoubleClick) // ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. MAKE_ENUM(ImGuiTreeNodeFlags_OpenOnArrow,OpenOnArrow) // ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). MAKE_ENUM(ImGuiTreeNodeFlags_Leaf,Leaf) // ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow MAKE_ENUM(ImGuiTreeNodeFlags_Bullet,Bullet) // ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). MAKE_ENUM(ImGuiTreeNodeFlags_FramePadding,FramePadding) // ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) MAKE_ENUM(ImGuiTreeNodeFlags_NavLeftJumpsBackHere,NavLeftJumpsBackHere) // ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog MAKE_ENUM(ImGuiTreeNodeFlags_CollapsingHeader,CollapsingHeader) END_ENUM(TreeNodeFlags) //enum ImGuiSelectableFlags_ START_ENUM(SelectableFlags) // ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window MAKE_ENUM(ImGuiSelectableFlags_DontClosePopups,DontClosePopups) // ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) MAKE_ENUM(ImGuiSelectableFlags_SpanAllColumns,SpanAllColumns) // ImGuiSelectableFlags_AllowDoubleClick = 1 << 2 // Generate press events on double clicks too MAKE_ENUM(ImGuiSelectableFlags_AllowDoubleClick,AllowDoubleClick) END_ENUM(SelectableFlags) //enum ImGuiComboFlags_ START_ENUM(ComboFlags) // ImGuiComboFlags_PopupAlignLeft = 1 << 0, // Align the popup toward the left by default MAKE_ENUM(ImGuiComboFlags_PopupAlignLeft,PopupAlignLeft) // ImGuiComboFlags_HeightSmall = 1 << 1, // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo() MAKE_ENUM(ImGuiComboFlags_HeightSmall,HeightSmall) // ImGuiComboFlags_HeightRegular = 1 << 2, // Max ~8 items visible (default) MAKE_ENUM(ImGuiComboFlags_HeightRegular,HeightRegular) // ImGuiComboFlags_HeightLarge = 1 << 3, // Max ~20 items visible MAKE_ENUM(ImGuiComboFlags_HeightLarge,HeightLarge) // ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible MAKE_ENUM(ImGuiComboFlags_HeightLargest,HeightLargest) // ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button MAKE_ENUM(ImGuiComboFlags_NoArrowButton,NoArrowButton) // ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button MAKE_ENUM(ImGuiComboFlags_NoPreview,NoPreview) END_ENUM(ComboFlags) //enum ImGuiFocusedFlags_ START_ENUM(FocusedFlags) // ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused MAKE_ENUM(ImGuiFocusedFlags_ChildWindows,ChildWindows) // ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy) MAKE_ENUM(ImGuiFocusedFlags_RootWindow,RootWindow) // ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused MAKE_ENUM(ImGuiFocusedFlags_AnyWindow,AnyWindow) // ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows MAKE_ENUM(ImGuiFocusedFlags_RootAndChildWindows,RootAndChildWindows) END_ENUM(FocusedFlags) //enum ImGuiHoveredFlags_ START_ENUM(HoveredFlags) // ImGuiHoveredFlags_Default = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. MAKE_ENUM(ImGuiHoveredFlags_Default,Default) // ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered MAKE_ENUM(ImGuiHoveredFlags_ChildWindows,ChildWindows) // ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) MAKE_ENUM(ImGuiHoveredFlags_RootWindow,RootWindow) // ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered MAKE_ENUM(ImGuiHoveredFlags_AnyWindow,AnyWindow) // ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window MAKE_ENUM(ImGuiHoveredFlags_AllowWhenBlockedByPopup,AllowWhenBlockedByPopup) // ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. MAKE_ENUM(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem,AllowWhenBlockedByActiveItem) // ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is overlapped by another window MAKE_ENUM(ImGuiHoveredFlags_AllowWhenOverlapped,AllowWhenOverlapped) // ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, MAKE_ENUM(ImGuiHoveredFlags_RectOnly,RectOnly) // ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows MAKE_ENUM(ImGuiHoveredFlags_RootAndChildWindows,RootAndChildWindows) END_ENUM(HoveredFlags) //enum ImGuiDragDropFlags_ START_ENUM(DragDropFlags) // ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. MAKE_ENUM(ImGuiDragDropFlags_SourceNoPreviewTooltip,SourceNoPreviewTooltip) // ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. MAKE_ENUM(ImGuiDragDropFlags_SourceNoDisableHover,SourceNoDisableHover) // ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. MAKE_ENUM(ImGuiDragDropFlags_SourceNoHoldToOpenOthers,SourceNoHoldToOpenOthers) // ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. MAKE_ENUM(ImGuiDragDropFlags_SourceAllowNullID,SourceAllowNullID) // ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. MAKE_ENUM(ImGuiDragDropFlags_SourceExtern,SourceExtern) // ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. MAKE_ENUM(ImGuiDragDropFlags_AcceptBeforeDelivery,AcceptBeforeDelivery) // ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target. MAKE_ENUM(ImGuiDragDropFlags_AcceptNoDrawDefaultRect,AcceptNoDrawDefaultRect) // ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery. MAKE_ENUM(ImGuiDragDropFlags_AcceptPeekOnly,AcceptPeekOnly) END_ENUM(DragDropFlags) //enum ImGuiDir_ START_ENUM(Dir) // ImGuiDir_None = -1, MAKE_ENUM(ImGuiDir_None,None) // ImGuiDir_Left = 0, MAKE_ENUM(ImGuiDir_Left,Left) // ImGuiDir_Right = 1, MAKE_ENUM(ImGuiDir_Right,Right) // ImGuiDir_Up = 2, MAKE_ENUM(ImGuiDir_Up,Up) // ImGuiDir_Down = 3, MAKE_ENUM(ImGuiDir_Down,Down) // ImGuiDir_COUNT MAKE_ENUM(ImGuiDir_COUNT,COUNT) END_ENUM(Dir) //enum ImGuiKey_ START_ENUM(Key) // ImGuiKey_Tab, MAKE_ENUM(ImGuiKey_Tab,Tab) // ImGuiKey_LeftArrow, MAKE_ENUM(ImGuiKey_LeftArrow,LeftArrow) // ImGuiKey_RightArrow, MAKE_ENUM(ImGuiKey_RightArrow,RightArrow) // ImGuiKey_UpArrow, MAKE_ENUM(ImGuiKey_UpArrow,UpArrow) // ImGuiKey_DownArrow, MAKE_ENUM(ImGuiKey_DownArrow,DownArrow) // ImGuiKey_PageUp, MAKE_ENUM(ImGuiKey_PageUp,PageUp) // ImGuiKey_PageDown, MAKE_ENUM(ImGuiKey_PageDown,PageDown) // ImGuiKey_Home, MAKE_ENUM(ImGuiKey_Home,Home) // ImGuiKey_End, MAKE_ENUM(ImGuiKey_End,End) // ImGuiKey_Insert, MAKE_ENUM(ImGuiKey_Insert,Insert) // ImGuiKey_Delete, MAKE_ENUM(ImGuiKey_Delete,Delete) // ImGuiKey_Backspace, MAKE_ENUM(ImGuiKey_Backspace,Backspace) // ImGuiKey_Space, MAKE_ENUM(ImGuiKey_Space,Space) // ImGuiKey_Enter, MAKE_ENUM(ImGuiKey_Enter,Enter) // ImGuiKey_Escape, MAKE_ENUM(ImGuiKey_Escape,Escape) // ImGuiKey_A, // for text edit CTRL+A: select all MAKE_ENUM(ImGuiKey_A,A) // ImGuiKey_C, // for text edit CTRL+C: copy MAKE_ENUM(ImGuiKey_C,C) // ImGuiKey_V, // for text edit CTRL+V: paste MAKE_ENUM(ImGuiKey_V,V) // ImGuiKey_X, // for text edit CTRL+X: cut MAKE_ENUM(ImGuiKey_X,X) // ImGuiKey_Y, // for text edit CTRL+Y: redo MAKE_ENUM(ImGuiKey_Y,Y) // ImGuiKey_Z, // for text edit CTRL+Z: undo MAKE_ENUM(ImGuiKey_Z,Z) // ImGuiKey_COUNT MAKE_ENUM(ImGuiKey_COUNT,COUNT) END_ENUM(Key) //enum ImGuiNavInput_ START_ENUM(NavInput) // ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) MAKE_ENUM(ImGuiNavInput_Activate,Activate) // ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) MAKE_ENUM(ImGuiNavInput_Cancel,Cancel) // ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) MAKE_ENUM(ImGuiNavInput_Input,Input) // ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) MAKE_ENUM(ImGuiNavInput_Menu,Menu) // ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) MAKE_ENUM(ImGuiNavInput_DpadLeft,DpadLeft) // ImGuiNavInput_DpadRight, // MAKE_ENUM(ImGuiNavInput_DpadRight,DpadRight) // ImGuiNavInput_DpadUp, // MAKE_ENUM(ImGuiNavInput_DpadUp,DpadUp) // ImGuiNavInput_DpadDown, // MAKE_ENUM(ImGuiNavInput_DpadDown,DpadDown) // ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down MAKE_ENUM(ImGuiNavInput_LStickLeft,LStickLeft) // ImGuiNavInput_LStickRight, // MAKE_ENUM(ImGuiNavInput_LStickRight,LStickRight) // ImGuiNavInput_LStickUp, // MAKE_ENUM(ImGuiNavInput_LStickUp,LStickUp) // ImGuiNavInput_LStickDown, // MAKE_ENUM(ImGuiNavInput_LStickDown,LStickDown) // ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) MAKE_ENUM(ImGuiNavInput_FocusPrev,FocusPrev) // ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) MAKE_ENUM(ImGuiNavInput_FocusNext,FocusNext) // ImGuiNavInput_TweakSlow, // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) MAKE_ENUM(ImGuiNavInput_TweakSlow,TweakSlow) // ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) MAKE_ENUM(ImGuiNavInput_TweakFast,TweakFast) // ImGuiNavInput_COUNT, MAKE_ENUM(ImGuiNavInput_COUNT,COUNT) END_ENUM(NavInput) //enum ImGuiConfigFlags_ START_ENUM(ConfigFlags) // ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeyDown[]. MAKE_ENUM(ImGuiConfigFlags_NavEnableKeyboard,NavEnableKeyboard) // ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad. MAKE_ENUM(ImGuiConfigFlags_NavEnableGamepad,NavEnableGamepad) // ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth. MAKE_ENUM(ImGuiConfigFlags_NavEnableSetMousePos,NavEnableSetMousePos) // ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag with io.NavActive is set. MAKE_ENUM(ImGuiConfigFlags_NavNoCaptureKeyboard,NavNoCaptureKeyboard) // ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information back-end MAKE_ENUM(ImGuiConfigFlags_NoMouse,NoMouse) // ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility. MAKE_ENUM(ImGuiConfigFlags_NoMouseCursorChange,NoMouseCursorChange) // ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware. MAKE_ENUM(ImGuiConfigFlags_IsSRGB,IsSRGB) // ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. MAKE_ENUM(ImGuiConfigFlags_IsTouchScreen,IsTouchScreen) END_ENUM(ConfigFlags) //enum ImGuiBackendFlags_ START_ENUM(BackendFlags) // ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end has a connected gamepad. MAKE_ENUM(ImGuiBackendFlags_HasGamepad,HasGamepad) // ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end can honor GetMouseCursor() values and change the OS cursor shape. MAKE_ENUM(ImGuiBackendFlags_HasMouseCursors,HasMouseCursors) // ImGuiBackendFlags_HasSetMousePos = 1 << 2 // Back-end can honor io.WantSetMousePos and reposition the mouse (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). MAKE_ENUM(ImGuiBackendFlags_HasSetMousePos,HasSetMousePos) END_ENUM(BackendFlags) //enum ImGuiCol_ START_ENUM(Col) // ImGuiCol_Text, MAKE_ENUM(ImGuiCol_Text,Text) // ImGuiCol_TextDisabled, MAKE_ENUM(ImGuiCol_TextDisabled,TextDisabled) // ImGuiCol_WindowBg, // Background of normal windows MAKE_ENUM(ImGuiCol_WindowBg,WindowBg) // ImGuiCol_ChildBg, // Background of child windows MAKE_ENUM(ImGuiCol_ChildBg,ChildBg) // ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows MAKE_ENUM(ImGuiCol_PopupBg,PopupBg) // ImGuiCol_Border, MAKE_ENUM(ImGuiCol_Border,Border) // ImGuiCol_BorderShadow, MAKE_ENUM(ImGuiCol_BorderShadow,BorderShadow) // ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input MAKE_ENUM(ImGuiCol_FrameBg,FrameBg) // ImGuiCol_FrameBgHovered, MAKE_ENUM(ImGuiCol_FrameBgHovered,FrameBgHovered) // ImGuiCol_FrameBgActive, MAKE_ENUM(ImGuiCol_FrameBgActive,FrameBgActive) // ImGuiCol_TitleBg, MAKE_ENUM(ImGuiCol_TitleBg,TitleBg) // ImGuiCol_TitleBgActive, MAKE_ENUM(ImGuiCol_TitleBgActive,TitleBgActive) // ImGuiCol_TitleBgCollapsed, MAKE_ENUM(ImGuiCol_TitleBgCollapsed,TitleBgCollapsed) // ImGuiCol_MenuBarBg, MAKE_ENUM(ImGuiCol_MenuBarBg,MenuBarBg) // ImGuiCol_ScrollbarBg, MAKE_ENUM(ImGuiCol_ScrollbarBg,ScrollbarBg) // ImGuiCol_ScrollbarGrab, MAKE_ENUM(ImGuiCol_ScrollbarGrab,ScrollbarGrab) // ImGuiCol_ScrollbarGrabHovered, MAKE_ENUM(ImGuiCol_ScrollbarGrabHovered,ScrollbarGrabHovered) // ImGuiCol_ScrollbarGrabActive, MAKE_ENUM(ImGuiCol_ScrollbarGrabActive,ScrollbarGrabActive) // ImGuiCol_CheckMark, MAKE_ENUM(ImGuiCol_CheckMark,CheckMark) // ImGuiCol_SliderGrab, MAKE_ENUM(ImGuiCol_SliderGrab,SliderGrab) // ImGuiCol_SliderGrabActive, MAKE_ENUM(ImGuiCol_SliderGrabActive,SliderGrabActive) // ImGuiCol_Button, MAKE_ENUM(ImGuiCol_Button,Button) // ImGuiCol_ButtonHovered, MAKE_ENUM(ImGuiCol_ButtonHovered,ButtonHovered) // ImGuiCol_ButtonActive, MAKE_ENUM(ImGuiCol_ButtonActive,ButtonActive) // ImGuiCol_Header, MAKE_ENUM(ImGuiCol_Header,Header) // ImGuiCol_HeaderHovered, MAKE_ENUM(ImGuiCol_HeaderHovered,HeaderHovered) // ImGuiCol_HeaderActive, MAKE_ENUM(ImGuiCol_HeaderActive,HeaderActive) // ImGuiCol_Separator, MAKE_ENUM(ImGuiCol_Separator,Separator) // ImGuiCol_SeparatorHovered, MAKE_ENUM(ImGuiCol_SeparatorHovered,SeparatorHovered) // ImGuiCol_SeparatorActive, MAKE_ENUM(ImGuiCol_SeparatorActive,SeparatorActive) // ImGuiCol_ResizeGrip, MAKE_ENUM(ImGuiCol_ResizeGrip,ResizeGrip) // ImGuiCol_ResizeGripHovered, MAKE_ENUM(ImGuiCol_ResizeGripHovered,ResizeGripHovered) // ImGuiCol_ResizeGripActive, MAKE_ENUM(ImGuiCol_ResizeGripActive,ResizeGripActive) // ImGuiCol_PlotLines, MAKE_ENUM(ImGuiCol_PlotLines,PlotLines) // ImGuiCol_PlotLinesHovered, MAKE_ENUM(ImGuiCol_PlotLinesHovered,PlotLinesHovered) // ImGuiCol_PlotHistogram, MAKE_ENUM(ImGuiCol_PlotHistogram,PlotHistogram) // ImGuiCol_PlotHistogramHovered, MAKE_ENUM(ImGuiCol_PlotHistogramHovered,PlotHistogramHovered) // ImGuiCol_TextSelectedBg, MAKE_ENUM(ImGuiCol_TextSelectedBg,TextSelectedBg) // ImGuiCol_ModalWindowDarkening, // darken/colorize entire screen behind a modal window, when one is active MAKE_ENUM(ImGuiCol_ModalWindowDarkening,ModalWindowDarkening) // ImGuiCol_DragDropTarget, MAKE_ENUM(ImGuiCol_DragDropTarget,DragDropTarget) // ImGuiCol_NavHighlight, // gamepad/keyboard: current highlighted item MAKE_ENUM(ImGuiCol_NavHighlight,NavHighlight) // ImGuiCol_NavWindowingHighlight, // gamepad/keyboard: when holding NavMenu to focus/move/resize windows MAKE_ENUM(ImGuiCol_NavWindowingHighlight,NavWindowingHighlight) // ImGuiCol_COUNT MAKE_ENUM(ImGuiCol_COUNT,COUNT) END_ENUM(Col) //enum ImGuiStyleVar_ START_ENUM(StyleVar) // ImGuiStyleVar_Alpha, // float Alpha MAKE_ENUM(ImGuiStyleVar_Alpha,Alpha) // ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding MAKE_ENUM(ImGuiStyleVar_WindowPadding,WindowPadding) // ImGuiStyleVar_WindowRounding, // float WindowRounding MAKE_ENUM(ImGuiStyleVar_WindowRounding,WindowRounding) // ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize MAKE_ENUM(ImGuiStyleVar_WindowBorderSize,WindowBorderSize) // ImGuiStyleVar_WindowMinSize, // ImVec2 WindowMinSize MAKE_ENUM(ImGuiStyleVar_WindowMinSize,WindowMinSize) // ImGuiStyleVar_WindowTitleAlign, // ImVec2 WindowTitleAlign MAKE_ENUM(ImGuiStyleVar_WindowTitleAlign,WindowTitleAlign) // ImGuiStyleVar_ChildRounding, // float ChildRounding MAKE_ENUM(ImGuiStyleVar_ChildRounding,ChildRounding) // ImGuiStyleVar_ChildBorderSize, // float ChildBorderSize MAKE_ENUM(ImGuiStyleVar_ChildBorderSize,ChildBorderSize) // ImGuiStyleVar_PopupRounding, // float PopupRounding MAKE_ENUM(ImGuiStyleVar_PopupRounding,PopupRounding) // ImGuiStyleVar_PopupBorderSize, // float PopupBorderSize MAKE_ENUM(ImGuiStyleVar_PopupBorderSize,PopupBorderSize) // ImGuiStyleVar_FramePadding, // ImVec2 FramePadding MAKE_ENUM(ImGuiStyleVar_FramePadding,FramePadding) // ImGuiStyleVar_FrameRounding, // float FrameRounding MAKE_ENUM(ImGuiStyleVar_FrameRounding,FrameRounding) // ImGuiStyleVar_FrameBorderSize, // float FrameBorderSize MAKE_ENUM(ImGuiStyleVar_FrameBorderSize,FrameBorderSize) // ImGuiStyleVar_ItemSpacing, // ImVec2 ItemSpacing MAKE_ENUM(ImGuiStyleVar_ItemSpacing,ItemSpacing) // ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ItemInnerSpacing MAKE_ENUM(ImGuiStyleVar_ItemInnerSpacing,ItemInnerSpacing) // ImGuiStyleVar_IndentSpacing, // float IndentSpacing MAKE_ENUM(ImGuiStyleVar_IndentSpacing,IndentSpacing) // ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize MAKE_ENUM(ImGuiStyleVar_ScrollbarSize,ScrollbarSize) // ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding MAKE_ENUM(ImGuiStyleVar_ScrollbarRounding,ScrollbarRounding) // ImGuiStyleVar_GrabMinSize, // float GrabMinSize MAKE_ENUM(ImGuiStyleVar_GrabMinSize,GrabMinSize) // ImGuiStyleVar_GrabRounding, // float GrabRounding MAKE_ENUM(ImGuiStyleVar_GrabRounding,GrabRounding) // ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign MAKE_ENUM(ImGuiStyleVar_ButtonTextAlign,ButtonTextAlign) // ImGuiStyleVar_COUNT MAKE_ENUM(ImGuiStyleVar_COUNT,COUNT) END_ENUM(StyleVar) //enum ImGuiColorEditFlags_ START_ENUM(ColorEditFlags) // ImGuiColorEditFlags_NoAlpha = 1 << 1, // // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer). MAKE_ENUM(ImGuiColorEditFlags_NoAlpha,NoAlpha) // ImGuiColorEditFlags_NoPicker = 1 << 2, // // ColorEdit: disable picker when clicking on colored square. MAKE_ENUM(ImGuiColorEditFlags_NoPicker,NoPicker) // ImGuiColorEditFlags_NoOptions = 1 << 3, // // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. MAKE_ENUM(ImGuiColorEditFlags_NoOptions,NoOptions) // ImGuiColorEditFlags_NoSmallPreview = 1 << 4, // // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs) MAKE_ENUM(ImGuiColorEditFlags_NoSmallPreview,NoSmallPreview) // ImGuiColorEditFlags_NoInputs = 1 << 5, // // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square). MAKE_ENUM(ImGuiColorEditFlags_NoInputs,NoInputs) // ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. MAKE_ENUM(ImGuiColorEditFlags_NoTooltip,NoTooltip) // ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). MAKE_ENUM(ImGuiColorEditFlags_NoLabel,NoLabel) // ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. MAKE_ENUM(ImGuiColorEditFlags_NoSidePreview,NoSidePreview) // ImGuiColorEditFlags_AlphaBar = 1 << 9, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. MAKE_ENUM(ImGuiColorEditFlags_AlphaBar,AlphaBar) // ImGuiColorEditFlags_AlphaPreview = 1 << 10, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. MAKE_ENUM(ImGuiColorEditFlags_AlphaPreview,AlphaPreview) // ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 11, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. MAKE_ENUM(ImGuiColorEditFlags_AlphaPreviewHalf,AlphaPreviewHalf) // ImGuiColorEditFlags_HDR = 1 << 12, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). MAKE_ENUM(ImGuiColorEditFlags_HDR,HDR) // ImGuiColorEditFlags_RGB = 1 << 13, // [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX. MAKE_ENUM(ImGuiColorEditFlags_RGB,RGB) // ImGuiColorEditFlags_HSV = 1 << 14, // [Inputs] // " MAKE_ENUM(ImGuiColorEditFlags_HSV,HSV) // ImGuiColorEditFlags_HEX = 1 << 15, // [Inputs] // " MAKE_ENUM(ImGuiColorEditFlags_HEX,HEX) // ImGuiColorEditFlags_Uint8 = 1 << 16, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. MAKE_ENUM(ImGuiColorEditFlags_Uint8,Uint8) // ImGuiColorEditFlags_Float = 1 << 17, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. MAKE_ENUM(ImGuiColorEditFlags_Float,Float) // ImGuiColorEditFlags_PickerHueBar = 1 << 18, // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value. MAKE_ENUM(ImGuiColorEditFlags_PickerHueBar,PickerHueBar) // ImGuiColorEditFlags_PickerHueWheel = 1 << 19, // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value. MAKE_ENUM(ImGuiColorEditFlags_PickerHueWheel,PickerHueWheel) END_ENUM(ColorEditFlags) //enum ImGuiMouseCursor_ START_ENUM(MouseCursor) // ImGuiMouseCursor_None = -1, MAKE_ENUM(ImGuiMouseCursor_None,None) // ImGuiMouseCursor_Arrow = 0, MAKE_ENUM(ImGuiMouseCursor_Arrow,Arrow) // ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. MAKE_ENUM(ImGuiMouseCursor_TextInput,TextInput) // ImGuiMouseCursor_ResizeAll, // Unused by imgui functions MAKE_ENUM(ImGuiMouseCursor_ResizeAll,ResizeAll) // ImGuiMouseCursor_ResizeNS, // When hovering over an horizontal border MAKE_ENUM(ImGuiMouseCursor_ResizeNS,ResizeNS) // ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column MAKE_ENUM(ImGuiMouseCursor_ResizeEW,ResizeEW) // ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window MAKE_ENUM(ImGuiMouseCursor_ResizeNESW,ResizeNESW) // ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window MAKE_ENUM(ImGuiMouseCursor_ResizeNWSE,ResizeNWSE) // ImGuiMouseCursor_COUNT MAKE_ENUM(ImGuiMouseCursor_COUNT,COUNT) END_ENUM(MouseCursor) //enum ImGuiCond_ START_ENUM(Cond) // ImGuiCond_Always = 1 << 0, // Set the variable MAKE_ENUM(ImGuiCond_Always,Always) // ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed) MAKE_ENUM(ImGuiCond_Once,Once) // ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file) MAKE_ENUM(ImGuiCond_FirstUseEver,FirstUseEver) // ImGuiCond_Appearing = 1 << 3 // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) MAKE_ENUM(ImGuiCond_Appearing,Appearing) END_ENUM(Cond) //struct ImGuiStyle //struct ImGuiIO //namespace ImGui END_STACK_START END_STACK_END //class ImVector //struct ImGuiOnceUponAFrame //struct ImGuiTextFilter //struct ImGuiTextBuffer //struct ImGuiStorage //struct ImGuiTextEditCallbackData //struct ImGuiSizeCallbackData //struct ImGuiPayload //struct ImColor //struct ImGuiListClipper //struct ImDrawCmd //struct ImDrawVert //struct ImDrawChannel //enum ImDrawCornerFlags_ //enum ImDrawListFlags_ //struct ImDrawList // IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_FUNCTION_DRAW_LIST(PushClipRect) IM_VEC_2_ARG(clip_rect_min) IM_VEC_2_ARG(clip_rect_max) OPTIONAL_BOOL_ARG(intersect_with_current_clip_rect, false) DRAW_LIST_CALL_FUNCTION_NO_RET(PushClipRect, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect) END_IMGUI_FUNC // IMGUI_API void PushClipRectFullScreen(); IMGUI_FUNCTION_DRAW_LIST(PushClipRectFullScreen) DRAW_LIST_CALL_FUNCTION_NO_RET(PushClipRectFullScreen) END_IMGUI_FUNC // IMGUI_API void PopClipRect(); IMGUI_FUNCTION_DRAW_LIST(PopClipRect) DRAW_LIST_CALL_FUNCTION_NO_RET(PopClipRect) END_IMGUI_FUNC // IMGUI_API void PushTextureID(ImTextureID texture_id); IMGUI_FUNCTION_DRAW_LIST(PushTextureID) IM_TEXTURE_ID_ARG(texture_id) DRAW_LIST_CALL_FUNCTION_NO_RET(PushTextureID, texture_id) END_IMGUI_FUNC // IMGUI_API void PopTextureID(); IMGUI_FUNCTION_DRAW_LIST(PopTextureID) DRAW_LIST_CALL_FUNCTION_NO_RET(PopTextureID) END_IMGUI_FUNC // inline ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2 cr.x cr.y; } // Unsupported arg type ) const { const ImVec4& cr = _ClipRectStack.back( // inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2 cr.z cr.w; } // Unsupported arg type ) const { const ImVec4& cr = _ClipRectStack.back( // IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); IMGUI_FUNCTION_DRAW_LIST(AddLine) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) UINT_ARG(col) OPTIONAL_NUMBER_ARG(thickness, 1.0f) DRAW_LIST_CALL_FUNCTION_NO_RET(AddLine, a, b, col, thickness) END_IMGUI_FUNC // IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All, float thickness = 1.0f); // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round IMGUI_FUNCTION_DRAW_LIST(AddRect) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) UINT_ARG(col) OPTIONAL_NUMBER_ARG(rounding, 0.0f) OPTIONAL_INT_ARG(rounding_corners_flags, ImDrawCornerFlags_All) OPTIONAL_NUMBER_ARG(thickness, 1.0f) DRAW_LIST_CALL_FUNCTION_NO_RET(AddRect, a, b, col, rounding, rounding_corners_flags, thickness) END_IMGUI_FUNC // IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); // a: upper-left, b: lower-right IMGUI_FUNCTION_DRAW_LIST(AddRectFilled) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) UINT_ARG(col) OPTIONAL_NUMBER_ARG(rounding, 0.0f) OPTIONAL_INT_ARG(rounding_corners_flags, ImDrawCornerFlags_All) DRAW_LIST_CALL_FUNCTION_NO_RET(AddRectFilled, a, b, col, rounding, rounding_corners_flags) END_IMGUI_FUNC // IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); IMGUI_FUNCTION_DRAW_LIST(AddRectFilledMultiColor) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) UINT_ARG(col_upr_left) UINT_ARG(col_upr_right) UINT_ARG(col_bot_right) UINT_ARG(col_bot_left) DRAW_LIST_CALL_FUNCTION_NO_RET(AddRectFilledMultiColor, a, b, col_upr_left, col_upr_right, col_bot_right, col_bot_left) END_IMGUI_FUNC // IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); IMGUI_FUNCTION_DRAW_LIST(AddQuad) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) IM_VEC_2_ARG(d) UINT_ARG(col) OPTIONAL_NUMBER_ARG(thickness, 1.0f) DRAW_LIST_CALL_FUNCTION_NO_RET(AddQuad, a, b, c, d, col, thickness) END_IMGUI_FUNC // IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); IMGUI_FUNCTION_DRAW_LIST(AddQuadFilled) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) IM_VEC_2_ARG(d) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(AddQuadFilled, a, b, c, d, col) END_IMGUI_FUNC // IMGUI_API void AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness = 1.0f); IMGUI_FUNCTION_DRAW_LIST(AddTriangle) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) UINT_ARG(col) OPTIONAL_NUMBER_ARG(thickness, 1.0f) DRAW_LIST_CALL_FUNCTION_NO_RET(AddTriangle, a, b, c, col, thickness) END_IMGUI_FUNC // IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col); IMGUI_FUNCTION_DRAW_LIST(AddTriangleFilled) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(AddTriangleFilled, a, b, c, col) END_IMGUI_FUNC // IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f); IMGUI_FUNCTION_DRAW_LIST(AddCircle) IM_VEC_2_ARG(centre) NUMBER_ARG(radius) UINT_ARG(col) OPTIONAL_INT_ARG(num_segments, 12) OPTIONAL_NUMBER_ARG(thickness, 1.0f) DRAW_LIST_CALL_FUNCTION_NO_RET(AddCircle, centre, radius, col, num_segments, thickness) END_IMGUI_FUNC // IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12); IMGUI_FUNCTION_DRAW_LIST(AddCircleFilled) IM_VEC_2_ARG(centre) NUMBER_ARG(radius) UINT_ARG(col) OPTIONAL_INT_ARG(num_segments, 12) DRAW_LIST_CALL_FUNCTION_NO_RET(AddCircleFilled, centre, radius, col, num_segments) END_IMGUI_FUNC // IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); IMGUI_FUNCTION_DRAW_LIST(AddText) IM_VEC_2_ARG(pos) UINT_ARG(col) LABEL_ARG(text_begin) OPTIONAL_LABEL_ARG(text_end) DRAW_LIST_CALL_FUNCTION_NO_RET(AddText, pos, col, text_begin, text_end) END_IMGUI_FUNC // IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); // Unsupported arg type const ImFont* font // Unsupported arg type const ImVec4* cpu_fine_clip_rect = NULL // IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a = ImVec2 0 0, const ImVec2& uv_b = ImVec2 1 1, ImU32 col = 0xFFFFFFFF); IMGUI_FUNCTION_DRAW_LIST(AddImage) IM_TEXTURE_ID_ARG(user_texture_id) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) OPTIONAL_IM_VEC_2_ARG(uv_a, 0, 0) OPTIONAL_IM_VEC_2_ARG(uv_b, 1, 1) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(AddImage, user_texture_id, a, b, uv_a, uv_b, col) END_IMGUI_FUNC // IMGUI_API void AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a = ImVec2 0 0, const ImVec2& uv_b = ImVec2 1 0, const ImVec2& uv_c = ImVec2 1 1, const ImVec2& uv_d = ImVec2 0 1, ImU32 col = 0xFFFFFFFF); IMGUI_FUNCTION_DRAW_LIST(AddImageQuad) IM_TEXTURE_ID_ARG(user_texture_id) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) IM_VEC_2_ARG(d) OPTIONAL_IM_VEC_2_ARG(uv_a, 0, 0) OPTIONAL_IM_VEC_2_ARG(uv_b, 1, 0) OPTIONAL_IM_VEC_2_ARG(uv_c, 1, 1) OPTIONAL_IM_VEC_2_ARG(uv_d, 0, 1) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(AddImageQuad, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col) END_IMGUI_FUNC // IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, int rounding_corners = ImDrawCornerFlags_All); IMGUI_FUNCTION_DRAW_LIST(AddImageRounded) IM_TEXTURE_ID_ARG(user_texture_id) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(uv_a) IM_VEC_2_ARG(uv_b) UINT_ARG(col) NUMBER_ARG(rounding) OPTIONAL_INT_ARG(rounding_corners, ImDrawCornerFlags_All) DRAW_LIST_CALL_FUNCTION_NO_RET(AddImageRounded, user_texture_id, a, b, uv_a, uv_b, col, rounding, rounding_corners) END_IMGUI_FUNC // IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness); // Unsupported arg type const ImVec2* points // Unsupported arg type const int num_points // IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col); // Unsupported arg type const ImVec2* points // Unsupported arg type const int num_points // IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0); IMGUI_FUNCTION_DRAW_LIST(AddBezierCurve) IM_VEC_2_ARG(pos0) IM_VEC_2_ARG(cp0) IM_VEC_2_ARG(cp1) IM_VEC_2_ARG(pos1) UINT_ARG(col) NUMBER_ARG(thickness) OPTIONAL_INT_ARG(num_segments, 0) DRAW_LIST_CALL_FUNCTION_NO_RET(AddBezierCurve, pos0, cp0, cp1, pos1, col, thickness, num_segments) END_IMGUI_FUNC // inline void PathClear() { _Path.resize(0); } // Unsupported arg type ) { _Path.resize(0 // inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } // Unsupported arg type const ImVec2& pos) { _Path.push_back(pos // inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size-1], &pos, 8) != 0) _Path.push_back(pos); } // Unsupported arg type const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size-1] // Unsupported arg type &pos // Unsupported arg type 8) != 0) _Path.push_back(pos // inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); PathClear(); } // Unsupported arg type ImU32 col) { AddConvexPolyFilled(_Path.Data // Unsupported arg type _Path.Size // Unsupported arg type col // inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); PathClear(); } // Unsupported arg type float thickness = 1.0f) { AddPolyline(_Path.Data // Unsupported arg type _Path.Size // Unsupported arg type col // Unsupported arg type closed // Unsupported arg type thickness // IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); IMGUI_FUNCTION_DRAW_LIST(PathArcTo) IM_VEC_2_ARG(centre) NUMBER_ARG(radius) NUMBER_ARG(a_min) NUMBER_ARG(a_max) OPTIONAL_INT_ARG(num_segments, 10) DRAW_LIST_CALL_FUNCTION_NO_RET(PathArcTo, centre, radius, a_min, a_max, num_segments) END_IMGUI_FUNC // IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle IMGUI_FUNCTION_DRAW_LIST(PathArcToFast) IM_VEC_2_ARG(centre) NUMBER_ARG(radius) INT_ARG(a_min_of_12) INT_ARG(a_max_of_12) DRAW_LIST_CALL_FUNCTION_NO_RET(PathArcToFast, centre, radius, a_min_of_12, a_max_of_12) END_IMGUI_FUNC // IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); IMGUI_FUNCTION_DRAW_LIST(PathBezierCurveTo) IM_VEC_2_ARG(p1) IM_VEC_2_ARG(p2) IM_VEC_2_ARG(p3) OPTIONAL_INT_ARG(num_segments, 0) DRAW_LIST_CALL_FUNCTION_NO_RET(PathBezierCurveTo, p1, p2, p3, num_segments) END_IMGUI_FUNC // IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); IMGUI_FUNCTION_DRAW_LIST(PathRect) IM_VEC_2_ARG(rect_min) IM_VEC_2_ARG(rect_max) OPTIONAL_NUMBER_ARG(rounding, 0.0f) OPTIONAL_INT_ARG(rounding_corners_flags, ImDrawCornerFlags_All) DRAW_LIST_CALL_FUNCTION_NO_RET(PathRect, rect_min, rect_max, rounding, rounding_corners_flags) END_IMGUI_FUNC // IMGUI_API void ChannelsSplit(int channels_count); IMGUI_FUNCTION_DRAW_LIST(ChannelsSplit) INT_ARG(channels_count) DRAW_LIST_CALL_FUNCTION_NO_RET(ChannelsSplit, channels_count) END_IMGUI_FUNC // IMGUI_API void ChannelsMerge(); IMGUI_FUNCTION_DRAW_LIST(ChannelsMerge) DRAW_LIST_CALL_FUNCTION_NO_RET(ChannelsMerge) END_IMGUI_FUNC // IMGUI_API void ChannelsSetCurrent(int channel_index); IMGUI_FUNCTION_DRAW_LIST(ChannelsSetCurrent) INT_ARG(channel_index) DRAW_LIST_CALL_FUNCTION_NO_RET(ChannelsSetCurrent, channel_index) END_IMGUI_FUNC // IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. // Unsupported arg type ImDrawCallback callback // Unsupported arg type void* callback_data // IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible IMGUI_FUNCTION_DRAW_LIST(AddDrawCmd) DRAW_LIST_CALL_FUNCTION_NO_RET(AddDrawCmd) END_IMGUI_FUNC // IMGUI_API void Clear(); IMGUI_FUNCTION_DRAW_LIST(Clear) DRAW_LIST_CALL_FUNCTION_NO_RET(Clear) END_IMGUI_FUNC // IMGUI_API void ClearFreeMemory(); IMGUI_FUNCTION_DRAW_LIST(ClearFreeMemory) DRAW_LIST_CALL_FUNCTION_NO_RET(ClearFreeMemory) END_IMGUI_FUNC // IMGUI_API void PrimReserve(int idx_count, int vtx_count); IMGUI_FUNCTION_DRAW_LIST(PrimReserve) INT_ARG(idx_count) INT_ARG(vtx_count) DRAW_LIST_CALL_FUNCTION_NO_RET(PrimReserve, idx_count, vtx_count) END_IMGUI_FUNC // IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) IMGUI_FUNCTION_DRAW_LIST(PrimRect) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(PrimRect, a, b, col) END_IMGUI_FUNC // IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); IMGUI_FUNCTION_DRAW_LIST(PrimRectUV) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(uv_a) IM_VEC_2_ARG(uv_b) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(PrimRectUV, a, b, uv_a, uv_b, col) END_IMGUI_FUNC // IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); IMGUI_FUNCTION_DRAW_LIST(PrimQuadUV) IM_VEC_2_ARG(a) IM_VEC_2_ARG(b) IM_VEC_2_ARG(c) IM_VEC_2_ARG(d) IM_VEC_2_ARG(uv_a) IM_VEC_2_ARG(uv_b) IM_VEC_2_ARG(uv_c) IM_VEC_2_ARG(uv_d) UINT_ARG(col) DRAW_LIST_CALL_FUNCTION_NO_RET(PrimQuadUV, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col) END_IMGUI_FUNC // inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Unsupported arg type ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx // IMGUI_API void UpdateClipRect(); IMGUI_FUNCTION_DRAW_LIST(UpdateClipRect) DRAW_LIST_CALL_FUNCTION_NO_RET(UpdateClipRect) END_IMGUI_FUNC // IMGUI_API void UpdateTextureID(); IMGUI_FUNCTION_DRAW_LIST(UpdateTextureID) DRAW_LIST_CALL_FUNCTION_NO_RET(UpdateTextureID) END_IMGUI_FUNC //struct ImDrawData //struct ImFontConfig //struct ImFontGlyph //enum ImFontAtlasFlags_ //struct ImFontAtlas //struct ImFont ================================================ FILE: imgui_lua_bindings.cpp ================================================ #include #include #include extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" } // THIS IS FOR LUA 5.3 although you can make a few changes for other versions // define ENABLE_IM_LUA_END_STACK // to keep track of end and begins and clean up the imgui stack // if lua errors // define this global before you call RunString or LoadImGuiBindings lua_State* lState; #ifdef ENABLE_IM_LUA_END_STACK // Stack for imgui begin and end std::deque endStack; static void AddToStack(int type) { endStack.push_back(type); } static void PopEndStack(int type) { if (!endStack.empty()) { endStack.pop_back(); // hopefully the type matches } } static void ImEndStack(int type); #endif // Example lua run string function // returns NULL on success and error string on error const char * RunString(const char* szLua) { if (!lState) { fprintf(stderr, "You didn't assign the global lState, either assign that or refactor LoadImguiBindings and RunString\n"); } int iStatus = luaL_loadstring(lState, szLua); if(iStatus) { return lua_tostring(lState, -1); //fprintf(stderr, "Lua syntax error: %s\n", lua_tostring(lState, -1)); //return; } #ifdef ENABLE_IM_LUA_END_STACK endStack.clear(); #endif iStatus = lua_pcall( lState, 0, 0, 0 ); #ifdef ENABLE_IM_LUA_END_STACK bool wasEmpty = endStack.empty(); while(!endStack.empty()) { ImEndStack(endStack.back()); endStack.pop_back(); } #endif if( iStatus ) { return lua_tostring(lState, -1); //fprintf(stderr, "Error: %s\n", lua_tostring( lState, -1 )); //return; } #ifdef ENABLE_IM_LUA_END_STACK else if (!wasEmpty) { return "Script didn't clean up imgui stack properly"; } #endif return NULL; } #define IMGUI_FUNCTION_DRAW_LIST(name) \ static int impl_draw_list_##name(lua_State *L) { \ int max_args = lua_gettop(L); \ int arg = 1; \ int stackval = 0; #define IMGUI_FUNCTION(name) \ static int impl_##name(lua_State *L) { \ int max_args = lua_gettop(L); \ int arg = 1; \ int stackval = 0; // I use OpenGL so this is a GLuint // Using unsigned int cause im lazy don't copy me #define IM_TEXTURE_ID_ARG(name) \ const ImTextureID name = (ImTextureID)luaL_checkinteger(L, arg++); #define OPTIONAL_LABEL_ARG(name) \ const char* name; \ if (arg <= max_args) { \ name = lua_tostring(L, arg++); \ } else { \ name = NULL; \ } #define LABEL_ARG(name) \ size_t i_##name##_size; \ const char * name = luaL_checklstring(L, arg++, &(i_##name##_size)); #define IM_VEC_2_ARG(name)\ const lua_Number i_##name##_x = luaL_checknumber(L, arg++); \ const lua_Number i_##name##_y = luaL_checknumber(L, arg++); \ const ImVec2 name((double)i_##name##_x, (double)i_##name##_y); #define OPTIONAL_IM_VEC_2_ARG(name, x, y) \ lua_Number i_##name##_x = x; \ lua_Number i_##name##_y = y; \ if (arg <= max_args - 1) { \ i_##name##_x = luaL_checknumber(L, arg++); \ i_##name##_y = luaL_checknumber(L, arg++); \ } \ const ImVec2 name((double)i_##name##_x, (double)i_##name##_y); #define IM_VEC_4_ARG(name) \ const lua_Number i_##name##_x = luaL_checknumber(L, arg++); \ const lua_Number i_##name##_y = luaL_checknumber(L, arg++); \ const lua_Number i_##name##_z = luaL_checknumber(L, arg++); \ const lua_Number i_##name##_w = luaL_checknumber(L, arg++); \ const ImVec4 name((double)i_##name##_x, (double)i_##name##_y, (double)i_##name##_z, (double)i_##name##_w); #define OPTIONAL_IM_VEC_4_ARG(name, x, y, z, w) \ lua_Number i_##name##_x = x; \ lua_Number i_##name##_y = y; \ lua_Number i_##name##_z = z; \ lua_Number i_##name##_w = w; \ if (arg <= max_args - 1) { \ i_##name##_x = luaL_checknumber(L, arg++); \ i_##name##_y = luaL_checknumber(L, arg++); \ i_##name##_z = luaL_checknumber(L, arg++); \ i_##name##_w = luaL_checknumber(L, arg++); \ } \ const ImVec4 name((double)i_##name##_x, (double)i_##name##_y, (double)i_##name##_z, (double)i_##name##_w); #define NUMBER_ARG(name)\ lua_Number name = luaL_checknumber(L, arg++); #define OPTIONAL_NUMBER_ARG(name, otherwise)\ lua_Number name = otherwise; \ if (arg <= max_args) { \ name = lua_tonumber(L, arg++); \ } #define FLOAT_POINTER_ARG(name) \ float i_##name##_value = luaL_checknumber(L, arg++); \ float* name = &(i_##name##_value); #define END_FLOAT_POINTER(name) \ if (name != NULL) { \ lua_pushnumber(L, i_##name##_value); \ stackval++; \ } #define OPTIONAL_INT_ARG(name, otherwise)\ int name = otherwise; \ if (arg <= max_args) { \ name = (int)lua_tonumber(L, arg++); \ } #define INT_ARG(name) \ const int name = (int)luaL_checknumber(L, arg++); #define OPTIONAL_UINT_ARG(name, otherwise)\ unsigned int name = otherwise; \ if (arg <= max_args) { \ name = (unsigned int)lua_tounsigned(L, arg++); \ } #define UINT_ARG(name) \ const unsigned int name = (unsigned int)luaL_checkinteger(L, arg++); #define INT_POINTER_ARG(name) \ int i_##name##_value = (int)luaL_checkinteger(L, arg++); \ int* name = &(i_##name##_value); #define END_INT_POINTER(name) \ if (name != NULL) { \ lua_pushnumber(L, i_##name##_value); \ stackval++; \ } #define UINT_POINTER_ARG(name) \ unsigned int i_##name##_value = (unsigned int)luaL_checkinteger(L, arg++); \ unsigned int* name = &(i_##name##_value); #define END_UINT_POINTER(name) \ if (name != NULL) { \ lua_pushnumber(L, i_##name##_value); \ stackval++; \ } #define BOOL_POINTER_ARG(name) \ bool i_##name##_value = lua_toboolean(L, arg++); \ bool* name = &(i_##name##_value); #define OPTIONAL_BOOL_POINTER_ARG(name) \ bool i_##name##_value; \ bool* name = NULL; \ if (arg <= max_args) { \ i_##name##_value = lua_toboolean(L, arg++); \ name = &(i_##name##_value); \ } #define OPTIONAL_BOOL_ARG(name, otherwise) \ bool name = otherwise; \ if (arg <= max_args) { \ name = lua_toboolean(L, arg++); \ } #define BOOL_ARG(name) \ bool name = lua_toboolean(L, arg++); #define CALL_FUNCTION(name, retType,...) \ retType ret = ImGui::name(__VA_ARGS__); #define DRAW_LIST_CALL_FUNCTION(name, retType,...) \ retType ret = ImGui::GetWindowDrawList()->name(__VA_ARGS__); #define CALL_FUNCTION_NO_RET(name, ...) \ ImGui::name(__VA_ARGS__); #define DRAW_LIST_CALL_FUNCTION_NO_RET(name, ...) \ ImGui::GetWindowDrawList()->name(__VA_ARGS__); #define PUSH_STRING(name) \ lua_pushstring(L, name); \ stackval++; #define PUSH_NUMBER(name) \ lua_pushnumber(L, name); \ stackval++; #define PUSH_BOOL(name) \ lua_pushboolean(L, (int) name); \ stackval++; #define END_BOOL_POINTER(name) \ if (name != NULL) { \ lua_pushboolean(L, (int)i_##name##_value); \ stackval++; \ } #define END_IMGUI_FUNC \ return stackval; \ } #ifdef ENABLE_IM_LUA_END_STACK #define IF_RET_ADD_END_STACK(type) \ if (ret) { \ AddToStack(type); \ } #define ADD_END_STACK(type) \ AddToStack(type); #define POP_END_STACK(type) \ PopEndStack(type); #define END_STACK_START \ static void ImEndStack(int type) { \ switch(type) { #define END_STACK_OPTION(type, function) \ case type: \ ImGui::function(); \ break; #define END_STACK_END \ } \ } #else #define END_STACK_START #define END_STACK_OPTION(type, function) #define END_STACK_END #define IF_RET_ADD_END_STACK(type) #define ADD_END_STACK(type) #define POP_END_STACK(type) #endif #define START_ENUM(name) #define MAKE_ENUM(c_name,lua_name) #define END_ENUM(name) #include "imgui_iterator.inl" static const struct luaL_Reg imguilib [] = { #undef IMGUI_FUNCTION #define IMGUI_FUNCTION(name) {#name, impl_##name}, #undef IMGUI_FUNCTION_DRAW_LIST #define IMGUI_FUNCTION_DRAW_LIST(name) {"DrawList_" #name, impl_draw_list_##name}, // These defines are just redefining everything to nothing so // we can get the function names #undef IM_TEXTURE_ID_ARG #define IM_TEXTURE_ID_ARG(name) #undef OPTIONAL_LABEL_ARG #define OPTIONAL_LABEL_ARG(name) #undef LABEL_ARG #define LABEL_ARG(name) #undef IM_VEC_2_ARG #define IM_VEC_2_ARG(name) #undef OPTIONAL_IM_VEC_2_ARG #define OPTIONAL_IM_VEC_2_ARG(name, x, y) #undef IM_VEC_4_ARG #define IM_VEC_4_ARG(name) #undef OPTIONAL_IM_VEC_4_ARG #define OPTIONAL_IM_VEC_4_ARG(name, x, y, z, w) #undef NUMBER_ARG #define NUMBER_ARG(name) #undef OPTIONAL_NUMBER_ARG #define OPTIONAL_NUMBER_ARG(name, otherwise) #undef FLOAT_POINTER_ARG #define FLOAT_POINTER_ARG(name) #undef END_FLOAT_POINTER #define END_FLOAT_POINTER(name) #undef OPTIONAL_INT_ARG #define OPTIONAL_INT_ARG(name, otherwise) #undef INT_ARG #define INT_ARG(name) #undef OPTIONAL_UINT_ARG #define OPTIONAL_UINT_ARG(name, otherwise) #undef UINT_ARG #define UINT_ARG(name) #undef INT_POINTER_ARG #define INT_POINTER_ARG(name) #undef END_INT_POINTER #define END_INT_POINTER(name) #undef UINT_POINTER_ARG #define UINT_POINTER_ARG(name) #undef END_UINT_POINTER #define END_UINT_POINTER(name) #undef BOOL_POINTER_ARG #define BOOL_POINTER_ARG(name) #undef OPTIONAL_BOOL_POINTER_ARG #define OPTIONAL_BOOL_POINTER_ARG(name) #undef OPTIONAL_BOOL_ARG #define OPTIONAL_BOOL_ARG(name, otherwise) #undef BOOL_ARG #define BOOL_ARG(name) #undef CALL_FUNCTION #define CALL_FUNCTION(name, retType, ...) #undef DRAW_LIST_CALL_FUNCTION #define DRAW_LIST_CALL_FUNCTION(name, retType, ...) #undef CALL_FUNCTION_NO_RET #define CALL_FUNCTION_NO_RET(name, ...) #undef DRAW_LIST_CALL_FUNCTION_NO_RET #define DRAW_LIST_CALL_FUNCTION_NO_RET(name, ...) #undef PUSH_STRING #define PUSH_STRING(name) #undef PUSH_NUMBER #define PUSH_NUMBER(name) #undef PUSH_BOOL #define PUSH_BOOL(name) #undef END_BOOL_POINTER #define END_BOOL_POINTER(name) #undef END_IMGUI_FUNC #define END_IMGUI_FUNC #undef END_STACK_START #define END_STACK_START #undef END_STACK_OPTION #define END_STACK_OPTION(type, function) #undef END_STACK_END #define END_STACK_END #undef IF_RET_ADD_END_STACK #define IF_RET_ADD_END_STACK(type) #undef ADD_END_STACK #define ADD_END_STACK(type) #undef POP_END_STACK #define POP_END_STACK(type) #undef START_ENUM #define START_ENUM(name) #undef MAKE_ENUM #define MAKE_ENUM(c_name,lua_name) #undef END_ENUM #define END_ENUM(name) #include "imgui_iterator.inl" {"Button", impl_Button}, {NULL, NULL} }; static void PushImguiEnums(lua_State* lState, const char* tableName) { lua_pushstring(lState, tableName); lua_newtable(lState); #undef START_ENUM #undef MAKE_ENUM #undef END_ENUM #define START_ENUM(name) \ lua_pushstring(lState, #name); \ lua_newtable(lState); \ { \ int i = 1; #define MAKE_ENUM(c_name,lua_name) \ lua_pushstring(lState, #lua_name); \ lua_pushnumber(lState, c_name); \ lua_rawset(lState, -3); #define END_ENUM(name) \ } \ lua_rawset(lState, -3); // These defines are just redefining everything to nothing so // we get only the enums. #undef IMGUI_FUNCTION #define IMGUI_FUNCTION(name) #undef IMGUI_FUNCTION_DRAW_LIST #define IMGUI_FUNCTION_DRAW_LIST(name) #undef IM_TEXTURE_ID_ARG #define IM_TEXTURE_ID_ARG(name) #undef OPTIONAL_LABEL_ARG #define OPTIONAL_LABEL_ARG(name) #undef LABEL_ARG #define LABEL_ARG(name) #undef IM_VEC_2_ARG #define IM_VEC_2_ARG(name) #undef OPTIONAL_IM_VEC_2_ARG #define OPTIONAL_IM_VEC_2_ARG(name, x, y) #undef IM_VEC_4_ARG #define IM_VEC_4_ARG(name) #undef OPTIONAL_IM_VEC_4_ARG #define OPTIONAL_IM_VEC_4_ARG(name, x, y, z, w) #undef NUMBER_ARG #define NUMBER_ARG(name) #undef OPTIONAL_NUMBER_ARG #define OPTIONAL_NUMBER_ARG(name, otherwise) #undef FLOAT_POINTER_ARG #define FLOAT_POINTER_ARG(name) #undef END_FLOAT_POINTER #define END_FLOAT_POINTER(name) #undef OPTIONAL_INT_ARG #define OPTIONAL_INT_ARG(name, otherwise) #undef INT_ARG #define INT_ARG(name) #undef OPTIONAL_UINT_ARG #define OPTIONAL_UINT_ARG(name, otherwise) #undef UINT_ARG #define UINT_ARG(name) #undef INT_POINTER_ARG #define INT_POINTER_ARG(name) #undef END_INT_POINTER #define END_INT_POINTER(name) #undef UINT_POINTER_ARG #define UINT_POINTER_ARG(name) #undef END_UINT_POINTER #define END_UINT_POINTER(name) #undef BOOL_POINTER_ARG #define BOOL_POINTER_ARG(name) #undef OPTIONAL_BOOL_POINTER_ARG #define OPTIONAL_BOOL_POINTER_ARG(name) #undef OPTIONAL_BOOL_ARG #define OPTIONAL_BOOL_ARG(name, otherwise) #undef BOOL_ARG #define BOOL_ARG(name) #undef CALL_FUNCTION #define CALL_FUNCTION(name, retType, ...) #undef DRAW_LIST_CALL_FUNCTION #define DRAW_LIST_CALL_FUNCTION(name, retType, ...) #undef CALL_FUNCTION_NO_RET #define CALL_FUNCTION_NO_RET(name, ...) #undef DRAW_LIST_CALL_FUNCTION_NO_RET #define DRAW_LIST_CALL_FUNCTION_NO_RET(name, ...) #undef PUSH_STRING #define PUSH_STRING(name) #undef PUSH_NUMBER #define PUSH_NUMBER(name) #undef PUSH_BOOL #define PUSH_BOOL(name) #undef END_BOOL_POINTER #define END_BOOL_POINTER(name) #undef END_IMGUI_FUNC #define END_IMGUI_FUNC #undef END_STACK_START #define END_STACK_START #undef END_STACK_OPTION #define END_STACK_OPTION(type, function) #undef END_STACK_END #define END_STACK_END #undef IF_RET_ADD_END_STACK #define IF_RET_ADD_END_STACK(type) #undef ADD_END_STACK #define ADD_END_STACK(type) #undef POP_END_STACK #define POP_END_STACK(type) #include "imgui_iterator.inl" lua_rawset(lState, -3); }; void LoadImguiBindings() { if (!lState) { fprintf(stderr, "You didn't assign the global lState, either assign that or refactor LoadImguiBindings and RunString\n"); } lua_newtable(lState); luaL_setfuncs(lState, imguilib, 0); PushImguiEnums(lState, "constant"); lua_setglobal(lState, "imgui"); } ================================================ FILE: parse_blocks.pl ================================================ ##!/usr/bin/perl #use strict; #use warnings; #use diagnostics; # #my ($blocksref, $blocknamesref) = parse_blocks(); # #my @blocks = @$blocksref; #my @blocknames = @$blocknamesref; # #my $name; #my $block; #foreach $name (@blocknames) { # print "BLOCKNAME" . $name; #} # #foreach $block (@blocks) { # print "---------------BLOCK START-----------\n"; # print $block; # print "---------------BLOCK END -------------\n" #} # WARNING THIS FUNCTION WILL MESS UP ALL OF PARSING IF IT SEES # A DIFFERENT NUMBER OF BLOCKNAMES AS BLOCKS... # TODO FIX THIS ^ #returns list of string blocks from stdin sub does_line_match_end_block { my $line = shift; # Make sure you take into account random whitespace that could happen by using [ ]*[\t]* my $match = 0; $match |= $line =~ m/^};[ ]*[\t]*\/\//; # Semicolon, comment $match |= $line =~ m/^};[ ]*[\t]*$/; # Semicolon, no comment $match |= $line =~ m/^}[ ]*[\t]*\/\//; # No semicolon, comment $match |= $line =~ m/^}[ ]*[\t]*$/; # No semicolon, no comment return $match; } sub does_line_match_begin_block { my $line = shift; my $match = 0; $match |= $line =~ m/^{[ ]*[\t]*$/; return $match } sub parse_blocks { my @blocks; my @blocknames; my $lastline; my $curBlock; while (my $line = ) { if (does_line_match_begin_block($line)) { push @blocknames, $lastline; $curBlock = ""; next; } if (does_line_match_end_block($line)) { push @blocks, $curBlock; # Enforce the invariant that we should have the same number of elements in blocks / block names if (scalar @blocks != scalar @blocknames) { print STDERR "The parser did a bad and has mismatched block open / close."; print STDERR "This is probably a problem with the regular expression that matches block open and close."; die } $curBlock = ""; next; } $curBlock .= $line . "\n"; $lastline = $line; } return (\@blocks, \@blocknames); } 1;