Skip to content

Commit 6f896a8

Browse files
author
Hinko Kocevar
committed
initial import of imgui code
1 parent 348091b commit 6f896a8

27 files changed

+48831
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030
*.exe
3131
*.out
3232
*.app
33+
imAravis.creator.user
34+
imgui.ini

Makefile

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#
2+
# Cross Platform Makefile
3+
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
4+
#
5+
# You will need GLFW (http://www.glfw.org):
6+
# Linux:
7+
# apt-get install libglfw-dev
8+
# Mac OS X:
9+
# brew install glfw
10+
# MSYS2:
11+
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
12+
#
13+
14+
#CXX = g++
15+
#CXX = clang++
16+
17+
EXE = imAravis
18+
SOURCES = main.cpp
19+
SOURCES += ./imgui/imgui_impl_glfw.cpp ./imgui/imgui_impl_opengl3.cpp
20+
SOURCES += ./imgui/imgui.cpp ./imgui/imgui_demo.cpp ./imgui/imgui_draw.cpp ./imgui/imgui_widgets.cpp
21+
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
22+
UNAME_S := $(shell uname -s)
23+
24+
CXXFLAGS = -I./imgui -I.
25+
CXXFLAGS += -g -Wall -Wformat
26+
LIBS =
27+
28+
##---------------------------------------------------------------------
29+
## OPENGL LOADER
30+
##---------------------------------------------------------------------
31+
32+
## Using OpenGL loader: gl3w [default]
33+
SOURCES += ./imgui/libs/gl3w/GL/gl3w.c
34+
CXXFLAGS += -I./imgui/libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
35+
36+
## Using OpenGL loader: glew
37+
## (This assumes a system-wide installation)
38+
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
39+
# LIBS += -lGLEW
40+
41+
## Using OpenGL loader: glad
42+
# SOURCES += ../libs/glad/src/glad.c
43+
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD
44+
45+
## Using OpenGL loader: glad2
46+
# SOURCES += ../libs/glad/src/gl.c
47+
# CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD2
48+
49+
## Using OpenGL loader: glbinding
50+
## This assumes a system-wide installation
51+
## of either version 3.0.0 (or newer)
52+
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
53+
# LIBS += -lglbinding
54+
## or the older version 2.x
55+
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
56+
# LIBS += -lglbinding
57+
58+
##---------------------------------------------------------------------
59+
## BUILD FLAGS PER PLATFORM
60+
##---------------------------------------------------------------------
61+
62+
ifeq ($(UNAME_S), Linux) #LINUX
63+
ECHO_MESSAGE = "Linux"
64+
LIBS += -lGL `pkg-config --static --libs glfw3`
65+
66+
CXXFLAGS += `pkg-config --cflags glfw3`
67+
CFLAGS = $(CXXFLAGS)
68+
endif
69+
70+
ifeq ($(UNAME_S), Darwin) #APPLE
71+
ECHO_MESSAGE = "Mac OS X"
72+
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
73+
LIBS += -L/usr/local/lib -L/opt/local/lib
74+
#LIBS += -lglfw3
75+
LIBS += -lglfw
76+
77+
CXXFLAGS += -I/usr/local/include -I/opt/local/include
78+
CFLAGS = $(CXXFLAGS)
79+
endif
80+
81+
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
82+
ECHO_MESSAGE = "MinGW"
83+
LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32
84+
85+
CXXFLAGS += `pkg-config --cflags glfw3`
86+
CFLAGS = $(CXXFLAGS)
87+
endif
88+
89+
##---------------------------------------------------------------------
90+
## BUILD RULES
91+
##---------------------------------------------------------------------
92+
93+
%.o:%.cpp
94+
$(CXX) $(CXXFLAGS) -c -o $@ $<
95+
96+
%.o:./imgui/%.cpp
97+
$(CXX) $(CXXFLAGS) -c -o $@ $<
98+
99+
%.o:./imgui/libs/gl3w/GL/%.c
100+
$(CC) $(CFLAGS) -c -o $@ $<
101+
102+
all: $(EXE)
103+
@echo Build complete for $(ECHO_MESSAGE)
104+
105+
$(EXE): $(OBJS)
106+
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
107+
108+
clean:
109+
rm -f $(EXE) $(OBJS)

imAravis.cflags

Whitespace-only changes.

imAravis.config

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Add predefined macros for your project here. For example:
2+
// #define THE_ANSWER 42
3+
4+
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
5+

imAravis.creator

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[General]

imAravis.cxxflags

Whitespace-only changes.

imAravis.files

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
LICENSE
2+
Makefile
3+
README.md
4+
imAravis.cflags
5+
imAravis.cxxflags
6+
imgui/LICENSE.txt
7+
imgui/imconfig.h
8+
imgui/imgui.cpp
9+
imgui/imgui.h
10+
imgui/imgui_demo.cpp
11+
imgui/imgui_draw.cpp
12+
imgui/imgui_impl_glfw.cpp
13+
imgui/imgui_impl_glfw.h
14+
imgui/imgui_impl_opengl3.cpp
15+
imgui/imgui_impl_opengl3.h
16+
imgui/imgui_internal.h
17+
imgui/imgui_widgets.cpp
18+
imgui/imstb_rectpack.h
19+
imgui/imstb_textedit.h
20+
imgui/imstb_truetype.h
21+
imgui/libs/gl3w/GL/gl3w.c
22+
imgui/libs/gl3w/GL/gl3w.h
23+
imgui/libs/gl3w/GL/glcorearb.h
24+
main.cpp

imAravis.includes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
imgui/libs/gl3w
2+
imgui/libs
3+
imgui
4+
.

imgui/LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014-2020 Omar Cornut
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

imgui/imconfig.h

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//-----------------------------------------------------------------------------
2+
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
3+
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
4+
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
5+
//-----------------------------------------------------------------------------
6+
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it)
7+
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
8+
//-----------------------------------------------------------------------------
9+
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
10+
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
11+
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
12+
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
13+
//-----------------------------------------------------------------------------
14+
15+
#pragma once
16+
17+
//---- Define assertion handler. Defaults to calling assert().
18+
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
19+
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
20+
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
21+
22+
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
23+
// Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
24+
//#define IMGUI_API __declspec( dllexport )
25+
//#define IMGUI_API __declspec( dllimport )
26+
27+
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
28+
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
29+
30+
//---- Disable all of Dear ImGui or don't implement standard windows.
31+
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
32+
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
33+
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
34+
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty.
35+
36+
//---- Don't implement some functions to reduce linkage requirements.
37+
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
38+
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
39+
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
40+
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
41+
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
42+
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
43+
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
44+
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
45+
46+
//---- Include imgui_user.h at the end of imgui.h as a convenience
47+
//#define IMGUI_INCLUDE_IMGUI_USER_H
48+
49+
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
50+
//#define IMGUI_USE_BGRA_PACKED_COLOR
51+
52+
//---- Use 32-bit for ImWchar (default is 16-bit) to support full unicode code points.
53+
//#define IMGUI_USE_WCHAR32
54+
55+
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
56+
// By default the embedded implementations are declared static and not available outside of imgui cpp files.
57+
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
58+
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
59+
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
60+
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
61+
62+
//---- Unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined, use the much faster STB sprintf library implementation of vsnprintf instead of the one from the default C library.
63+
// Note that stb_sprintf.h is meant to be provided by the user and available in the include path at compile time. Also, the compatibility checks of the arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf.
64+
// #define IMGUI_USE_STB_SPRINTF
65+
66+
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
67+
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
68+
/*
69+
#define IM_VEC2_CLASS_EXTRA \
70+
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
71+
operator MyVec2() const { return MyVec2(x,y); }
72+
73+
#define IM_VEC4_CLASS_EXTRA \
74+
ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
75+
operator MyVec4() const { return MyVec4(x,y,z,w); }
76+
*/
77+
78+
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
79+
// Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bit indices).
80+
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
81+
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
82+
//#define ImDrawIdx unsigned int
83+
84+
//---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly)
85+
//struct ImDrawList;
86+
//struct ImDrawCmd;
87+
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
88+
//#define ImDrawCallback MyImDrawCallback
89+
90+
//---- Debug Tools: Macro to break in Debugger
91+
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
92+
//#define IM_DEBUG_BREAK IM_ASSERT(0)
93+
//#define IM_DEBUG_BREAK __debugbreak()
94+
95+
//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
96+
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
97+
// This adds a small runtime cost which is why it is not enabled by default.
98+
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
99+
100+
//---- Debug Tools: Enable slower asserts
101+
//#define IMGUI_DEBUG_PARANOID
102+
103+
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
104+
/*
105+
namespace ImGui
106+
{
107+
void MyFunction(const char* name, const MyMatrix44& v);
108+
}
109+
*/

0 commit comments

Comments
 (0)