Compare commits

...

4 Commits
1.72 ... 1.72b

Author SHA1 Message Date
sonoro1234
c0d75f6f8d pull imgui 1.72b 2019-08-01 12:23:17 +02:00
Victor Bombi
ccf494d1c3 Merge pull request #101 from AODQ/master
adds generator shell script
2019-07-31 10:13:05 +02:00
aodq
8c817de195 adds generator shell script 2019-07-30 23:15:39 -04:00
sonoro1234
8f3ab64917 Do with ImGuiStoragePair what was done with Pair (unnamed union correction) 2019-07-29 12:42:50 +02:00
10 changed files with 33 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ 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.72 of Dear ImGui]
* currently this wrapper is based on version [1.72b of Dear ImGui]
* only functions, structs and enums from imgui.h are wrapped.
* if you are interested in imgui implementations you should look LuaJIT-ImGui project.
* overloaded function names try to be the most compatible with traditional cimgui names. So all naming is algorithmic except for those names that were in conflict with widely used cimgui names and were thus coded in a table (https://github.com/cimgui/cimgui/blob/master/generator/generator.lua#L58). Current overloaded function names can be found in (https://github.com/cimgui/cimgui/blob/master/generator/output/overloads.txt)
@@ -31,7 +31,7 @@ Notes:
* 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 can use also a C++ compiler for doing preprocessing: gcc (In windows MinGW-W64-builds for example), clang or cl (MSVC) or not use a compiler (experimental nocompiler option) at all. (this repo was done with gcc)
* update `imgui` folder to the version you desire.
* edit `generator/generator.bat` (or make a .sh version and please PR) to choose between gcc, clang, cl or nocompiler. Run it with gcc, clang or cl and LuaJIT on your PATH.
* edit `generator/generator.bat` on windows, or `generator/generator.sh` on linux, to choose between gcc, clang, cl or nocompiler. Run it 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.
# generate binding

View File

@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.72" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.72b" from Dear ImGui https://github.com/ocornut/imgui
#include "./imgui/imgui.h"
#include "cimgui.h"

View File

@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.72" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.72b" from Dear ImGui https://github.com/ocornut/imgui
#ifndef CIMGUI_INCLUDED
#define CIMGUI_INCLUDED
#include <stdio.h>

View File

@@ -568,6 +568,11 @@ if structs_and_enums_table["structs"]["Pair"] then
structs_and_enums_table["structs"]["Pair"][2]["name"] = ""
structs_and_enums_table["structs"]["Pair"][2]["type"] = structs_and_enums_table["structs"]["Pair"][2]["type"] .. "}"
end
-- 1.72 and after
if structs_and_enums_table["structs"]["ImGuiStoragePair"] then
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["name"] = ""
structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] = structs_and_enums_table["structs"]["ImGuiStoragePair"][2]["type"] .. "}"
end
-----------------------
save_data("./output/structs_and_enums.lua",serializeTableF(structs_and_enums_table))
save_data("./output/typedefs_dict.lua",serializeTableF(parser1.typedefs_dict))

17
generator/generator.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/sh
# this script must be executed in this directory
# all the output goes to generator/output folder
# .cpp and .h files:
# cimgui.h and cimgui.cpp with gcc preprocess
# cimgui_nopreprocess.h and cimgui_nopreprocess.cpp generated without preprocess
# cimgui_impl.h with implementation function cdefs
# lua and json files:
# definitions.lua for function definitions
# structs_and_enums.lua with struct and enum information-definitions
# impl_definitions.lua for implementation function definitions
#process files
# arg[1] compiler name gcc, clang, cl or nocompiler
# arg[2..n] name of implementations to generate
luajit ./generator.lua gcc glfw opengl3 opengl2 sdl

View File

@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.72" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.72b" from Dear ImGui https://github.com/ocornut/imgui
#include "./imgui/imgui.h"
#include "cimgui.h"

View File

@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.72" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.72b" from Dear ImGui https://github.com/ocornut/imgui
#ifndef CIMGUI_INCLUDED
#define CIMGUI_INCLUDED
#include <stdio.h>

View File

@@ -2652,8 +2652,8 @@
"type": "ImGuiID"
},
{
"name": "}",
"type": "union { int val_i; float val_f; void* val_p;"
"name": "",
"type": "union { int val_i; float val_f; void* val_p;}"
}
],
"ImGuiStyle": [

View File

@@ -2060,8 +2060,8 @@ defs["structs"]["ImGuiStoragePair"][1] = {}
defs["structs"]["ImGuiStoragePair"][1]["name"] = "key"
defs["structs"]["ImGuiStoragePair"][1]["type"] = "ImGuiID"
defs["structs"]["ImGuiStoragePair"][2] = {}
defs["structs"]["ImGuiStoragePair"][2]["name"] = "}"
defs["structs"]["ImGuiStoragePair"][2]["type"] = "union { int val_i; float val_f; void* val_p;"
defs["structs"]["ImGuiStoragePair"][2]["name"] = ""
defs["structs"]["ImGuiStoragePair"][2]["type"] = "union { int val_i; float val_f; void* val_p;}"
defs["structs"]["ImGuiStyle"] = {}
defs["structs"]["ImGuiStyle"][1] = {}
defs["structs"]["ImGuiStyle"][1]["name"] = "Alpha"

2
imgui

Submodule imgui updated: ecb9b1e2eb...6a0d0dab5a