Skip to content

Commit

Permalink
Merge pull request #59 from sonoro1234/badmaster
Browse files Browse the repository at this point in the history
* update imgui submodule
* correct definitions in 1.60
* struct ImGuiIO changes
* more changes
* more enum changes
* update imgui to tag 1.60
* automatically generate imgui_structs.h from imgui.h with lua
* generator using tabs in structs
* respect original spaces
* start branch master_auto
* some work
* even some more work
* adapt Makefile to cimgui_auto
* generator in folder
* simplify file generation
* some function renaming
* gen with comments
* cimgui.h with comments
* comments to 10 multiples in structs and typedefs to begining
* comments between lines of code and preserving empty lines
* without gcc parsing
* some more additions
* overload names for Selectable and BeginChild according to cimgui standard
* having GCC and NOGCC in same script
* update to imgui 1.62wip
* cimgui with glfw and opengl3 implementations
* some cosmetics and PushStyleColor overload name
* update README.md and imgui
* generate structs_and_enums.lua file to help in bindings.
* update README.md
* pull imgui submodule
* generator dont wont IMGUI_IMPL_API and generated from imgui1.60WIP
* add opengl2 implementation
* add sdl implementation
* update README.md
* add json saving
* apply ocornut suggested cimgui structure
* correct error without preprocess
* delete menus-api.gif
* all output to generated folder and test HAVE_GCC.
cimgui and cimgui_auto versions
* really add generated folder
* add generated files
* use cimgui_auto instead of cimgui
* prepare 1.62.0-beta
* update README.md
* avoid excesive typedefs
* bad replacement string
* check Lua version
* post issues in https://github.com/Extrawurst/cimgui
* add + to default definition characters
* add typedefs_dict
* add typedef struct any any;
* add argsT to definitions
* add size to struct members and calc_value to enums
* take care of return in vararg functions
* add CMake
* adapt Makefile
* add support for UDT returning functions
* some more explanations in README.md
* README.md correction
* update imguics link
* update to v1.63 imgui
* update readme for 1.63
* take care of space before brackets in function
* move to imgui 1.64
* use include from root
* add xxxx_nonUDT2 functions returning UDT_Simple

* move the ToSimple conversion functions out of CIMGUI_DEFINE_ENUMS_AND_STRUCTS

* move to imgui 1.65

* let post issues in sonoro1234/cimgui

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* try to make travis happy

* show travis in README.md

* change no args to void arg in prototypes

* calc enum value acording to previous enum value

* Revert "Master160 (#50)"

This reverts commit 7f688bf.

* Revert "Update README.md"

This reverts commit 1a5e261.
  • Loading branch information
Stephan Dilly committed Oct 3, 2018
2 parents 7f688bf + 96f24d5 commit 15c711e
Show file tree
Hide file tree
Showing 37 changed files with 27,143 additions and 3,991 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -8,5 +8,4 @@ compiler:
- clang

script:
- make -C cimgui
- $CC cimgui/cimgui.h # Make sure we can include in a plain C compiler
make
29 changes: 29 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,29 @@
Project(cimgui)
cmake_minimum_required(VERSION 2.8)

#general settings
include_directories(imgui)
add_definitions("-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1")

include_directories(.)
set(IMGUI_SOURCES ./cimgui_auto.cpp ./imgui/imgui.cpp ./imgui/imgui_draw.cpp ./imgui/imgui_demo.cpp ./imgui/imgui_widgets.cpp)

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 library and link
add_library(cimgui SHARED ${IMGUI_SOURCES})
target_link_libraries(cimgui ${IMGUI_LIBRARIES})

#install
install(TARGETS cimgui
RUNTIME DESTINATION .
LIBRARY DESTINATION .
#ARCHIVE DESTINATION lib
)
21 changes: 8 additions & 13 deletions cimgui/Makefile → Makefile
Expand Up @@ -2,24 +2,19 @@
# Cross Platform Makefile
# Compatible with Ubuntu 14.04.1 and Mac OS X

OBJS = cimgui.o
OBJS += fontAtlas.o
OBJS += drawList.o
OBJS += listClipper.o
#OBJS += test.o
OBJS += ../imgui/imgui.o
OBJS += ../imgui/imgui_draw.o
OBJS += ../imgui/imgui_demo.o

CXXFLAGS=-O2
OBJS = cimgui_auto.o
OBJS += ./imgui/imgui.o
OBJS += ./imgui/imgui_draw.o
OBJS += ./imgui/imgui_demo.o
OBJS += ./imgui/imgui_widgets.o

UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S), Linux) #LINUX
ECHO_MESSAGE = "Linux"

OUTPUTNAME = cimgui.so
CXXFLAGS += -I../../
CXXFLAGS = -I./imgui/
CXXFLAGS += -Wall
CXXFLAGS += -shared -fPIC
CFLAGS = $(CXXFLAGS)
Expand All @@ -29,7 +24,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE
ECHO_MESSAGE = "Mac OS X"

OUTPUTNAME = cimgui.dylib
CXXFLAGS += -I/usr/local/include
CXXFLAGS = -I/usr/local/include
CXXFLAGS += -Wall
LINKFLAGS = -dynamiclib
CFLAGS = $(CXXFLAGS)
Expand All @@ -39,7 +34,7 @@ ifeq ($(OS), Windows_NT)
ECHO_MESSAGE = "Windows"

OUTPUTNAME = cimgui.dll
CXXFLAGS += -I../../
CXXFLAGS = -I./imgui/
CXXFLAGS += -Wall
CXXFLAGS += -shared
LINKFLAGS = -limm32
Expand Down
33 changes: 24 additions & 9 deletions README.md
@@ -1,28 +1,43 @@
# cimgui [![Build Status](https://travis-ci.org/Extrawurst/cimgui.svg)](https://travis-ci.org/Extrawurst/cimgui)
# cimgui [![Build Status](https://travis-ci.org/sonoro1234/cimgui.svg?branch=latest_cimgui_auto)](https://travis-ci.org/sonoro1234/cimgui)

![sample](screenshot.png)

This is a thin c-api wrapper for the excellent C++ intermediate gui [imgui](https://github.com/ocornut/imgui).
Most of the functions have wrapper counterparts now, missing stuff is added on a as-needed basis (PR welcome).
This is a thin c-api wrapper programmatically generated for the excellent C++ intermediate gui [imgui](https://github.com/ocornut/imgui).
All functions are programmatically wrapped except contructors, destructors and ImVector.(Unless someone find a use case for them)
Generated files are: cimgui.cpp, cimgui.h for C compilation. Also for helping in bindings creation, definitions.lua with function definitions information and structs_and_enums.lua.
This library is intended as a intermediate layer to be able to use imgui from other languages that can interface with C (like D - see [D-binding](https://github.com/Extrawurst/DerelictImgui))

Notes:
* currently this wrapper is based on version [1.53 of imgui](https://github.com/ocornut/imgui/releases/tag/v1.53)
* does not compile with pure C compiler yet (for writing bindings in languages that are able to use C-ABI it is enough though, see D-bindings)
* currently this wrapper is based on version [1.65 of imgui]
* 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/sonoro1234/cimgui/blob/Branch_v1.62.0/generator/generator.lua#L40). Until the comunity finish with defining this table tag will be 1.62beta. Current overloaded function names can be found in (https://github.com/sonoro1234/cimgui/tree/Branch_v1.62.0/generator/generated/overloads.txt)

# usage
# compilation

* clone
* make using makefile on linux/osx
* make using makefile on linux/osx/mingw (Or use CMake to generate project)

# auto binding generation

* update imgui folder to the version you desire.
* run imgui/generator/generator.bat (or make a .sh version and please PR) with gcc and LuaJIT or Lua5.1 on your PATH.
* as a result some files are generated: cimgui_auto.cpp and cimgui_auto.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 funtions from the implementations info.
* build as shown in https://github.com/sonoro1234/LuaJIT-ImGui/tree/master_auto_implementations/build
* generate binding as done in https://github.com/sonoro1234/LuaJIT-ImGui/blob/master_auto_implementations/lua/build.bat

# usage

* use whatever method is in ImGui c++ namespace in the original [imgui.h](https://github.com/ocornut/imgui/blob/master/imgui.h) by prepending `ig`
* methods have the same parameter list and return values (where possible)
* functions that belong to a struct have an extra first argument with a pointer to the struct.
* where a function returns UDT by value some compilers complain so another function with the name function_name_nonUDT is generated accepting a pointer to the UDT type as the first argument. (or second argument if it is a struct function)
* also is generated function_name_nonUDT2 which instead of returning the UDT type returns a simple version (without functions) called UDTType_Simple (ImVec2_Simple for ImVec2)

# example bindings based on cimgui

* [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
* [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
* [ImGuiCS](https://github.com/0x0ade/ImGuiCS)
* [ImGuiCS](https://github.com/conatuscreative/ImGuiCS)
* [imgui-rs](https://github.com/Gekkio/imgui-rs)
* [imgui-pas](https://github.com/dpethes/imgui-pas)
* [odin-dear_imgui](https://github.com/ThisDrunkDane/odin-dear_imgui)
* [LuaJIT-ImGui](https://github.com/sonoro1234/LuaJIT-ImGui)
* [LuaJIT-imgui](https://github.com/sonoro1234/LuaJIT-ImGui)
4 changes: 0 additions & 4 deletions cimgui/.vscode/settings.json

This file was deleted.

0 comments on commit 15c711e

Please sign in to comment.