Compare commits

...

88 Commits
1.79 ... 1.81

Author SHA1 Message Date
Victor Bombi
25aa25bd83 Merge branch 'docking_inter' 2021-02-11 14:58:25 +01:00
Victor Bombi
41b397020a readme update 2021-02-11 14:50:09 +01:00
Victor Bombi
c1890d4c00 pull imgui docking 1.81 2021-02-11 10:32:01 +01:00
Victor Bombi
7756c4f53f pull imgui docking 1.81 and generate 2021-02-11 10:31:31 +01:00
Victor Bombi
ba9ec30e64 Merge branch 'docking_inter' 2021-02-05 18:12:21 +01:00
Victor Bombi
2638737f2c cpp2ffi: parse_enum_value drop outer () (ImGuizmo needed it) 2021-02-05 18:04:22 +01:00
Victor Bombi
6aa3f1decd cpp2ffi: const char* versions of ImStr take now a postfix _Strv 2021-02-05 16:06:10 +01:00
Victor Bombi
bc708a092d cpp2ffi: char* -> Str, ImStr -> STR for backward compability 2021-02-05 16:06:10 +01:00
Victor Bombi
9ac7cd93e1 test, backend_test adapt to new naming 2021-02-05 16:06:10 +01:00
Victor Bombi
2838c0317a cpp2ffi: changes for name prefixing the const char* versions of ImStr 2021-02-05 16:06:09 +01:00
Victor Bombi
c57efd953f cpp2ffi: dont expect const ImStr 2021-02-05 16:06:09 +01:00
Victor Bombi
a48009b062 test and backend_test modifications for IMGUI_HAS_IMSTR 2021-02-05 16:06:09 +01:00
Victor Bombi
383ebf3a7a cpp2ffi: ADDiMSTR_S before overload naming and copy defaults, overload_Algo improvement 2021-02-05 16:06:09 +01:00
Victor Bombi
afdbb6b799 test and backend_test prepared for IMGUI_HAS_IMSTR 2021-02-05 16:06:09 +01:00
Victor Bombi
a64de2e303 cpp2ffi: add ADDIMSTR_S function for making const char* versions of ImStr arguments 2021-02-05 16:06:09 +01:00
Victor Bombi
a9928295db generator: keep IMGUI_HAS_IMSTR definition 2021-02-05 16:06:09 +01:00
Victor Bombi
ce239ed53f cpp2ffi: overload naming char* -> Chpt (was Str) avoids clash with ImStr - > Str 2021-02-05 16:06:09 +01:00
Victor Bombi
6791a95f79 Merge branch 'docking_inter' 2021-01-27 10:54:09 +01:00
Victor Bombi
86112e0b45 generation 2021-01-27 10:48:46 +01:00
Victor Bombi
c4d1f5423e generator: replace FLT_MIN in substring 2021-01-27 10:48:25 +01:00
Victor Bombi
36e0d7a41e generator: take care of FLT_MIN 2021-01-27 10:21:07 +01:00
Victor Bombi
1bdfc0964e pull submodule imgui master 2021-01-24 13:15:57 +01:00
Victor Bombi
7b9f0c7499 pull imgui master and generate 2021-01-24 11:34:52 +01:00
Victor Bombi
0d96f60b80 pull imgui 1.80 docking and generate 2021-01-22 11:09:18 +01:00
Victor Bombi
3eec69f133 generator.lua: correctly detect IMGUI_HAS_DOCK 2021-01-22 11:07:21 +01:00
Victor Bombi
ab67137994 gitmodules: set correct branch for docking 2021-01-10 20:01:54 +01:00
Victor Bombi
7d5f753a9d pull imgui docking and regenerate 2020-12-23 10:13:02 +01:00
Victor Bombi
3b563153fd readme: update readme cloning 2020-12-23 10:05:01 +01:00
Victor Bombi
7f4ca76e37 Merge branch 'docking_inter' 2020-12-17 13:07:25 +01:00
Victor Bombi
6047c638c4 cpp2ffi: take_lines drop spaces after line (needed by cl) fixes #171 2020-12-17 13:05:54 +01:00
Victor Bombi
414ad3f8f4 Merge branch 'docking_inter' 2020-12-15 11:41:00 +01:00
Victor Bombi
a21c31f123 generator: detect IMGUI_HAS_DOCK and keep it in cimgui.h 2020-12-15 11:33:30 +01:00
Victor Bombi
99611664b7 Merge branch 'docking_inter' 2020-12-14 18:00:16 +01:00
Victor Bombi
45aada6ecb preparation for 1.80 with imgui_tables.cpp addition and 8bytes enum values 2020-12-14 17:57:47 +01:00
Victor Bombi
98bfe43755 Merge branch 'docking_inter' 2020-12-05 14:06:52 +01:00
Victor Bombi
4a4c804ad9 add TODO.txt 2020-12-05 14:05:29 +01:00
Victor Bombi
48c97106cc Merge branch 'docking_inter' 2020-12-01 16:35:11 +01:00
Victor Bombi
e417e3500b cpp2ffi: only use ftemplate_list if ftemplate_list[ttype] is defined (needed by implot_internal) 2020-12-01 12:35:43 +01:00
Victor Bombi
ee5534d7cd Merge branch 'docking_inter' 2020-10-30 15:37:48 +01:00
Victor Bombi
54cfcabdde correct readme 2020-10-30 15:36:17 +01:00
Victor Bombi
e0279fa53d Merge branch 'docking_inter' 2020-10-30 15:34:38 +01:00
M. Frink ~ Lemur
43bfbe227d Fixed typo 2020-10-30 15:31:53 +01:00
M. Frink ~ Lemur
2a6970b50b Fixed typo 2020-10-30 15:31:53 +01:00
Micon Frink
507e19bc7e adding documentation 2020-10-30 15:31:53 +01:00
Micon Frink
3f2e6f40df added a ternary to check for cl so that we don't have problems with Linux absolute paths... 2020-10-30 15:31:53 +01:00
Micon Frink
be7bb9a72e forgot to add the CFLAGS to to the actual calls. Also realized that we really should process the cl calls so fixed that too. 2020-10-30 15:31:53 +01:00
Micon Frink
fc677cb849 adding flags to generator.lua 2020-10-30 15:31:53 +01:00
Victor Bombi
aa1b438f7f Merge pull request #165 from frink/flags
Adding CFLAGS to generator.lua
2020-10-29 20:37:34 +01:00
M. Frink ~ Lemur
9828871a89 Fixed typo 2020-10-29 12:28:40 -05:00
M. Frink ~ Lemur
236c296049 Fixed typo 2020-10-29 12:26:36 -05:00
Micon Frink
3b01e79d6d adding documentation 2020-10-29 16:31:38 +00:00
Victor Bombi
ebfa448e25 Merge branch 'docking_inter' 2020-10-28 17:52:30 +01:00
Victor Bombi
0704912579 cpp2ffi: get_parents_nameC correction 2020-10-28 17:51:16 +01:00
Micon Frink
06f3c006c3 added a ternary to check for cl so that we don't have problems with Linux absolute paths... 2020-10-28 06:31:32 +00:00
Micon Frink
5c469cca4e forgot to add the CFLAGS to to the actual calls. Also realized that we really should process the cl calls so fixed that too. 2020-10-28 06:19:41 +00:00
Micon Frink
7d6fdb66bb adding flags to generator.lua 2020-10-28 05:44:57 +00:00
Victor Bombi
e1ea75be6e Merge branch 'docking_inter' 2020-10-27 15:05:36 +01:00
Victor Bombi
c46a2eded6 cpp2ffi: parseFunction receives nested namespace name (ImNodes needs it) 2020-10-27 15:03:53 +01:00
Victor Bombi
756ce6330a Merge branch 'docking_inter' 2020-10-27 12:35:15 +01:00
Victor Bombi
4e5d12e86e cpp2ffi: take care of template different of typename, generator: ImSpan template generation 2020-10-27 12:32:44 +01:00
Victor Bombi
bb0cb8090a Merge branch 'docking_inter' 2020-10-24 16:46:33 +02:00
Victor Bombi
9cb4b4f63c detect backends folder in generator and backend_test 2020-10-24 16:41:57 +02:00
Oleh Prypin
a97c90ec4f Add crystal-imgui as an example binding 2020-10-19 18:21:53 +02:00
Victor Bombi
b50e8c0d85 Merge pull request #161 from oprypin/patch-1
Add crystal-imgui as an example binding
2020-10-19 18:19:45 +02:00
Oleh Prypin
ad5580b5d7 Add crystal-imgui as an example binding 2020-10-19 18:06:47 +02:00
Victor Bombi
a1f2cef9d3 readme: correct links 2020-10-19 17:42:32 +02:00
Victor Bombi
75a27d5e34 readme: correct links 2020-10-19 17:39:51 +02:00
Marcelo Silva Nascimento Mancini
59e4829b4b Add bindbc-cimgui as an example binding
DerelictImGui is too old for the state ImGui is right now, so I made  a binding which is -betterC switch compatible with D and it is updated to the 1.79 version which I'll be supporting for a great time
2020-10-19 17:36:51 +02:00
Victor Bombi
7aa18d11a1 Merge pull request #160 from MrcSnm/patch-1
Add bindbc-cimgui as an example binding
2020-10-19 17:35:22 +02:00
Marcelo Silva Nascimento Mancini
b26f477c20 Add bindbc-cimgui as an example binding
DerelictImGui is too old for the state ImGui is right now, so I made  a binding which is -betterC switch compatible with D and it is updated to the 1.79 version which I'll be supporting for a great time
2020-10-19 08:10:02 -07:00
Victor Bombi
33fb5eb309 readme: explain defaults of generator, change implementations by backends 2020-10-19 16:41:13 +02:00
Victor Bombi
3700abd326 readme: explain defaults of generator, change implementations by backends 2020-10-19 16:25:21 +02:00
Victor Bombi
16609ed627 Merge branch 'master' into docking_inter 2020-10-19 10:17:32 +02:00
Victor Bombi
87158fa6b4 Merge pull request #159 from MrcSnm/master
Added another check for null sdl include on backend_test
2020-10-19 10:14:05 +02:00
Hipreme
7ce241d5d8 Added another check for null sdl include 2020-10-18 15:31:43 -03:00
Victor Bombi
44af224530 repair docking branch (some merge commit broke it) 2020-10-18 19:46:25 +02:00
Victor Bombi
213086639f backend_test: make mingw with SDL have console output 2020-10-18 19:39:29 +02:00
Victor Bombi
5bd8981f19 backend_test: make mingw with SDL have console output 2020-10-18 19:32:26 +02:00
Victor Bombi
bd89e83f70 Merge branch 'docking_inter' 2020-10-18 15:14:30 +02:00
Victor Bombi
1f5590c0b0 backend_test/main: include windows.h for GL in MSVC 2020-10-18 13:51:37 +02:00
Victor Bombi
8eff25b5ee backend_test: main dont uses USE_DOCKING in master branch 2020-10-16 17:35:40 +02:00
Victor Bombi
31bc8389d3 Merge branch 'docking_inter' 2020-10-16 17:33:50 +02:00
Victor Bombi
64ed803093 backend_test: dont use glw3 loader on main, add USE_DOCKING define 2020-10-16 17:33:05 +02:00
Victor Bombi
e58ac87fba Merge branch 'docking_inter' 2020-10-16 16:30:42 +02:00
Victor Bombi
c1a4efeb10 README.md updated with backend_test info 2020-10-16 16:29:47 +02:00
Victor Bombi
9b6769e810 Merge branch 'docking_inter' 2020-10-16 16:17:35 +02:00
Victor Bombi
5a5ac45e55 add backend_test for sdl2 opengl3 2020-10-16 15:56:11 +02:00
Victor Bombi
c5a3820d02 pull imgui docking 1.79 and generate 2020-10-09 16:51:44 +02:00
28 changed files with 15011 additions and 4190 deletions

1
.gitmodules vendored
View File

@@ -1,3 +1,4 @@
[submodule "imgui"]
path = imgui
url = https://github.com/ocornut/imgui.git
branch = master

View File

@@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.1)
project(cimgui)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui_tables.cpp)
set(TABLES_SOURCE "imgui/imgui_tables.cpp")
else()
set(TABLES_SOURCE "")
endif()
#general settings
file(GLOB IMGUI_SOURCES
cimgui.cpp
@@ -9,6 +16,7 @@ file(GLOB IMGUI_SOURCES
imgui/imgui_draw.cpp
imgui/imgui_demo.cpp
imgui/imgui_widgets.cpp
${TABLES_SOURCE}
)
set(IMGUI_STATIC "no" CACHE STRING "Build as a static library")

View File

@@ -11,9 +11,9 @@ History:
Initially cimgui was developed by Stephan Dilly as hand-written code but lately turned into an auto-generated version by sonoro1234 in order to keep up with imgui more easily (letting the user select the desired branch and commit)
Notes:
* currently this wrapper is based on version [1.79 of Dear ImGui with internal api]
* currently this wrapper is based on version [1.81 of Dear ImGui with internal api]
* only functions, structs and enums from imgui.h (an optionally imgui_internal.h) are wrapped.
* if you are interested in imgui implementations you should look [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui) project.
* if you are interested in imgui backends you should look [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui) project.
* All naming is algorithmic except for those names that were coded in cimgui_overloads table (https://github.com/cimgui/cimgui/blob/master/generator/generator.lua#L60). In the official version this table is empty.
* Current overloaded function names can be found in (https://github.com/cimgui/cimgui/blob/master/generator/output/overloads.txt)
@@ -21,22 +21,27 @@ Notes:
* clone
* `git clone --recursive https://github.com/cimgui/cimgui.git`
* `git submodule update`
* `git submodule update --init --recursive` (If already cloned)
* compile
* using makefile on linux/macOS/mingw (Or use CMake to generate project)
* cmake options are IMGUI_STATIC (compiling as static library), IMGUI_FREETYPE (for using Freetype2) and FREETYPE_PATH (Freetype2 cmake install location)
* or as in https://github.com/sonoro1234/LuaJIT-ImGui/tree/master/build
For compiling with backends there is now an example with SDL2 and opengl3 in folder backend_test. It will generate a cimgui_sdl module and a test_sdl executable. You only need to provide SDL_PATH telling cmake where to look for SDL2 cmake installation.
# using generator
* this is only needed (before compilation) if you want an imgui version different from the one provided, otherwise generation is already done.
* you will need LuaJIT (https://github.com/LuaJIT/LuaJIT.git better 2.1 branch) or precompiled for linux/macOS/windows in https://luapower.com/luajit/download
* you need to use also a C++ compiler for doing preprocessing: gcc (In windows MinGW-W64-builds for example), clang or cl (MSVC). (this repo was done with gcc)
* update `imgui` folder to the version you desire.
* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, or cl and to choose desired implementations and whether imgui_internal is generated or not and Freetype2 is used or not.
* edit config_generator.lua for adding includes needed by your chosen implementations (vulkan needs that).
* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, or cl and to choose desired backends and whether imgui_internal is generated or not and Freetype2 is used or not.
* the defaults of generator are gcc as compiler, imgui_internal included and sdl, glfw, opengl2 and opengl3 as backends.
* edit config_generator.lua for adding includes needed by your chosen backends (vulkan needs that).
* Run generator.bat or generator.sh with gcc, clang or cl and LuaJIT on your PATH.
* as a result some files are generated: `cimgui.cpp` and `cimgui.h` for compiling and some lua/json files with information about the binding: `definitions.json` with function info, `structs_and_enums.json` with struct and enum info, `impl_definitions.json` with functions from the implementations info.
* as a result some files are generated: `cimgui.cpp`, `cimgui.h` and `cimgui_impl.h` for compiling and some lua/json files with information about the binding: `definitions.json` with function info, `structs_and_enums.json` with struct and enum info, `impl_definitions.json` with functions from the backends info.
* You can pass compiler flags to generator.sh or generator.bat at the end of the call to further specify the compiler behavior. (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
# generate binding
* C interface is exposed by cimgui.h when you define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
@@ -86,6 +91,10 @@ Notes:
* functions that belong to a struct have an extra first argument with a pointer to the struct.
* where a function returns UDT (user defined type) by value some compilers complain so the function is generated accepting a pointer to the UDT type as the first argument (or second if belongs to a struct).
# usage with backends
* look at backend_test folder for a cmake module building with SDL and opengl3.
# example bindings based on cimgui
* [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui)
@@ -95,12 +104,14 @@ Notes:
* [CImGui.jl](https://github.com/Gnimuc/CImGui.jl)
* [odin-imgui](https://github.com/ThisDrunkDane/odin-imgui)
* [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
* [BindBC-CimGui](https://github.com/MrcSnm/bindbc-cimgui)
* [imgui-rs](https://github.com/Gekkio/imgui-rs)
* [imgui-pas](https://github.com/dpethes/imgui-pas)
* [crystal-imgui](https://github.com/oprypin/crystal-imgui)
# C examples based on cimgui
* [sdl2_opengl3](https://github.com/cimgui/cimgui/tree/docking_inter/backend_test)
* [sdl2-cimgui-demo](https://github.com/haxpor/sdl2-cimgui-demo)
* [cimgui_c_sdl2_example](https://github.com/canoi12/cimgui_c_sdl2_example/)
* [cimgui-c-example](https://github.com/peko/cimgui-c-example) with GLFW

5
TODO.txt Normal file
View File

@@ -0,0 +1,5 @@
- Being able to use a prefix for structs and enums. Could be a manual dictionary or an option to take parent namespace and struct (https://github.com/rokups/ImNodes/pull/20#issuecomment-719713982)
- Being able to generate separate headers for imgui and imgui_internal. (https://github.com/cimgui/cimgui/pull/126#issuecomment-735674105)

View File

@@ -0,0 +1,98 @@
Project(cimgui_sdl)
cmake_minimum_required(VERSION 2.8)
if(WIN32) #to mingw work as all the others
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif(WIN32)
#general settings
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../imgui/backends)
set(BAKENDS_FOLDER "../imgui/backends/")
else()
set(BAKENDS_FOLDER "../imgui/examples/")
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../imgui/imgui_tables.cpp)
set(TABLES_SOURCE "../imgui/imgui_tables.cpp")
else()
set(TABLES_SOURCE "")
endif()
include_directories(../imgui)
add_definitions("-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1")
include_directories(../)
set(IMGUI_SOURCES ../cimgui.cpp
../imgui/imgui.cpp
../imgui/imgui_draw.cpp
../imgui/imgui_demo.cpp
../imgui/imgui_widgets.cpp
${TABLES_SOURCE}
)
set(IMGUI_SOURCES_sdl)
set(IMGUI_LIBRARIES )
if (WIN32)
add_definitions("-DIMGUI_IMPL_API=extern \"C\" __declspec\(dllexport\)")
else(WIN32)
add_definitions("-DIMGUI_IMPL_API=extern \"C\" ")
endif(WIN32)
add_compile_definitions("IMGUI_IMPL_OPENGL_LOADER_GL3W")
#optional adding freetype
option(IMGUI_FREETYPE "add Freetype2" OFF)
if(IMGUI_FREETYPE)
FIND_PACKAGE(freetype REQUIRED PATHS ${FREETYPE_PATH})
list(APPEND IMGUI_LIBRARIES freetype)
list(APPEND IMGUI_SOURCES ../imgui/misc/freetype/imgui_freetype.cpp)
add_definitions("-DCIMGUI_FREETYPE=1")
endif(IMGUI_FREETYPE)
#opengl3
list(APPEND IMGUI_SOURCES ${BAKENDS_FOLDER}imgui_impl_opengl3.cpp ../imgui/examples/libs/gl3w/GL/gl3w.c)
list(APPEND IMGUI_SOURCES ./cimgui_extras.cpp)
include_directories(../imgui/examples/libs/gl3w)
if(WIN32)
list(APPEND IMGUI_LIBRARIES opengl32)
else(WIN32)#Unix
list(APPEND IMGUI_LIBRARIES GL)
endif(WIN32)
#sdl2
list(APPEND IMGUI_SOURCES ${BAKENDS_FOLDER}imgui_impl_sdl.cpp)
if(DEFINED SDL_PATH)
message(STATUS "SDL_PATH defined as " ${SDL_PATH})
FIND_PACKAGE(SDL2 REQUIRED PATHS ${SDL_PATH})
get_target_property(SDL_INCLUDE SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "sdlinclude is " ${SDL_INCLUDE})
if ("${SDL_INCLUDE}" STREQUAL "" OR "${SDL_INCLUDE}" STREQUAL "SDL_INCLUDE-NOTFOUND") #if not found latest SDL2 cmake config use older
message(STATUS "sdlinclude2 is " ${SDL2_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS})
set(IMGUI_SDL_LIBRARY ${SDL2_LIBRARIES})
message(STATUS IMGUI_SDL_LIBRARY ${SDL2_LIBRARIES})
else()#use new one SDL2 config
include_directories(${SDL_INCLUDE})
set(IMGUI_SDL_LIBRARY SDL2::SDL2)
set(SDL_MAIN SDL2::SDL2main)
message(STATUS ${SDL_MAIN} ${IMGUI_SDL_LIBRARY})
endif()
else(DEFINED SDL_PATH)
message(STATUS "SDL_PATH not defined")
set(IMGUI_SDL_LIBRARY SDL2)
endif(DEFINED SDL_PATH)
add_library(cimgui_sdl SHARED ${IMGUI_SOURCES})
target_link_libraries(cimgui_sdl ${IMGUI_LIBRARIES} ${IMGUI_SDL_LIBRARY})
#using library
include_directories(../generator/output/)
add_executable(test_sdl main.c)
if (MINGW)
target_link_options(test_sdl PRIVATE "-mconsole")
endif()
target_link_libraries(test_sdl ${IMGUI_SDL_LIBRARY} cimgui_sdl)

View File

@@ -0,0 +1,11 @@
#include "../imgui/imgui.h"
// GL3W/GLFW
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you.
//making it accesible for luajit
#ifdef _WIN32
extern "C" __declspec( dllexport ) int Do_gl3wInit(void){ return gl3wInit();};
#else
extern "C" int Do_gl3wInit(void){ return gl3wInit();};
#endif

View File

@@ -0,0 +1,8 @@
//making it accesible for main
#ifdef _WIN32
__declspec( dllexport ) int Do_gl3wInit(void);
#else
int Do_gl3wInit(void);
#endif

203
backend_test/main.c Normal file
View File

@@ -0,0 +1,203 @@
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
#include "cimgui_extras.h"
#include "cimgui_impl.h"
#include <stdio.h>
#define SDL_MAIN_HANDLED
#include <SDL.h>
#ifdef _MSC_VER
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#ifdef IMGUI_HAS_IMSTR
#define igBegin SigBegin
#define igSliderFloat SigSliderFloat
#define igCheckbox SigCheckbox
#define igColorEdit3 SigColorEdit3
#define igButton SigButton
#endif
SDL_Window *window = NULL;
int main(int argc, char* argv[])
{
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_Log("failed to init: %s", SDL_GetError());
return -1;
}
// Decide GL+GLSL versions
#if __APPLE__
// GL 3.2 Core + GLSL 150
const char* glsl_version = "#version 150";
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
#else
// GL 3.0 + GLSL 130
const char* glsl_version = "#version 130";
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
#endif
// and prepare OpenGL stuff
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_DisplayMode current;
SDL_GetCurrentDisplayMode(0, &current);
window = SDL_CreateWindow(
"Hello", 0, 0, 1024, 768,
SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
);
if (window == NULL) {
SDL_Log("Failed to create window: %s", SDL_GetError());
return -1;
}
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
SDL_GL_SetSwapInterval(1); // enable vsync
// Initialize OpenGL loader for cimgui_sdl
bool err = Do_gl3wInit() != 0;
if (err)
{
SDL_Log("Failed to initialize OpenGL loader for cimgui_sdl!");
return 1;
}
// check opengl version sdl uses
SDL_Log("opengl version: %s", (char*)glGetString(GL_VERSION));
// setup imgui
igCreateContext(NULL);
//set docking
ImGuiIO* ioptr = igGetIO();
ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
//ioptr->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
#ifdef IMGUI_HAS_DOCK
ioptr->ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
ioptr->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
#endif
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
ImGui_ImplOpenGL3_Init(glsl_version);
igStyleColorsDark(NULL);
//ImFontAtlas_AddFontDefault(io.Fonts, NULL);
bool showDemoWindow = true;
bool showAnotherWindow = false;
ImVec4 clearColor;
clearColor.x = 0.45f;
clearColor.y = 0.55f;
clearColor.z = 0.60f;
clearColor.w = 1.00f;
bool quit = false;
while (!quit)
{
SDL_Event e;
// we need to call SDL_PollEvent to let window rendered, otherwise
// no window will be shown
while (SDL_PollEvent(&e) != 0)
{
ImGui_ImplSDL2_ProcessEvent(&e);
if (e.type == SDL_QUIT)
quit = true;
if (e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_CLOSE && e.window.windowID == SDL_GetWindowID(window))
quit = true;
}
// start imgui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
igNewFrame();
if (showDemoWindow)
igShowDemoWindow(&showDemoWindow);
// show a simple window that we created ourselves.
{
static float f = 0.0f;
static int counter = 0;
igBegin("Hello, world!", NULL, 0);
igText("This is some useful text");
igCheckbox("Demo window", &showDemoWindow);
igCheckbox("Another window", &showAnotherWindow);
igSliderFloat("Float", &f, 0.0f, 1.0f, "%.3f", 0);
igColorEdit3("clear color", (float*)&clearColor, 0);
ImVec2 buttonSize;
buttonSize.x = 0;
buttonSize.y = 0;
if (igButton("Button", buttonSize))
counter++;
igSameLine(0.0f, -1.0f);
igText("counter = %d", counter);
igText("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / igGetIO()->Framerate, igGetIO()->Framerate);
igEnd();
}
if (showAnotherWindow)
{
igBegin("imgui Another Window", &showAnotherWindow, 0);
igText("Hello from imgui");
ImVec2 buttonSize;
buttonSize.x = 0; buttonSize.y = 0;
if (igButton("Close me", buttonSize))
{
showAnotherWindow = false;
}
igEnd();
}
// render
igRender();
SDL_GL_MakeCurrent(window, gl_context);
glViewport(0, 0, (int)ioptr->DisplaySize.x, (int)ioptr->DisplaySize.y);
glClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
#ifdef IMGUI_HAS_DOCK
if (ioptr->ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
igUpdatePlatformWindows();
igRenderPlatformWindowsDefault(NULL,NULL);
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
}
#endif
SDL_GL_SwapWindow(window);
}
// clean up
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
igDestroyContext(NULL);
SDL_GL_DeleteContext(gl_context);
if (window != NULL)
{
SDL_DestroyWindow(window);
window = NULL;
}
SDL_Quit();
return 0;
}

File diff suppressed because it is too large Load Diff

749
cimgui.h

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,11 @@ CIMGUI_API float igGET_FLT_MAX()
return FLT_MAX;
}
CIMGUI_API float igGET_FLT_MIN()
{
return FLT_MIN;
}
CIMGUI_API ImVector_ImWchar* ImVector_ImWchar_create()
{

View File

@@ -55,6 +55,8 @@ CIMGUI_API void igLogText(CONST char *fmt, ...);
CIMGUI_API void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...);
//for getting FLT_MAX in bindings
CIMGUI_API float igGET_FLT_MAX();
//for getting FLT_MIN in bindings
CIMGUI_API float igGET_FLT_MIN();
CIMGUI_API ImVector_ImWchar* ImVector_ImWchar_create();

View File

@@ -165,8 +165,11 @@ local function parse_enum_value(value, allenums,dontpost)
--already in allenums
if allenums[clean(value)] then return allenums[clean(value)] end
--must be several and operators
--precedence order (hope not ())
assert(not value:match("[%(%)]"))
------------precedence order (hope not ())
--first drop outer ()
value = value:gsub("^(%()",""):gsub("(%))$","")
assert(not value:match("[%(%)]"),value)
local several,seps = strsplit(value,"([<>&|~%+]+)")
--M.prtable(value,several,seps)
assert(#seps+1==#several)
@@ -182,6 +185,12 @@ local function parse_enum_value(value, allenums,dontpost)
local val2 = clean(several[i+1])
if allenums[val1] then val1 = allenums[val1] end
if allenums[val2] then val2 = allenums[val2] end
--clean 1u
if type(val1)=="string" then val1 = val1:gsub("(%d)(u)$","%1") end
if type(val2)=="string" then val2 = val2:gsub("(%d)(u)$","%1") end
--for getting numbers from "1ULL"
if type(val1)=="string" then val1 = loadstring("return "..val1)() end
if type(val2)=="string" then val2 = loadstring("return "..val2)() end
if v=="~" then
assert(several[i]==" " or several[i]=="")
several[i] = bit.bnot(val2)
@@ -214,12 +223,14 @@ local function parse_enum_value(value, allenums,dontpost)
end
if #seps>0 or type(several[1])~="number" and not dontpost then
--M.prtable("enline",enline)
print("parse_enum_value WARNING",value)
print("parse_enum_value WARNING",value,several[1])
--M.prtable(several,seps)
--M.prtable("allenums",allenums)
end
assert(#seps==0)
assert(type(several[1])=="number")
assert(type(several[1])=="number" or type(several[1])=="cdata")
--converst 1ULL to "1ULL"
if type(several[1])=="cdata" then several[1] = tostring(several[1]) end
return several[1]
end
end
@@ -273,7 +284,7 @@ local function getRE()
structenum_re = "^([^;{}]-%b{}[%s%w_%(%)]*;)",
namespace_re = "^([^;{}]-namespace[^;{}]-%b{})",
class_re = "^([^;{}]-class[^;{}]-%b{}%s*;)",
typedef_re = "^\n*(typedef[^;]+;)",
typedef_re = "^\n*%s*(typedef[^;]+;)",
typedef_st_re = "^\n*(typedef%s+struct%s*%b{}.-;)",
functypedef_re = "^\n*%s*(typedef[%w%s%*_]+%(%s*%*%s*[%w_]+%s*%)%s*%b()%s*;)",
functypedef_re = "^\n*%s*(typedef[%w%s%*_]+%([^*]*%*%s*[%w_]+%s*%)%s*%b()%s*;)",
@@ -365,7 +376,12 @@ local function parseItems(txt,linenumdict, itparent, dumpit)
loca = table.remove(loca,1)
end
if not loca then
print(itemold)
print(string.format("%q , %q ",itemold,itemfirstline),#itemfirstline)
for k,v in pairs(linenumdict) do
if k:match(itemfirstline) then
print(string.format("%q",k),#k)
end
end
error"no entry in linenumdict"
end
else
@@ -404,14 +420,13 @@ local function parseItems(txt,linenumdict, itparent, dumpit)
end
M.parseItems = parseItems
local function name_overloadsAlgo(v)
local aa = {}
local bb = {}
local done = {}
local maxnum = 0
for i,t in ipairs(v) do
bb[i] = ""
--local signature = t.signature:sub(2,-2) -- without parenthesis
--inside parenthesis
local signature = t.signature:match("%b()")
signature = signature:sub(2,-2)
--add const function
@@ -420,47 +435,52 @@ local function name_overloadsAlgo(v)
end
aa[i] = {}
local num = 1
--for typec in t.signature:gmatch(".-([^,%(%s]+)[,%)]") do
--for typec in t.signature:gmatch(".-([^,%(]+)[,%)]") do
--for typec in signature:gmatch(".-([^,]+),?") do
for typec in signature:gsub("(%(.-%))", function(x) return x:gsub(",","\0") end):gmatch(".-([^,]+),?") do
--typec = typec:gsub
aa[i][num] = typec:gsub("%z+", ",")
num = num + 1
end
num = num - 1
maxnum = (num > maxnum) and num or maxnum
end
for l=1,maxnum do
local keys = {}
local diferent = true
local equal = true
for i=1,#v do
aa[i][l] = aa[i][l] or "nil"
keys[aa[i][l]] = 1 + (aa[i][l] and keys[aa[i][l]] or 0)
keys[aa[i][l]] = 1 + (keys[aa[i][l]] or 0)
if not done[i] then
for j=i+1,#v do
if not done[j] then
if aa[i][l] == aa[j][l] then
diferent = false
else
equal = false
for j=i+1,#v do
if not done[j] then
if aa[i][l] == aa[j][l] then
diferent = false
else
equal = false
end
end
end
end
end
end
end
if not equal then -- not all the same
for i=1,#v do
if not done[i] then
bb[i] = bb[i]..(aa[i][l]=="nil" and "" or aa[i][l])
if keys[aa[i][l]] == 1 then
done[i] = true
end
-- if keys[aa[i][l]] == 1 then
-- done[i] = true
-- end
end
end
end
--test done
for i=1,#v do
done[i] = true
for j=1,#v do
if i~=j and bb[i]==bb[j] then
done[i] = false
end
end
end
end
--avoid empty postfix which will be reserved to generic
for i,v in ipairs(bb) do if v=="" then bb[i]="Nil" end end
@@ -483,6 +503,7 @@ local function typetoStr(typ)
typ = typ:gsub("float","Float")
typ = typ:gsub("uInt","Uint")
typ = typ:gsub("ImGui","")
typ = typ:gsub("ImStr","STR")
typ = typ:gsub("Im","")
typ = typ:gsub("[<>]","")
return typ
@@ -759,6 +780,84 @@ local function AdjustArguments(FP)
end
end
end
local function ADDIMSTR_S(FP)
local defsT = FP.defsT
local newcdefs = {}
for numcdef,t in ipairs(FP.funcdefs) do
newcdefs[#newcdefs+1] = t
if t.cimguiname then
local cimf = defsT[t.cimguiname]
local defT = cimf[t.signature]
--if isIMSTR return generate _S version
local isIMSTR = false
for i,arg in ipairs(defT.argsT) do
if arg.type == "ImStr" then isIMSTR=true;break end
end
--if defT.ret=="ImVec2" or defT.ret=="ImVec4" or defT.ret=="ImColor" then
--if isIMSTR then print(t.cimguiname,defT.ov_cimguiname,defT.argsoriginal,"isIMSTR") end
if isIMSTR then
--passing as a pointer arg
local defT2 = {}
--first strings
for k,v in pairs(defT) do
defT2[k] = v
end
--then argsT table
defT2.argsT = {}
for k,v in ipairs(defT.argsT) do
local typ = v.type == "ImStr" and "const char*" or v.type
table.insert(defT2.argsT,{type=typ,name=v.name})
end
--defaults table
defT2.defaults = {}
for k,v in pairs(defT.defaults) do
defT2.defaults[k] = v
end
defT2.args = defT2.args:gsub("ImStr","const char*")
--recreate call_args for wrapping into ImStr
local caar
if #defT.argsT > 0 then
caar = "("
for i,v in ipairs(defT.argsT) do
local name = v.name --v.type == "ImStr" and "ImStr("..v.name..")" or v.name --wrap
if v.ret then --function pointer
caar = caar .. name .. ","
else
local callname = v.reftoptr and "*"..name or name
caar = caar .. callname .. ","
end
end
caar = caar:sub(1,-2)..")"
else
caar = "()"
end
defT2.call_args = caar --:gsub("ImStr%(([^%(%)]+)%)","%1") --unwrap
------------------
defT2.signature = defT.signature:gsub("ImStr","const char*") --.."_S"
defT2.ov_cimguiname = defT2.ov_cimguiname .. "_Strv"
defT2.isIMSTR_S = 1
-- check there is not an equal version in imgui_stname
local doadd = true
for i,dd in ipairs(cimf) do
if dd.signature == defT2.signature then
doadd = false;
print("skip _S addition",defT2.cimguiname)
break
end
end
--add _S version
if doadd then
cimf[#cimf+1] = defT2
cimf[defT2.signature] = defT2
newcdefs[#newcdefs+1] = {stname=t.stname,funcname=t.funcname,args=defT2.args,signature=defT2.signature,cimguiname=defT2.cimguiname,ret =defT2.ret}
end
end
else print("not cimguiname in");M.prtable(t)
end
end
FP.funcdefs = newcdefs
end
local function ADDnonUDT(FP)
local defsT = FP.defsT
--local newcdefs = {}
@@ -935,7 +1034,9 @@ function M.Parser()
par.UDTs = {}
function par:insert(line,loca)
table.insert(cdefs,{line,loca})
--table.insert(cdefs,{line,loca})
--table.insert(cdefs,{line:gsub("^%s*(.-)%s*$", "%1"),loca})
table.insert(cdefs,{line:gsub("^(%s*.-)%s*$", "%1"),loca})
end
function par.getCname(stname,funcname, namespace)
if #stname == 0 then return funcname end --top level
@@ -967,6 +1068,7 @@ function M.Parser()
end
function par:do_parse()
self:parseItems()
self:gen_structs_and_enums_table()
self:gen_structs_and_enums()
self:compute_overloads()
--self:compute_templated()
@@ -1017,12 +1119,16 @@ function M.Parser()
child.parent = it
end
if it.re_name == "struct_re" then
local typename = it.item:match("%s*template%s*<%s*typename%s*(%S+)%s*>")
local typename = it.item:match("^%s*template%s*<%s*typename%s*(%S+)%s*>")
local stname = it.item:match("struct%s+(%S+)")
it.name = stname
if typename then -- it is a struct template
local templa1,templa2 = it.item:match("^%s*template%s*<%s*(%S+)%s*(%S+)%s*>")
if templa1 or templa2 then print("template found",stname,templa1,templa2,"typename",typename) end
if typename or templa2 then -- it is a struct template
self.typenames = self.typenames or {}
self.typenames[stname] = typename
self.typenames[stname] = typename or templa2
end
elseif it.re_name == "namespace_re" then
it.name = it.item:match("namespace%s+(%S+)")
@@ -1144,7 +1250,7 @@ function M.Parser()
elseif it.re_name == "enum_re" then
--nop
elseif it.re_name ~= "functionD_re" and it.re_name ~= "function_re" then
print(it.re_name,"not processed clean_struct",it.item:sub(1,12))
print(it.re_name,"not processed clean_struct in",stname,it.item:sub(1,24))
--M.prtable(it)
end
end
@@ -1160,6 +1266,15 @@ function M.Parser()
end
return parnam
end
local function get_parents_nameC(it)
local parnam = ""
while it.parent do
parnam = it.parent.name.."::"..parnam
it = it.parent
end
if parnam~="" then parnam = parnam:sub(1,-3) end
return parnam
end
function par:gen_structs_and_enums()
local outtab = {}
local outtabpre = {}
@@ -1182,10 +1297,28 @@ function M.Parser()
end
end
elseif it.re_name == "enum_re" then
local enumname, enumbody = it.item:match"^%s*enum%s+([^%s;{}]+)[%s\n\r]*(%b{})"
--local enumname, enumbody = it.item:match"^%s*enum%s+([^%s;{}]+)[%s\n\r]*(%b{})"
local enumname = it.item:match"^%s*enum%s+([^%s;{}]+)"
if enumname then
enumbody = clean_comments(enumbody)
table.insert(outtab,"\ntypedef enum ".. enumbody..enumname..";")
--if it's an enum with int type changed
if self.structs_and_enums_table.enumtypes[enumname] then
local enumtype = self.structs_and_enums_table.enumtypes[enumname]
local enumbody = ""
local extraenums = ""
for i,v in ipairs(self.structs_and_enums_table.enums[enumname]) do
if type(v.calc_value)=="string" then
extraenums = extraenums .."\nstatic const "..enumtype.." "..v.name.." = "..v.calc_value..";"
else
enumbody = enumbody .. "\n" ..v.name .."="..v.value..","
end
end
enumbody = "{"..enumbody.."\n}"
table.insert(outtab,"\ntypedef enum ".. enumbody..enumname..";"..extraenums)
else
local enumbody = it.item:match"(%b{})"
enumbody = clean_comments(enumbody)
table.insert(outtab,"\ntypedef enum ".. enumbody..enumname..";")
end
if it.parent then
if it.parent.re_name == "namespace_re" then
local namespace = it.parent.item:match("namespace%s+(%S+)")
@@ -1195,6 +1328,7 @@ function M.Parser()
else --unamed enum just repeat declaration
local cl_item = clean_comments(it.item)
table.insert(outtab,cl_item)
print("unnamed enum",cl_item)
end
elseif it.re_name == "struct_re" or it.re_name == "typedef_st_re" then
local cleanst,structname,strtab,comstab,predec = self:clean_structR1(it)
@@ -1224,12 +1358,12 @@ function M.Parser()
if it.parent.re_name == "struct_re" or it.parent.re_name == "typedef_st_re" then
stname = it.parent.name
elseif it.parent.re_name == "namespace_re" then
namespace = it.parent.name
namespace = get_parents_nameC(it) --it.parent.name
end
end
if it.item:match"^%s*template%s+<" then
local ttype,fun = it.item:match"^%s*template%s+<%s*typename%s+([^>]+)%s*>%s*(.+)$"
if self.ftemplate_list then
if self.ftemplate_list and self.ftemplate_list[ttype] then
for iT,vT in ipairs(self.ftemplate_list[ttype]) do
local funT = fun:gsub(ttype,vT)
self:parseFunction(stname,{item=funT},namespace,it.locat)
@@ -1306,6 +1440,11 @@ function M.Parser()
enumname = "unnamed"..unnamed_enum_counter
print("unamed enum",enumname,it.parent and ("parent:"..it.parent.name) or "no parent")
end
local enumtype = it.item:match"^%s*enum%s+[^%s;{}:]+%s*:%s*([^{%s]+)"
if enumtype then
print("enumtype",enumtype)
outtab.enumtypes[enumname] = enumtype
end
outtab.enums[enumname] = {}
table.insert(enumsordered,enumname)
local inner = strip_end(it.item:match("%b{}"):sub(2,-2))
@@ -1353,7 +1492,7 @@ function M.Parser()
end
par.enums_for_table = enums_for_table
function par:gen_structs_and_enums_table()
local outtab = {enums={},structs={},locations={}}
local outtab = {enums={},structs={},locations={},enumtypes={}}
self.typedefs_table = {}
local enumsordered = {}
unnamed_enum_counter = 0
@@ -1377,6 +1516,8 @@ function M.Parser()
for j=3,#strtab-1 do
self:parse_struct_line(strtab[j],outtab.structs[structname],comstab[j])
end
else
print("skipped unnamed or templated struct",structname)
end
elseif it.re_name == "namespace_re" or it.re_name == "union_re" or it.re_name == "functype_re" then
--nop
@@ -1414,10 +1555,15 @@ function M.Parser()
f()
t.size = estevalor
end
assert(t.size,val)
--assert(t.size,val)
if not t.size then
print("not t.size for",val,"in",t.name)
error"not t.size"
end
end
end
end
self.structs_and_enums_table = outtab
return outtab
end
par.alltypes = {}
@@ -1434,6 +1580,7 @@ function M.Parser()
for k,v in pairs(self.alltypes) do print(k, typetoStr(k) ) end
end
function par:compute_overloads()
--ADDIMSTR_S(self)
local strt = {}
local numoverloaded = 0
self.alltypes = {}
@@ -1449,8 +1596,15 @@ function M.Parser()
for i,t in ipairs(v) do
--take overloaded name from manual table or algorythm
t.ov_cimguiname = self.getCname_overload(t.stname,t.funcname,t.signature,t.namespace) or k..typetoStr(post[i])
--check ...
if( t.ov_cimguiname:match"%.%.%.") then
print("... in ov",t.ov_cimguiname)
for i,dd in ipairs(v) do
print(dd.signature,post[i])
end
error"Bad check ..."
end
table.insert(strt,string.format("%d\t%s\t%s %s",i,t.ret,t.ov_cimguiname,t.signature))
--M.prtable(typesc[i],post)
end
--check not two names are equal (produced by bad cimguiname_overload)
for i=1,#v-1 do
@@ -1468,8 +1622,10 @@ function M.Parser()
end)
--print(numoverloaded, "overloaded")
table.insert(strt,string.format("%d overloaded",numoverloaded))
ADDIMSTR_S(self)
AdjustArguments(self)
ADDnonUDT(self)
--ADDdestructors(self)
self.overloadstxt = table.concat(strt,"\n")
end

View File

@@ -17,7 +17,7 @@ set PATH=%PATH%;C:\anima;C:\mingws\i686-7.2.0-release-posix-dwarf-rt_v5-rev1\min
:: arg[1] compiler name gcc, clang or cl
:: arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation
:: examples: "" "internal" "internal freetype"
:: arg[3..n] name of implementations to generate
:: arg[3..n] name of implementations to generate and/or CFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
luajit ./generator.lua gcc "internal" glfw opengl3 opengl2 sdl
::leave console open

View File

@@ -8,12 +8,28 @@ local script_args = {...}
local COMPILER = script_args[1]
local INTERNAL_GENERATION = script_args[2]:match("internal") and true or false
local FREETYPE_GENERATION = script_args[2]:match("freetype") and true or false
local CFLAGS = ""
local CPRE,CTEST
--get implementations
local implementations = {}
for i=3,#script_args do
if script_args[i]:match(COMPILER == cl and "^/" or "^%-") then
local key, value = script_args[i]:match("^(.+)=(.+)$")
if key and value then
CFLAGS = CFLAGS .. " " .. key .. "=\"" .. value:gsub("\"", "\\\"") .. "\"";
else
CFLAGS = CFLAGS .. " " .. script_args[i]
end
else
table.insert(implementations,script_args[i])
end
end
if COMPILER == "gcc" or COMPILER == "clang" then
CPRE = COMPILER..[[ -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ]]
CPRE = COMPILER..[[ -E -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ]] .. CFLAGS
CTEST = COMPILER.." --version"
elseif COMPILER == "cl" then
CPRE = COMPILER..[[ /E /DIMGUI_DISABLE_OBSOLETE_FUNCTIONS /DIMGUI_API="" /DIMGUI_IMPL_API="" ]]
CPRE = COMPILER..[[ /E /DIMGUI_DISABLE_OBSOLETE_FUNCTIONS /DIMGUI_API="" /DIMGUI_IMPL_API="" ]] .. CFLAGS
CTEST = COMPILER
else
print("Working without compiler ")
@@ -42,10 +58,6 @@ assert(HAVE_COMPILER,"gcc, clang or cl needed to run script")
print("HAVE_COMPILER",HAVE_COMPILER)
print("INTERNAL_GENERATION",INTERNAL_GENERATION)
print("FREETYPE_GENERATION",FREETYPE_GENERATION)
--get implementations
local implementations = {}
for i=3,#script_args do table.insert(implementations,script_args[i]) end
--------------------------------------------------------------------------
--this table has the functions to be skipped in generation
--------------------------------------------------------------------------
@@ -124,16 +136,17 @@ local func_implementation = cpp2ffi.func_implementation
-------------------functions for getting and setting defines
local function get_defines(t)
if COMPILER == "cl" then print"can't get defines with cl compiler"; return {} end
local pipe,err = io.popen(COMPILER..[[ -E -dM -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ../imgui/imgui.h]],"r")
print(COMPILER..[[ -E -dM -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ../imgui/imgui.h]] .. CFLAGS)
local pipe,err = io.popen(COMPILER..[[ -E -dM -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_API="" -DIMGUI_IMPL_API="" ../imgui/imgui.h]] .. CFLAGS,"r")
local defines = {}
while true do
local line = pipe:read"*l"
if not line then break end
local key,value = line:match([[#define%s+(%S+)%s+(.+)]])
if not key or not value then
local key,value = line:match([[#define%s+(%S+)%s*(.*)]])
if not key then --or not value then
--print(line)
else
defines[key]=value
defines[key]=value or ""
end
end
pipe:close()
@@ -155,13 +168,16 @@ local function get_defines(t)
end
return ret
end
--subtitution of FLT_MAX value for FLT_MAX
--subtitution of FLT_MAX value for FLT_MAX or FLT_MIN
local function set_defines(fdefs)
local FLT_MINpat = gdefines.FLT_MIN:gsub("([%.%-])","%%%1")
for k,defT in pairs(fdefs) do
for i,def in ipairs(defT) do
for name,default in pairs(def.defaults) do
if default == gdefines.FLT_MAX then
def.defaults[name] = "FLT_MAX"
elseif default:match(FLT_MINpat) then
def.defaults[name] = default:gsub(FLT_MINpat,"FLT_MIN")
end
end
end
@@ -244,6 +260,13 @@ local function generate_templates(code,codeimpool,templates)
table.insert(code,"typedef struct ImVector_"..newte.." {int Size;int Capacity;"..te.."* Data;} ImVector_"..newte..";\n")
table.insert(code,"typedef struct ImChunkStream_"..newte.." {ImVector_"..te.." Buf;} ImChunkStream_"..newte..";\n")
end)
elseif ttype == "ImSpan" then
table_do_sorted(v, function(te,newte)
table.insert(code,"typedef struct ImSpan_"..newte.." {"..te.."* Data;" ..te.."* DataEnd;} ImSpan_"..newte..";\n")
end)
else
print("generate_templates ttype not done",ttype)
error"generate templates"
end
end)
end
@@ -286,7 +309,14 @@ local function cimgui_generation(parser)
outpost = outpost1..table.concat(outtabpool)..outpost2
local cstructsstr = outpre..table.concat(outtab,"")..outpost --..(extra or "")
if gdefines.IMGUI_HAS_DOCK then
cstructsstr = cstructsstr.."\n#define IMGUI_HAS_DOCK 1\n"
end
if gdefines.IMGUI_HAS_IMSTR then
cstructsstr = cstructsstr.."\n#define IMGUI_HAS_IMSTR 1\n"
end
hstrfile = hstrfile:gsub([[#include "imgui_structs%.h"]],cstructsstr)
local cfuncsstr = func_header_generate(parser)
hstrfile = hstrfile:gsub([[#include "auto_funcs%.h"]],cfuncsstr)
@@ -304,18 +334,34 @@ end
--------------------------------------------------------
-----------------------------do it----------------------
--------------------------------------------------------
--get imgui.h version--------------------------
--get imgui.h version and IMGUI_HAS_DOCK--------------------------
--get some defines wont work for cl ----------------
gdefines = get_defines{"IMGUI_VERSION","FLT_MAX","FLT_MIN","IMGUI_HAS_DOCK","IMGUI_HAS_IMSTR"}
--this will work for cl
local pipe,err = io.open("../imgui/imgui.h","r")
if not pipe then
error("could not open file:"..err)
end
local imgui_version
local imgui_version,has_dock,has_imstr
while true do
local line = pipe:read"*l"
imgui_version = line:match([[#define%s+IMGUI_VERSION%s+(".+")]])
if imgui_version then break end
if not line then break end
if not imgui_version then
imgui_version = line:match([[#define%s+IMGUI_VERSION%s+(".+")]])
end
if not has_dock then
has_dock = line:match([[#define%s+IMGUI_HAS_DOCK]])--%s*(".+")]])
end
if not has_imstr then
has_imstr = line:match([[#define%s+IMGUI_HAS_IMSTR]])--%s*(".+")]])
end
if imgui_version and has_dock and has_imstr then break end
end
pipe:close()
if has_dock then gdefines.IMGUI_HAS_DOCK = true end
if has_imstr then gdefines.IMGUI_HAS_IMSTR = true end
cimgui_header = cimgui_header:gsub("XXX",imgui_version)
if INTERNAL_GENERATION then
cimgui_header = cimgui_header..[[//with imgui_internal.h api
@@ -325,10 +371,15 @@ if FREETYPE_GENERATION then
cimgui_header = cimgui_header..[[//with imgui_freetype.h api
]]
end
if gdefines.IMGUI_HAS_DOCK then
cimgui_header = cimgui_header..[[//docking branch
]]
end
print("IMGUI_HAS_IMSTR",gdefines.IMGUI_HAS_IMSTR)
print("IMGUI_HAS_DOCK",gdefines.IMGUI_HAS_DOCK)
print("IMGUI_VERSION",imgui_version)
--get some defines----------------------------
gdefines = get_defines{"IMGUI_VERSION","FLT_MAX"}
--funtion for parsing imgui headers
local function parseImGuiHeader(header,names)
@@ -377,7 +428,7 @@ cimgui_generation(parser1)
----------save struct and enums lua table in structs_and_enums.lua for using in bindings
local structs_and_enums_table = parser1:gen_structs_and_enums_table()
local structs_and_enums_table = parser1.structs_and_enums_table
save_data("./output/structs_and_enums.lua",serializeTableF(structs_and_enums_table))
save_data("./output/typedefs_dict.lua",serializeTableF(parser1.typedefs_dict))
@@ -395,7 +446,15 @@ save_data("./output/definitions.lua",serializeTableF(parser1.defsT))
-- end
--=================================Now implementations
local backends_folder
local ff,err = io.open ("../imgui/examples/imgui_impl_glfw.h" ,"r")
if ff then
backends_folder = "../imgui/examples/"
ff:close()
else
backends_folder = "../imgui/backends/"
end
local parser2
if #implementations > 0 then
@@ -405,7 +464,7 @@ if #implementations > 0 then
local config = require"config_generator"
for i,impl in ipairs(implementations) do
local source = [[../imgui/examples/imgui_impl_]].. impl .. ".h "
local source = backends_folder .. [[imgui_impl_]].. impl .. ".h "
local locati = [[imgui_impl_]].. impl
local define_cmd = COMPILER=="cl" and [[ /E /D]] or [[ -E -D]]

View File

@@ -15,5 +15,5 @@
# arg[1] compiler name gcc, clang, or cl
# arg[2] options as words in one string: internal for imgui_internal generation, freetype for freetype generation
# examples: "" "internal" "internal freetype"
# arg[3..n] name of implementations to generate
# arg[3..n] name of implementations to generate and/or CLFLAGS (e.g. -DIMGUI_USER_CONFIG or -DIMGUI_USE_WCHAR32)
luajit ./generator.lua gcc "internal" glfw opengl3 opengl2 sdl

View File

@@ -6,6 +6,7 @@ struct GLFWwindow;
struct SDL_Window;
typedef union SDL_Event SDL_Event;CIMGUI_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window,bool install_callbacks);
CIMGUI_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window,bool install_callbacks);
CIMGUI_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window,bool install_callbacks);
CIMGUI_API void ImGui_ImplGlfw_Shutdown();
CIMGUI_API void ImGui_ImplGlfw_NewFrame();
CIMGUI_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window,int button,int action,int mods);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
"cimguiname": "ImGui_ImplGlfw_CharCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_CharCallback",
"location": "imgui_impl_glfw:35",
"location": "imgui_impl_glfw:36",
"ov_cimguiname": "ImGui_ImplGlfw_CharCallback",
"ret": "void",
"signature": "(GLFWwindow*,unsigned int)",
@@ -49,6 +49,31 @@
"stname": ""
}
],
"ImGui_ImplGlfw_InitForOther": [
{
"args": "(GLFWwindow* window,bool install_callbacks)",
"argsT": [
{
"name": "window",
"type": "GLFWwindow*"
},
{
"name": "install_callbacks",
"type": "bool"
}
],
"argsoriginal": "(GLFWwindow* window,bool install_callbacks)",
"call_args": "(window,install_callbacks)",
"cimguiname": "ImGui_ImplGlfw_InitForOther",
"defaults": {},
"funcname": "ImGui_ImplGlfw_InitForOther",
"location": "imgui_impl_glfw:26",
"ov_cimguiname": "ImGui_ImplGlfw_InitForOther",
"ret": "bool",
"signature": "(GLFWwindow*,bool)",
"stname": ""
}
],
"ImGui_ImplGlfw_InitForVulkan": [
{
"args": "(GLFWwindow* window,bool install_callbacks)",
@@ -104,7 +129,7 @@
"cimguiname": "ImGui_ImplGlfw_KeyCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_KeyCallback",
"location": "imgui_impl_glfw:34",
"location": "imgui_impl_glfw:35",
"ov_cimguiname": "ImGui_ImplGlfw_KeyCallback",
"ret": "void",
"signature": "(GLFWwindow*,int,int,int,int)",
@@ -137,7 +162,7 @@
"cimguiname": "ImGui_ImplGlfw_MouseButtonCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_MouseButtonCallback",
"location": "imgui_impl_glfw:32",
"location": "imgui_impl_glfw:33",
"ov_cimguiname": "ImGui_ImplGlfw_MouseButtonCallback",
"ret": "void",
"signature": "(GLFWwindow*,int,int,int)",
@@ -153,7 +178,7 @@
"cimguiname": "ImGui_ImplGlfw_NewFrame",
"defaults": {},
"funcname": "ImGui_ImplGlfw_NewFrame",
"location": "imgui_impl_glfw:27",
"location": "imgui_impl_glfw:28",
"ov_cimguiname": "ImGui_ImplGlfw_NewFrame",
"ret": "void",
"signature": "()",
@@ -182,7 +207,7 @@
"cimguiname": "ImGui_ImplGlfw_ScrollCallback",
"defaults": {},
"funcname": "ImGui_ImplGlfw_ScrollCallback",
"location": "imgui_impl_glfw:33",
"location": "imgui_impl_glfw:34",
"ov_cimguiname": "ImGui_ImplGlfw_ScrollCallback",
"ret": "void",
"signature": "(GLFWwindow*,double,double)",
@@ -198,7 +223,7 @@
"cimguiname": "ImGui_ImplGlfw_Shutdown",
"defaults": {},
"funcname": "ImGui_ImplGlfw_Shutdown",
"location": "imgui_impl_glfw:26",
"location": "imgui_impl_glfw:27",
"ov_cimguiname": "ImGui_ImplGlfw_Shutdown",
"ret": "void",
"signature": "()",

View File

@@ -14,7 +14,7 @@ defs["ImGui_ImplGlfw_CharCallback"][1]["call_args"] = "(window,c)"
defs["ImGui_ImplGlfw_CharCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_CharCallback"][1]["funcname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["location"] = "imgui_impl_glfw:35"
defs["ImGui_ImplGlfw_CharCallback"][1]["location"] = "imgui_impl_glfw:36"
defs["ImGui_ImplGlfw_CharCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_CharCallback"
defs["ImGui_ImplGlfw_CharCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_CharCallback"][1]["signature"] = "(GLFWwindow*,unsigned int)"
@@ -41,6 +41,27 @@ defs["ImGui_ImplGlfw_InitForOpenGL"][1]["ret"] = "bool"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["signature"] = "(GLFWwindow*,bool)"
defs["ImGui_ImplGlfw_InitForOpenGL"][1]["stname"] = ""
defs["ImGui_ImplGlfw_InitForOpenGL"]["(GLFWwindow*,bool)"] = defs["ImGui_ImplGlfw_InitForOpenGL"][1]
defs["ImGui_ImplGlfw_InitForOther"] = {}
defs["ImGui_ImplGlfw_InitForOther"][1] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["args"] = "(GLFWwindow* window,bool install_callbacks)"
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][1] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][1]["name"] = "window"
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][1]["type"] = "GLFWwindow*"
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][2] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][2]["name"] = "install_callbacks"
defs["ImGui_ImplGlfw_InitForOther"][1]["argsT"][2]["type"] = "bool"
defs["ImGui_ImplGlfw_InitForOther"][1]["argsoriginal"] = "(GLFWwindow* window,bool install_callbacks)"
defs["ImGui_ImplGlfw_InitForOther"][1]["call_args"] = "(window,install_callbacks)"
defs["ImGui_ImplGlfw_InitForOther"][1]["cimguiname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_InitForOther"][1]["funcname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["location"] = "imgui_impl_glfw:26"
defs["ImGui_ImplGlfw_InitForOther"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_InitForOther"
defs["ImGui_ImplGlfw_InitForOther"][1]["ret"] = "bool"
defs["ImGui_ImplGlfw_InitForOther"][1]["signature"] = "(GLFWwindow*,bool)"
defs["ImGui_ImplGlfw_InitForOther"][1]["stname"] = ""
defs["ImGui_ImplGlfw_InitForOther"]["(GLFWwindow*,bool)"] = defs["ImGui_ImplGlfw_InitForOther"][1]
defs["ImGui_ImplGlfw_InitForVulkan"] = {}
defs["ImGui_ImplGlfw_InitForVulkan"][1] = {}
defs["ImGui_ImplGlfw_InitForVulkan"][1]["args"] = "(GLFWwindow* window,bool install_callbacks)"
@@ -86,7 +107,7 @@ defs["ImGui_ImplGlfw_KeyCallback"][1]["call_args"] = "(window,key,scancode,actio
defs["ImGui_ImplGlfw_KeyCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_KeyCallback"][1]["funcname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["location"] = "imgui_impl_glfw:34"
defs["ImGui_ImplGlfw_KeyCallback"][1]["location"] = "imgui_impl_glfw:35"
defs["ImGui_ImplGlfw_KeyCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_KeyCallback"
defs["ImGui_ImplGlfw_KeyCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_KeyCallback"][1]["signature"] = "(GLFWwindow*,int,int,int,int)"
@@ -113,7 +134,7 @@ defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["call_args"] = "(window,button,act
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["funcname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["location"] = "imgui_impl_glfw:32"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["location"] = "imgui_impl_glfw:33"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_MouseButtonCallback"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_MouseButtonCallback"][1]["signature"] = "(GLFWwindow*,int,int,int)"
@@ -128,7 +149,7 @@ defs["ImGui_ImplGlfw_NewFrame"][1]["call_args"] = "()"
defs["ImGui_ImplGlfw_NewFrame"][1]["cimguiname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_NewFrame"][1]["funcname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["location"] = "imgui_impl_glfw:27"
defs["ImGui_ImplGlfw_NewFrame"][1]["location"] = "imgui_impl_glfw:28"
defs["ImGui_ImplGlfw_NewFrame"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_NewFrame"
defs["ImGui_ImplGlfw_NewFrame"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_NewFrame"][1]["signature"] = "()"
@@ -152,7 +173,7 @@ defs["ImGui_ImplGlfw_ScrollCallback"][1]["call_args"] = "(window,xoffset,yoffset
defs["ImGui_ImplGlfw_ScrollCallback"][1]["cimguiname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_ScrollCallback"][1]["funcname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["location"] = "imgui_impl_glfw:33"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["location"] = "imgui_impl_glfw:34"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_ScrollCallback"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_ScrollCallback"][1]["signature"] = "(GLFWwindow*,double,double)"
@@ -167,7 +188,7 @@ defs["ImGui_ImplGlfw_Shutdown"][1]["call_args"] = "()"
defs["ImGui_ImplGlfw_Shutdown"][1]["cimguiname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["defaults"] = {}
defs["ImGui_ImplGlfw_Shutdown"][1]["funcname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["location"] = "imgui_impl_glfw:26"
defs["ImGui_ImplGlfw_Shutdown"][1]["location"] = "imgui_impl_glfw:27"
defs["ImGui_ImplGlfw_Shutdown"][1]["ov_cimguiname"] = "ImGui_ImplGlfw_Shutdown"
defs["ImGui_ImplGlfw_Shutdown"][1]["ret"] = "void"
defs["ImGui_ImplGlfw_Shutdown"][1]["signature"] = "()"

View File

@@ -47,6 +47,19 @@ ImRect_ImRect 4
2 nil ImRect_ImRectVec2 (const ImVec2,const ImVec2)
3 nil ImRect_ImRectVec4 (const ImVec4)
4 nil ImRect_ImRectFloat (float,float,float,float)
ImSpan_ImSpan 3
1 nil ImSpan_ImSpanNil ()
2 nil ImSpan_ImSpanTPtrInt (T*,int)
3 nil ImSpan_ImSpanTPtrTPtr (T*,T*)
ImSpan_begin 2
1 T* ImSpan_beginNil ()
2 const T* ImSpan_begin_const ()const
ImSpan_end 2
1 T* ImSpan_endNil ()
2 const T* ImSpan_end_const ()const
ImSpan_set 2
1 void ImSpan_setInt (T*,int)
2 void ImSpan_setTPtr (T*,T*)
ImVec1_ImVec1 2
1 nil ImVec1_ImVec1Nil ()
2 nil ImVec1_ImVec1Float (float)
@@ -87,6 +100,11 @@ ImVector_resize 2
igBeginChild 2
1 bool igBeginChildStr (const char*,const ImVec2,bool,ImGuiWindowFlags)
2 bool igBeginChildID (ImGuiID,const ImVec2,bool,ImGuiWindowFlags)
igCheckboxFlags 4
1 bool igCheckboxFlagsIntPtr (const char*,int*,int)
2 bool igCheckboxFlagsUintPtr (const char*,unsigned int*,unsigned int)
3 bool igCheckboxFlagsS64Ptr (const char*,ImS64*,ImS64)
4 bool igCheckboxFlagsU64Ptr (const char*,ImU64*,ImU64)
igCollapsingHeader 2
1 bool igCollapsingHeaderTreeNodeFlags (const char*,ImGuiTreeNodeFlags)
2 bool igCollapsingHeaderBoolPtr (const char*,bool*,ImGuiTreeNodeFlags)
@@ -94,13 +112,17 @@ igCombo 3
1 bool igComboStr_arr (const char*,int*,const char* const[],int,int)
2 bool igComboStr (const char*,int*,const char*,int)
3 bool igComboFnBoolPtr (const char*,int*,bool(*)(void*,int,const char**),void*,int,int)
igGetBackgroundDrawList 2
1 ImDrawList* igGetBackgroundDrawListNil ()
2 ImDrawList* igGetBackgroundDrawListViewportPtr (ImGuiViewport*)
igGetColorU32 3
1 ImU32 igGetColorU32Col (ImGuiCol,float)
2 ImU32 igGetColorU32Vec4 (const ImVec4)
3 ImU32 igGetColorU32U32 (ImU32)
igGetForegroundDrawList 2
igGetForegroundDrawList 3
1 ImDrawList* igGetForegroundDrawListNil ()
2 ImDrawList* igGetForegroundDrawListWindowPtr (ImGuiWindow*)
3 ImDrawList* igGetForegroundDrawListViewportPtr (ImGuiViewport*)
igGetID 3
1 ImGuiID igGetIDStr (const char*)
2 ImGuiID igGetIDStrStr (const char*,const char*)
@@ -111,6 +133,9 @@ igImAbs 2
igImFloor 2
1 float igImFloorFloat (float)
2 ImVec2 igImFloorVec2 (const ImVec2)
igImIsPowerOfTwo 2
1 bool igImIsPowerOfTwoInt (int)
2 bool igImIsPowerOfTwoU64 (ImU64)
igImLengthSqr 2
1 float igImLengthSqrVec2 (const ImVec2)
2 float igImLengthSqrVec4 (const ImVec4)
@@ -139,9 +164,6 @@ igItemSize 2
igListBox 2
1 bool igListBoxStr_arr (const char*,int*,const char* const[],int,int)
2 bool igListBoxFnBoolPtr (const char*,int*,bool(*)(void*,int,const char**),void*,int,int)
igListBoxHeader 2
1 bool igListBoxHeaderVec2 (const char*,const ImVec2)
2 bool igListBoxHeaderInt (const char*,int,int)
igMarkIniSettingsDirty 2
1 void igMarkIniSettingsDirtyNil ()
2 void igMarkIniSettingsDirtyWindowPtr (ImGuiWindow*)
@@ -198,6 +220,9 @@ igSetWindowSize 3
1 void igSetWindowSizeVec2 (const ImVec2,ImGuiCond)
2 void igSetWindowSizeStr (const char*,const ImVec2,ImGuiCond)
3 void igSetWindowSizeWindowPtr (ImGuiWindow*,const ImVec2,ImGuiCond)
igTableGetColumnName 2
1 const char* igTableGetColumnNameInt (int)
2 const char* igTableGetColumnNameTablePtr (const ImGuiTable*,int)
igTreeNode 3
1 bool igTreeNodeStr (const char*)
2 bool igTreeNodeStrStr (const char*,const char*,...)
@@ -220,4 +245,4 @@ igValue 4
2 void igValueInt (const char*,int)
3 void igValueUint (const char*,unsigned int)
4 void igValueFloat (const char*,float,const char*)
155 overloaded
173 overloaded

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@
"ImDrawCallback": "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);",
"ImDrawChannel": "struct ImDrawChannel",
"ImDrawCmd": "struct ImDrawCmd",
"ImDrawCmdHeader": "struct ImDrawCmdHeader",
"ImDrawCornerFlags": "int",
"ImDrawData": "struct ImDrawData",
"ImDrawDataBuilder": "struct ImDrawDataBuilder",
@@ -18,6 +19,7 @@
"ImFontAtlas": "struct ImFontAtlas",
"ImFontAtlasCustomRect": "struct ImFontAtlasCustomRect",
"ImFontAtlasFlags": "int",
"ImFontBuilderIO": "struct ImFontBuilderIO",
"ImFontConfig": "struct ImFontConfig",
"ImFontGlyph": "struct ImFontGlyph",
"ImFontGlyphRangesBuilder": "struct ImFontGlyphRangesBuilder",
@@ -26,18 +28,18 @@
"ImGuiCol": "int",
"ImGuiColorEditFlags": "int",
"ImGuiColorMod": "struct ImGuiColorMod",
"ImGuiColumnData": "struct ImGuiColumnData",
"ImGuiColumns": "struct ImGuiColumns",
"ImGuiColumnsFlags": "int",
"ImGuiComboFlags": "int",
"ImGuiCond": "int",
"ImGuiConfigFlags": "int",
"ImGuiContext": "struct ImGuiContext",
"ImGuiContextHook": "struct ImGuiContextHook",
"ImGuiContextHookCallback": "void(*)(ImGuiContext* ctx,ImGuiContextHook* hook);",
"ImGuiDataType": "int",
"ImGuiDataTypeInfo": "struct ImGuiDataTypeInfo",
"ImGuiDataTypeTempStorage": "struct ImGuiDataTypeTempStorage",
"ImGuiDir": "int",
"ImGuiDragDropFlags": "int",
"ImGuiErrorLogCallback": "void(*)(void* user_data,const char* fmt,...);",
"ImGuiFocusedFlags": "int",
"ImGuiGroupData": "struct ImGuiGroupData",
"ImGuiHoveredFlags": "int",
@@ -55,6 +57,7 @@
"ImGuiLayoutType": "int",
"ImGuiListClipper": "struct ImGuiListClipper",
"ImGuiMenuColumns": "struct ImGuiMenuColumns",
"ImGuiMetricsConfig": "struct ImGuiMetricsConfig",
"ImGuiMouseButton": "int",
"ImGuiMouseCursor": "int",
"ImGuiNavDirSourceFlags": "int",
@@ -66,6 +69,9 @@
"ImGuiNextItemDataFlags": "int",
"ImGuiNextWindowData": "struct ImGuiNextWindowData",
"ImGuiNextWindowDataFlags": "int",
"ImGuiOldColumnData": "struct ImGuiOldColumnData",
"ImGuiOldColumnFlags": "int",
"ImGuiOldColumns": "struct ImGuiOldColumns",
"ImGuiOnceUponAFrame": "struct ImGuiOnceUponAFrame",
"ImGuiPayload": "struct ImGuiPayload",
"ImGuiPopupData": "struct ImGuiPopupData",
@@ -78,6 +84,8 @@
"ImGuiSizeCallback": "void(*)(ImGuiSizeCallbackData* data);",
"ImGuiSizeCallbackData": "struct ImGuiSizeCallbackData",
"ImGuiSliderFlags": "int",
"ImGuiSortDirection": "int",
"ImGuiStackSizes": "struct ImGuiStackSizes",
"ImGuiStorage": "struct ImGuiStorage",
"ImGuiStoragePair": "struct ImGuiStoragePair",
"ImGuiStyle": "struct ImGuiStyle",
@@ -87,12 +95,29 @@
"ImGuiTabBarFlags": "int",
"ImGuiTabItem": "struct ImGuiTabItem",
"ImGuiTabItemFlags": "int",
"ImGuiTable": "struct ImGuiTable",
"ImGuiTableBgTarget": "int",
"ImGuiTableCellData": "struct ImGuiTableCellData",
"ImGuiTableColumn": "struct ImGuiTableColumn",
"ImGuiTableColumnFlags": "int",
"ImGuiTableColumnIdx": "ImS8",
"ImGuiTableColumnSettings": "struct ImGuiTableColumnSettings",
"ImGuiTableColumnSortSpecs": "struct ImGuiTableColumnSortSpecs",
"ImGuiTableColumnsSettings": "struct ImGuiTableColumnsSettings",
"ImGuiTableDrawChannelIdx": "ImU8",
"ImGuiTableFlags": "int",
"ImGuiTableRowFlags": "int",
"ImGuiTableSettings": "struct ImGuiTableSettings",
"ImGuiTableSortSpecs": "struct ImGuiTableSortSpecs",
"ImGuiTextBuffer": "struct ImGuiTextBuffer",
"ImGuiTextFilter": "struct ImGuiTextFilter",
"ImGuiTextFlags": "int",
"ImGuiTextRange": "struct ImGuiTextRange",
"ImGuiTooltipFlags": "int",
"ImGuiTreeNodeFlags": "int",
"ImGuiViewport": "struct ImGuiViewport",
"ImGuiViewportFlags": "int",
"ImGuiViewportP": "struct ImGuiViewportP",
"ImGuiWindow": "struct ImGuiWindow",
"ImGuiWindowFlags": "int",
"ImGuiWindowSettings": "struct ImGuiWindowSettings",

View File

@@ -4,6 +4,7 @@ defs["ImColor"] = "struct ImColor"
defs["ImDrawCallback"] = "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);"
defs["ImDrawChannel"] = "struct ImDrawChannel"
defs["ImDrawCmd"] = "struct ImDrawCmd"
defs["ImDrawCmdHeader"] = "struct ImDrawCmdHeader"
defs["ImDrawCornerFlags"] = "int"
defs["ImDrawData"] = "struct ImDrawData"
defs["ImDrawDataBuilder"] = "struct ImDrawDataBuilder"
@@ -18,6 +19,7 @@ defs["ImFont"] = "struct ImFont"
defs["ImFontAtlas"] = "struct ImFontAtlas"
defs["ImFontAtlasCustomRect"] = "struct ImFontAtlasCustomRect"
defs["ImFontAtlasFlags"] = "int"
defs["ImFontBuilderIO"] = "struct ImFontBuilderIO"
defs["ImFontConfig"] = "struct ImFontConfig"
defs["ImFontGlyph"] = "struct ImFontGlyph"
defs["ImFontGlyphRangesBuilder"] = "struct ImFontGlyphRangesBuilder"
@@ -26,18 +28,18 @@ defs["ImGuiButtonFlags"] = "int"
defs["ImGuiCol"] = "int"
defs["ImGuiColorEditFlags"] = "int"
defs["ImGuiColorMod"] = "struct ImGuiColorMod"
defs["ImGuiColumnData"] = "struct ImGuiColumnData"
defs["ImGuiColumns"] = "struct ImGuiColumns"
defs["ImGuiColumnsFlags"] = "int"
defs["ImGuiComboFlags"] = "int"
defs["ImGuiCond"] = "int"
defs["ImGuiConfigFlags"] = "int"
defs["ImGuiContext"] = "struct ImGuiContext"
defs["ImGuiContextHook"] = "struct ImGuiContextHook"
defs["ImGuiContextHookCallback"] = "void(*)(ImGuiContext* ctx,ImGuiContextHook* hook);"
defs["ImGuiDataType"] = "int"
defs["ImGuiDataTypeInfo"] = "struct ImGuiDataTypeInfo"
defs["ImGuiDataTypeTempStorage"] = "struct ImGuiDataTypeTempStorage"
defs["ImGuiDir"] = "int"
defs["ImGuiDragDropFlags"] = "int"
defs["ImGuiErrorLogCallback"] = "void(*)(void* user_data,const char* fmt,...);"
defs["ImGuiFocusedFlags"] = "int"
defs["ImGuiGroupData"] = "struct ImGuiGroupData"
defs["ImGuiHoveredFlags"] = "int"
@@ -55,6 +57,7 @@ defs["ImGuiLastItemDataBackup"] = "struct ImGuiLastItemDataBackup"
defs["ImGuiLayoutType"] = "int"
defs["ImGuiListClipper"] = "struct ImGuiListClipper"
defs["ImGuiMenuColumns"] = "struct ImGuiMenuColumns"
defs["ImGuiMetricsConfig"] = "struct ImGuiMetricsConfig"
defs["ImGuiMouseButton"] = "int"
defs["ImGuiMouseCursor"] = "int"
defs["ImGuiNavDirSourceFlags"] = "int"
@@ -66,6 +69,9 @@ defs["ImGuiNextItemData"] = "struct ImGuiNextItemData"
defs["ImGuiNextItemDataFlags"] = "int"
defs["ImGuiNextWindowData"] = "struct ImGuiNextWindowData"
defs["ImGuiNextWindowDataFlags"] = "int"
defs["ImGuiOldColumnData"] = "struct ImGuiOldColumnData"
defs["ImGuiOldColumnFlags"] = "int"
defs["ImGuiOldColumns"] = "struct ImGuiOldColumns"
defs["ImGuiOnceUponAFrame"] = "struct ImGuiOnceUponAFrame"
defs["ImGuiPayload"] = "struct ImGuiPayload"
defs["ImGuiPopupData"] = "struct ImGuiPopupData"
@@ -78,6 +84,8 @@ defs["ImGuiShrinkWidthItem"] = "struct ImGuiShrinkWidthItem"
defs["ImGuiSizeCallback"] = "void(*)(ImGuiSizeCallbackData* data);"
defs["ImGuiSizeCallbackData"] = "struct ImGuiSizeCallbackData"
defs["ImGuiSliderFlags"] = "int"
defs["ImGuiSortDirection"] = "int"
defs["ImGuiStackSizes"] = "struct ImGuiStackSizes"
defs["ImGuiStorage"] = "struct ImGuiStorage"
defs["ImGuiStoragePair"] = "struct ImGuiStoragePair"
defs["ImGuiStyle"] = "struct ImGuiStyle"
@@ -87,12 +95,29 @@ defs["ImGuiTabBar"] = "struct ImGuiTabBar"
defs["ImGuiTabBarFlags"] = "int"
defs["ImGuiTabItem"] = "struct ImGuiTabItem"
defs["ImGuiTabItemFlags"] = "int"
defs["ImGuiTable"] = "struct ImGuiTable"
defs["ImGuiTableBgTarget"] = "int"
defs["ImGuiTableCellData"] = "struct ImGuiTableCellData"
defs["ImGuiTableColumn"] = "struct ImGuiTableColumn"
defs["ImGuiTableColumnFlags"] = "int"
defs["ImGuiTableColumnIdx"] = "ImS8"
defs["ImGuiTableColumnSettings"] = "struct ImGuiTableColumnSettings"
defs["ImGuiTableColumnSortSpecs"] = "struct ImGuiTableColumnSortSpecs"
defs["ImGuiTableColumnsSettings"] = "struct ImGuiTableColumnsSettings"
defs["ImGuiTableDrawChannelIdx"] = "ImU8"
defs["ImGuiTableFlags"] = "int"
defs["ImGuiTableRowFlags"] = "int"
defs["ImGuiTableSettings"] = "struct ImGuiTableSettings"
defs["ImGuiTableSortSpecs"] = "struct ImGuiTableSortSpecs"
defs["ImGuiTextBuffer"] = "struct ImGuiTextBuffer"
defs["ImGuiTextFilter"] = "struct ImGuiTextFilter"
defs["ImGuiTextFlags"] = "int"
defs["ImGuiTextRange"] = "struct ImGuiTextRange"
defs["ImGuiTooltipFlags"] = "int"
defs["ImGuiTreeNodeFlags"] = "int"
defs["ImGuiViewport"] = "struct ImGuiViewport"
defs["ImGuiViewportFlags"] = "int"
defs["ImGuiViewportP"] = "struct ImGuiViewportP"
defs["ImGuiWindow"] = "struct ImGuiWindow"
defs["ImGuiWindowFlags"] = "int"
defs["ImGuiWindowSettings"] = "struct ImGuiWindowSettings"

2
imgui

Submodule imgui updated: e5cb04b132...4df57136e9

View File

@@ -2,6 +2,14 @@
#include <assert.h>
#include "../cimgui.h"
#ifdef IMGUI_HAS_IMSTR
#define igBegin SigBegin
#define igSliderFloat SigSliderFloat
#define igCheckbox SigCheckbox
#define igColorEdit3 SigColorEdit3
#define igButton SigButton
#endif
int main(void)
{
assert(igDebugCheckVersionAndDataLayout(igGetVersion(), sizeof(ImGuiIO), sizeof(ImGuiStyle),
@@ -24,16 +32,19 @@ int main(void)
io->DisplaySize = display_size;
io->DeltaTime = 1.0f / 60.0f;
igNewFrame();
igBegin("mainwindow",NULL,ImGuiWindowFlags_NoTitleBar);
static float f = 0.0f;
igText("Hello World!");
igSliderFloat("float", &f, 0.0f, 1.0f, "%.3f", 1.0f);
igSliderFloat("float", &f, 0.0f, 1.0f, "%.3f", 0);
igText("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io->Framerate, io->Framerate);
igEnd();
igShowDemoWindow(NULL);
igRender();
}
printf("%llu\n",ImGuiWindowFlags_NoTitleBar);
printf("size: %d\n",sizeof(ImGuiWindowFlags_NoTitleBar));
printf("DestroyContext()\n");
igDestroyContext(NULL);