Examples: Renamed imgui_impl_sdl2.cpp to imgui_impl_sdl.cpp (#1870) + changelog bits

This commit is contained in:
omar 2018-06-10 15:45:54 +02:00
parent 8d58fbb5ed
commit 5a13e4dcde
19 changed files with 53 additions and 42 deletions

View File

@ -39,19 +39,30 @@ Breaking Changes:
The only difference is if you were using TreeNodeEx() manually with ImGuiTreeNodeFlags_CollapsingHeader and without ImGuiTreeNodeFlags_NoTreePushOnOpen. In which case
you can remove the ImGuiTreeNodeFlags_NoTreePushOnOpen flag from your call (ImGuiTreeNodeFlags_CollapsingHeader & ~ImGuiTreeNodeFlags_NoTreePushOnOpen). (#1864)
- ImFontAtlas: Renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set. (#1859)
- Examples Bindings have been refactored to separate them into "Platform" and "Renderer" components that are more easy to combine.
- The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc.
Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl2.cpp).
- The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data.
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
- This is not strictly a breaking change if you keep your old bindings, but _WHEN_ you'll want to fully update your bindings,
expect to have to reshuffle a few things. This refactor will greatly facilitate maintenance and re-usability, and was designed
to get us closer to the upcoming "multi-viewport" feature branch.
- Please read examples/README.txt for details.
This also apply if you were using internal's TreeNodeBehavior() with the ImGuiTreeNodeFlags_CollapsingHeader flag directly.
Other Changes:
- Examples back-ends have been refactored to separate the platform code (e.g. Win32, Glfw, SDL2) from the renderer code (e.g. DirectX11, OpenGL3, Vulkan).
The "Platform" bindings are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, etc.
The "Renderer" bindings are in charge of: creating the main font texture, rendering imgui draw data.
before: imgui_impl_dx11.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
before: imgui_impl_dx12.cpp --> after: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
before: imgui_impl_glfw_gl3.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
before: imgui_impl_glfw_vulkan.cpp --> after: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
before: imgui_impl_sdl_gl3.cpp --> after: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp etc.
- The idea is what we can now easily combine and maintain back-ends and reduce code redundancy. Individual files are smaller and more reusable.
Integration of imgui into a new/custom engine may also be easier as there is less overlap between "windowing / inputs" and "rendering" code,
so you may study or grab one half of the code and not the other.
- This change was motivated by the fact that adding support for the upcoming multi-viewport feature requires more work from the Platform and Renderer
back-ends, and the amount of redundancy across files was becoming too difficult to maintain. If you use default back-ends, you'll benefit from an
easy update path to support multi-viewports later.
- This is not strictly a breaking change if you keep your old bindings, but when you'll want to fully update your bindings,
expect to have to reshuffle a few things.
- Each example still has its own main.cpp which you may refer you to understand how to initialize and glue everything together.
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
- Please read examples/README.txt for details.
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.

View File

@ -65,7 +65,7 @@ You can find binaries of some of those example applications at:
Most the example bindings are split in 2 parts:
- The "Platform" bindings, in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, windowing.
Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl2.cpp)
Examples: Windows (imgui_impl_win32.cpp), GLFW (imgui_impl_glfw.cpp), SDL2 (imgui_impl_sdl.cpp)
- The "Renderer" bindings, in charge of: creating the main font texture, rendering imgui draw data.
Examples: DirectX11 (imgui_impl_dx11.cpp), GL3 (imgui_impl_opengl3.cpp), Vulkan (imgui_impl_vulkan.cpp)
@ -109,7 +109,7 @@ Most the example bindings are split in 2 parts:
List of officially maintained Platforms Bindings:
imgui_impl_glfw.cpp
imgui_impl_sdl2.cpp
imgui_impl_sdl.cpp
imgui_impl_win32.cpp
List of officially maintained Renderer Bindings:
@ -199,18 +199,18 @@ example_sdl_opengl2/
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
make things more complicated, will require your code to reset many OpenGL attributes to their initial
state, and might confuse your GPU driver. One star, not recommended.
= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
example_sdl_opengl3/
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+ example.
This uses more modern OpenGL calls and custom shaders.
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
example_sdl_vulkan/
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
This is quite long and tedious, because: Vulkan.
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
example_apple/
OSX & iOS example + OpenGL2.

View File

@ -15,7 +15,7 @@
#CXX = clang++
EXE = example_sdl_opengl2
SOURCES = main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl2.cpp
SOURCES = main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))

View File

@ -5,18 +5,18 @@
```
set SDL2DIR=path_to_your_sdl2_folder
cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp ..\imgui_impl_sdl2.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
- On Linux and similar Unixes
```
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
```
- On Mac OS X
```
brew install sdl2
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
```

View File

@ -1,3 +1,3 @@
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
mkdir Debug
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl2.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console

View File

@ -154,7 +154,7 @@
<ClCompile Include="..\..\imgui_demo.cpp" />
<ClCompile Include="..\..\imgui_draw.cpp" />
<ClCompile Include="..\imgui_impl_opengl2.cpp" />
<ClCompile Include="..\imgui_impl_sdl2.cpp" />
<ClCompile Include="..\imgui_impl_sdl.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
@ -162,7 +162,7 @@
<ClInclude Include="..\..\imgui.h" />
<ClInclude Include="..\..\imgui_internal.h" />
<ClInclude Include="..\imgui_impl_opengl2.h" />
<ClInclude Include="..\imgui_impl_sdl2.h" />
<ClInclude Include="..\imgui_impl_sdl.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\misc\natvis\imgui.natvis" />

View File

@ -22,7 +22,7 @@
<ClCompile Include="main.cpp">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\imgui_impl_sdl2.cpp">
<ClCompile Include="..\imgui_impl_sdl.cpp">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\imgui_impl_opengl2.cpp">
@ -42,7 +42,7 @@
<ClInclude Include="..\imgui_impl_opengl2.h">
<Filter>sources</Filter>
</ClInclude>
<ClInclude Include="..\imgui_impl_sdl2.h">
<ClInclude Include="..\imgui_impl_sdl.h">
<Filter>sources</Filter>
</ClInclude>
</ItemGroup>

View File

@ -7,7 +7,7 @@
// See imgui_impl_sdl.cpp for details.
#include "imgui.h"
#include "imgui_impl_sdl2.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl2.h"
#include <stdio.h>
#include <SDL.h>

View File

@ -16,7 +16,7 @@
EXE = example_sdl_opengl3
SOURCES = main.cpp
SOURCES += ../imgui_impl_sdl2.cpp ../imgui_impl_opengl3.cpp
SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp
SOURCES += ../libs/gl3w/GL/gl3w.c
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))

View File

@ -5,18 +5,18 @@
```
set SDL2DIR=path_to_your_sdl2_folder
cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl2.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
```
- On Linux and similar Unixes
```
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
```
- On Mac OS X
```
brew install sdl2
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl2.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
```

View File

@ -1,3 +1,3 @@
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
mkdir Debug
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl2.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console

View File

@ -154,7 +154,7 @@
<ClCompile Include="..\..\imgui_demo.cpp" />
<ClCompile Include="..\..\imgui_draw.cpp" />
<ClCompile Include="..\imgui_impl_opengl3.cpp" />
<ClCompile Include="..\imgui_impl_sdl2.cpp" />
<ClCompile Include="..\imgui_impl_sdl.cpp" />
<ClCompile Include="..\libs\gl3w\GL\gl3w.c" />
<ClCompile Include="main.cpp" />
</ItemGroup>
@ -163,7 +163,7 @@
<ClInclude Include="..\..\imgui.h" />
<ClInclude Include="..\..\imgui_internal.h" />
<ClInclude Include="..\imgui_impl_opengl3.h" />
<ClInclude Include="..\imgui_impl_sdl2.h" />
<ClInclude Include="..\imgui_impl_sdl.h" />
<ClInclude Include="..\libs\gl3w\GL\gl3w.h" />
<ClInclude Include="..\libs\gl3w\GL\glcorearb.h" />
</ItemGroup>

View File

@ -31,7 +31,7 @@
<ClCompile Include="..\imgui_impl_opengl3.cpp">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\imgui_impl_sdl2.cpp">
<ClCompile Include="..\imgui_impl_sdl.cpp">
<Filter>sources</Filter>
</ClCompile>
</ItemGroup>
@ -54,7 +54,7 @@
<ClInclude Include="..\imgui_impl_opengl3.h">
<Filter>sources</Filter>
</ClInclude>
<ClInclude Include="..\imgui_impl_sdl2.h">
<ClInclude Include="..\imgui_impl_sdl.h">
<Filter>sources</Filter>
</ClInclude>
</ItemGroup>

View File

@ -4,7 +4,7 @@
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
#include "imgui.h"
#include "imgui_impl_sdl2.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
#include <stdio.h>
#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.

View File

@ -153,7 +153,7 @@
<ClCompile Include="..\..\imgui.cpp" />
<ClCompile Include="..\..\imgui_demo.cpp" />
<ClCompile Include="..\..\imgui_draw.cpp" />
<ClCompile Include="..\imgui_impl_sdl2.cpp" />
<ClCompile Include="..\imgui_impl_sdl.cpp" />
<ClCompile Include="..\imgui_impl_vulkan.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
@ -161,7 +161,7 @@
<ClInclude Include="..\..\imconfig.h" />
<ClInclude Include="..\..\imgui.h" />
<ClInclude Include="..\..\imgui_internal.h" />
<ClInclude Include="..\imgui_impl_sdl2.h" />
<ClInclude Include="..\imgui_impl_sdl.h" />
<ClInclude Include="..\imgui_impl_vulkan.h" />
</ItemGroup>
<ItemGroup>

View File

@ -19,7 +19,7 @@
<ClCompile Include="..\..\imgui_draw.cpp">
<Filter>imgui</Filter>
</ClCompile>
<ClCompile Include="..\imgui_impl_sdl2.cpp">
<ClCompile Include="..\imgui_impl_sdl.cpp">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
@ -39,7 +39,7 @@
<ClInclude Include="..\..\imgui_internal.h">
<Filter>imgui</Filter>
</ClInclude>
<ClInclude Include="..\imgui_impl_sdl2.h">
<ClInclude Include="..\imgui_impl_sdl.h">
<Filter>sources</Filter>
</ClInclude>
<ClInclude Include="..\imgui_impl_vulkan.h">

View File

@ -2,7 +2,7 @@
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
#include "imgui.h"
#include "imgui_impl_sdl2.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_vulkan.h"
#include <stdio.h> // printf, fprintf
#include <stdlib.h> // abort

View File

@ -12,7 +12,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2018-06-08: Misc: Extracted imgui_impl_sdl2.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
// 2018-05-09: Misc: Fixed clipboard paste memory leak (we didn't call SDL_FreeMemory on the data returned by SDL_GetClipboardText).
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
@ -28,7 +28,7 @@
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
#include "imgui.h"
#include "imgui_impl_sdl2.h"
#include "imgui_impl_sdl.h"
// SDL
// (the multi-viewports feature requires SDL features supported from SDL 2.0.5+)