diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3b758b6a..bd0c4a560 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,9 +26,9 @@ jobs: - name: Install Dependencies shell: powershell run: | - Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip" -OutFile "SDL2-devel-2.0.10-VC.zip" - Expand-Archive -Path SDL2-devel-2.0.10-VC.zip - echo "SDL2_DIR=$(pwd)\SDL2-devel-2.0.10-VC\SDL2-2.0.10\" >>${env:GITHUB_ENV} + Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.3-VC.zip" -OutFile "SDL2-devel-2.26.3-VC.zip" + Expand-Archive -Path SDL2-devel-2.26.3-VC.zip + echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.3-VC\SDL2-2.26.3\" >>${env:GITHUB_ENV} Invoke-WebRequest -Uri "https://github.com/ocornut/imgui/files/3789205/vulkan-sdk-1.1.121.2.zip" -OutFile vulkan-sdk-1.1.121.2.zip Expand-Archive -Path vulkan-sdk-1.1.121.2.zip @@ -123,23 +123,23 @@ jobs: run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build Win32 example_sdl_vulkan + - name: Build Win32 example_sdl2_vulkan shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build Win32 example_sdl_opengl2 + - name: Build Win32 example_sdl2_opengl2 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build Win32 example_sdl_opengl3 + - name: Build Win32 example_sdl2_opengl3 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' - - name: Build Win32 example_sdl_directx11 + - name: Build Win32 example_sdl2_directx11 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' if: github.event_name == 'workflow_run' - name: Build Win32 example_win32_directx9 @@ -168,24 +168,24 @@ jobs: shell: cmd run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' - - name: Build x64 example_sdl_vulkan + - name: Build x64 example_sdl2_vulkan shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build x64 example_sdl_opengl2 + - name: Build x64 example_sdl2_opengl2 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build x64 example_sdl_opengl3 + - name: Build x64 example_sdl2_opengl3 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' if: github.event_name == 'workflow_run' - - name: Build x64 example_sdl_directx11 + - name: Build x64 example_sdl2_directx11 shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl_directx11/example_sdl_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' + run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' - name: Build x64 example_win32_directx9 shell: cmd @@ -389,12 +389,12 @@ jobs: run: make -C examples/example_glfw_opengl3 if: github.event_name == 'workflow_run' - - name: Build example_sdl_opengl2 - run: make -C examples/example_sdl_opengl2 + - name: Build example_sdl2_opengl2 + run: make -C examples/example_sdl2_opengl2 if: github.event_name == 'workflow_run' - - name: Build example_sdl_opengl3 - run: make -C examples/example_sdl_opengl3 + - name: Build example_sdl2_opengl3 + run: make -C examples/example_sdl2_opengl3 - name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp @@ -443,15 +443,15 @@ jobs: - name: Build example_glfw_metal run: make -C examples/example_glfw_metal - - name: Build example_sdl_metal - run: make -C examples/example_sdl_metal + - name: Build example_sdl2_metal + run: make -C examples/example_sdl2_metal - - name: Build example_sdl_opengl2 - run: make -C examples/example_sdl_opengl2 + - name: Build example_sdl2_opengl2 + run: make -C examples/example_sdl2_opengl2 if: github.event_name == 'workflow_run' - - name: Build example_sdl_opengl3 - run: make -C examples/example_sdl_opengl3 + - name: Build example_sdl2_opengl3 + run: make -C examples/example_sdl2_opengl3 - name: Build example_apple_metal run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos @@ -482,12 +482,12 @@ jobs: emsdk-master/emsdk install latest emsdk-master/emsdk activate latest - - name: Build example_sdl_opengl3 with Emscripten + - name: Build example_sdl2_opengl3 with Emscripten run: | pushd emsdk-master source ./emsdk_env.sh popd - make -C examples/example_sdl_opengl3 -f Makefile.emscripten + make -C examples/example_sdl2_opengl3 -f Makefile.emscripten - name: Build example_emscripten_wgpu run: | diff --git a/.gitignore b/.gitignore index 3fd051e47..dc7164661 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,7 @@ examples/*.o.tmp examples/*.out.js examples/*.out.wasm examples/example_glfw_opengl3/web/* -examples/example_sdl_opengl3/web/* +examples/example_sdl2_opengl3/web/* examples/example_emscripten_wgpu/web/* ## JetBrains IDE artifacts @@ -54,7 +54,7 @@ examples/example_glfw_opengl2/example_glfw_opengl2 examples/example_glfw_opengl3/example_glfw_opengl3 examples/example_glut_opengl2/example_glut_opengl2 examples/example_null/example_null -examples/example_sdl_metal/example_sdl_metal -examples/example_sdl_opengl2/example_sdl_opengl2 -examples/example_sdl_opengl3/example_sdl_opengl3 -examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer +examples/example_sdl2_metal/example_sdl2_metal +examples/example_sdl2_opengl2/example_sdl2_opengl2 +examples/example_sdl2_opengl3/example_sdl2_opengl3 +examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer diff --git a/backends/imgui_impl_sdl.cpp b/backends/imgui_impl_sdl2.cpp similarity index 99% rename from backends/imgui_impl_sdl.cpp rename to backends/imgui_impl_sdl2.cpp index bdb4b491a..9055b55d8 100644 --- a/backends/imgui_impl_sdl.cpp +++ b/backends/imgui_impl_sdl2.cpp @@ -18,6 +18,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2023-02-07: *BREAKING CHANGE* Renamed this backend file from imgui_impl_sdl.cpp/.h to imgui_impl_sdl2.cpp/.h in prevision for the future release of SDL3. // 2023-02-02: Avoid calling SDL_SetCursor() when cursor has not changed, as the function is surprisingly costly on Mac with latest SDL (may be fixed in next SDL version). // 2023-02-02: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + Scaling X value on Emscripten (bug?). (#4019, #6096) // 2023-02-02: Removed SDL_MOUSEWHEEL value clamping, as values seem correct in latest Emscripten. (#4019) @@ -68,7 +69,7 @@ // 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers. #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" // SDL #include @@ -349,7 +350,7 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window, SDL_Renderer* renderer) // Setup backend capabilities flags ImGui_ImplSDL2_Data* bd = IM_NEW(ImGui_ImplSDL2_Data)(); io.BackendPlatformUserData = (void*)bd; - io.BackendPlatformName = "imgui_impl_sdl"; + io.BackendPlatformName = "imgui_impl_sdl2"; io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional) io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used) diff --git a/backends/imgui_impl_sdl.h b/backends/imgui_impl_sdl2.h similarity index 100% rename from backends/imgui_impl_sdl.h rename to backends/imgui_impl_sdl2.h diff --git a/docs/BACKENDS.md b/docs/BACKENDS.md index 6a7fa720c..c6edde0ac 100644 --- a/docs/BACKENDS.md +++ b/docs/BACKENDS.md @@ -6,7 +6,7 @@ _(You may browse this at https://github.com/ocornut/imgui/blob/master/docs/BACKE your application or engine to easily integrate Dear ImGui.** Each backend is typically self-contained in a pair of files: imgui_impl_XXXX.cpp + imgui_impl_XXXX.h. - The 'Platform' backends are in charge of: mouse/keyboard/gamepad inputs, cursor shape, timing, and windowing.
- e.g. Windows ([imgui_impl_win32.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_win32.cpp)), GLFW ([imgui_impl_glfw.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_glfw.cpp)), SDL2 ([imgui_impl_sdl.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdl.cpp)), etc. + e.g. Windows ([imgui_impl_win32.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_win32.cpp)), GLFW ([imgui_impl_glfw.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_glfw.cpp)), SDL2 ([imgui_impl_sdl2.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdl2.cpp)), etc. - The 'Renderer' backends are in charge of: creating atlas texture, and rendering imgui draw data.
e.g. DirectX11 ([imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)), OpenGL/WebGL ([imgui_impl_opengl3.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp)), Vulkan ([imgui_impl_vulkan.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_vulkan.cpp)), etc. @@ -62,7 +62,7 @@ List of Platforms Backends: imgui_impl_android.cpp ; Android native app API imgui_impl_glfw.cpp ; GLFW (Windows, macOS, Linux, etc.) http://www.glfw.org/ imgui_impl_osx.mm ; macOS native API (not as feature complete as glfw/sdl backends) - imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org + imgui_impl_sdl2.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org imgui_impl_win32.cpp ; Win32 native API (Windows) imgui_impl_glut.cpp ; GLUT/FreeGLUT (this is prehistoric software and absolutely not recommended today!) @@ -83,8 +83,8 @@ List of high-level Frameworks Backends (combining Platform + Renderer): imgui_impl_allegro5.cpp -Emscripten is also supported. -The [example_emscripten_opengl3](https://github.com/ocornut/imgui/tree/master/examples/example_emscripten_opengl3) app uses imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp, but other combos are possible. +Emscripten is also supported! +The SDL+GL, GLFW+GL and SDL+WebGPU examples are all ready to build and run with Emscripten. ### Backends for third-party frameworks, graphics API or other languages @@ -97,7 +97,7 @@ If you are not sure which backend to use, the recommended platform/frameworks fo |Library |Website |Backend |Note | |--------|--------|--------|-----| | GLFW | https://github.com/glfw/glfw | imgui_impl_glfw.cpp | | -| SDL2 | https://www.libsdl.org | imgui_impl_sdl.cpp | | +| SDL2 | https://www.libsdl.org | imgui_impl_sdl2.cpp | | | Sokol | https://github.com/floooh/sokol | [util/sokol_imgui.h](https://github.com/floooh/sokol/blob/master/util/sokol_imgui.h) | Lower-level than GLFW/SDL | diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 60c49b4e2..066e952ae 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -35,6 +35,14 @@ HOW TO UPDATE? VERSION 1.89.3 (In Progress) ----------------------------------------------------------------------- +Breaking Changes: + +- Backends+Examples: SDL2: renamed all unnumbered references to "sdl" to "sdl2". + This is in prevision for the future release of SDL3 (#6146) + - imgui_impl_sdl.cpp -> imgui_impl_sdl2.cpp + - imgui_impl_sdl.h -> imgui_impl_sdl2.h + - example_sdl_xxxx/ -> example_sdl2_xxxx/ (folders and projects) + All changes: - Inputs, Scrolling: Made horizontal scroll wheel and horizontal scroll direction consistent @@ -83,12 +91,12 @@ All changes: hasPreciseScrollingDeltas==false (e.g. non-Apple mices). - Backends: Win32: flipping WM_MOUSEHWHEEL value to match other backends and offer consistent horizontal scrolling direction. (#4019) -- Backends: SDL: flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and +- Backends: SDL2: flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and offer consistent horizontal scrolling direction. (#4019) -- Backends: SDL: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081) -- Backends: SDL: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data +- Backends: SDL2: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081) +- Backends: SDL2: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling as reported by SDL. (#4019, #6096) -- Backends: SDL: Avoid calling SDL_SetCursor() when cursor has not changed, as the function +- Backends: SDL2: Avoid calling SDL_SetCursor() when cursor has not changed, as the function is surprisingly costly on Mac with latest SDL (may be fixed in next SDL version). (#6113) - Backends: GLFW: Registering custom low-level mouse wheel handler to get more accurate scrolling impulses on Emscripten. (#4019, #6096) [@ocornut, @wolfpld, @tolopolarity] @@ -97,13 +105,13 @@ All changes: the 'window' parameter. (#6142) - Backends: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation). (#6117, #4116, #3632) [@tonygrue, @bfierz] -- Examples: refactored SDL+GL and GLFW+GL examples to compile with Emscripten. +- Examples: refactored SDL2+GL and GLFW+GL examples to compile with Emscripten. (#2492, #2494, #3699, #3705) [@ocornut, @nicolasnoble] The dedicated example_emscripten_opengl3/ has been removed. - Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx] -- Examples: SDL+SDL_Renderer: Added call to SDL_RenderSetScale() to display is correct on a +- Examples: SDL2+SDL_Renderer: Added call to SDL_RenderSetScale() to display is correct on a Retina display (albeit lower-res as our other unmodified examples). (#6121, #6065, #5931). diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 48203341e..92f468465 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -107,7 +107,7 @@ OSX + OpenGL2 example.
[example_emscripten_wgpu/](https://github.com/ocornut/imgui/blob/master/examples/example_emscripten_wgpu/)
Emcripten + GLFW + WebGPU example.
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_wgpu.cpp -Note that the 'example_glfw_opengl3' and 'example_sdl_opengl3' examples also supports Emscripten! +Note that the 'example_glfw_opengl3' and 'example_sdl2_opengl3' examples also supports Emscripten! [example_glfw_metal/](https://github.com/ocornut/imgui/blob/master/examples/example_glfw_metal/)
GLFW (Mac) + Metal example.
@@ -146,40 +146,40 @@ Null example, compile and link imgui, create context, run headless with no input This is used to quickly test compilation of core imgui files in as many setups as possible. Because this application doesn't create a window nor a graphic context, there's no graphics output. -[example_sdl_directx11/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_directx11/)
+[example_sdl2_directx11/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_directx11/)
SDL2 + DirectX11 example, Windows only.
-= main.cpp + imgui_impl_sdl.cpp + imgui_impl_dx11.cpp
-This to demonstrate usage of DirectX with SDL. += main.cpp + imgui_impl_sdl2.cpp + imgui_impl_dx11.cpp
+This to demonstrate usage of DirectX with SDL2. -[example_sdl_metal/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_metal/)
-SDL2 (Mac) + Metal example.
-= main.mm + imgui_impl_sdl.cpp + imgui_impl_metal.mm +[example_sdl2_metal/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_metal/)
+SDL2 + Metal example, Mac only.
+= main.mm + imgui_impl_sdl2.cpp + imgui_impl_metal.mm -[example_sdl_opengl2/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_opengl2/)
+[example_sdl2_opengl2/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_opengl2/)
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
-= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
+= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING GL OR WEBGL (SHADERS, VBO, VAO, etc.)**
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter. If your code is using GL3+ context or any semi modern GL calls, using this renderer is likely to make things more complicated, will require your code to reset many GL attributes to their initial state, and might confuse your GPU driver. One star, not recommended. -[example_sdl_opengl3/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_opengl3/)
+[example_sdl2_opengl3/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_opengl3/)
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
-= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
+= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp
This uses more modern GL calls and custom shaders.
This support building with Emscripten and targetting WebGL.
Prefer using that if you are using modern GL or WebGL in your application. -[example_sdl_sdlrenderer/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_sdlrenderer/)
+[example_sdl2_sdlrenderer/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_sdlrenderer/)
SDL2 (Win32, Mac, Linux, etc.) + SDL_Renderer (most graphics backends are supported underneath)
-= main.cpp + imgui_impl_sdl.cpp + imgui_impl_sdlrenderer.cpp
+= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_sdlrenderer.cpp
This requires SDL 2.0.18+ (released November 2021)
We do not really recommend using SDL_Renderer as it is a rather primitive API. -[example_sdl_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_vulkan/)
+[example_sdl2_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl2_vulkan/)
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
-= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
+= main.cpp + imgui_impl_sdl2.cpp + imgui_impl_vulkan.cpp
This is quite long and tedious, because: Vulkan.
For this example, the main.cpp file exceptionally use helpers function from imgui_impl_vulkan.h/cpp. diff --git a/examples/example_apple_metal/README.md b/examples/example_apple_metal/README.md index c13df2f1c..48a2b5702 100644 --- a/examples/example_apple_metal/README.md +++ b/examples/example_apple_metal/README.md @@ -4,7 +4,7 @@ This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9. -Consider basing your work off the example_glfw_metal/ or example_sdl_metal/ examples. They are better supported and will be portable unlike this one. +Consider basing your work off the example_glfw_metal/ or example_sdl2_metal/ examples. They are better supported and will be portable unlike this one. diff --git a/examples/example_sdl_directx11/build_win32.bat b/examples/example_sdl2_directx11/build_win32.bat similarity index 78% rename from examples/example_sdl_directx11/build_win32.bat rename to examples/example_sdl2_directx11/build_win32.bat index b93082704..54f30fc96 100644 --- a/examples/example_sdl_directx11/build_win32.bat +++ b/examples/example_sdl2_directx11/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug -@set OUT_EXE=example_sdl_directx11 +@set OUT_EXE=example_sdl2_directx11 @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib mkdir %OUT_DIR% cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj similarity index 97% rename from examples/example_sdl_directx11/example_sdl_directx11.vcxproj rename to examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj index ac636d2f3..27da48358 100644 --- a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj +++ b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj @@ -20,9 +20,9 @@ {9E1987E3-1F19-45CA-B9C9-D31E791836D8} - example_sdl_directx11 + example_sdl2_directx11 8.1 - example_sdl_directx11 + example_sdl2_directx11 @@ -161,16 +161,16 @@ + - + - @@ -179,4 +179,4 @@ - \ No newline at end of file + diff --git a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj.filters similarity index 93% rename from examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters rename to examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj.filters index b9e2b1e95..3476d8435 100644 --- a/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters +++ b/examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj.filters @@ -18,10 +18,10 @@ imgui - + sources - + sources @@ -44,10 +44,10 @@ imgui - + sources - + sources @@ -57,4 +57,4 @@ imgui - \ No newline at end of file + diff --git a/examples/example_sdl_directx11/main.cpp b/examples/example_sdl2_directx11/main.cpp similarity index 99% rename from examples/example_sdl_directx11/main.cpp rename to examples/example_sdl2_directx11/main.cpp index ba822c02d..58711e3e3 100644 --- a/examples/example_sdl_directx11/main.cpp +++ b/examples/example_sdl2_directx11/main.cpp @@ -4,7 +4,7 @@ // Read online: https://github.com/ocornut/imgui/tree/master/docs #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_dx11.h" #include #include diff --git a/examples/example_sdl_metal/Makefile b/examples/example_sdl2_metal/Makefile similarity index 90% rename from examples/example_sdl_metal/Makefile rename to examples/example_sdl2_metal/Makefile index 2167a98fa..53c5f75db 100644 --- a/examples/example_sdl_metal/Makefile +++ b/examples/example_sdl2_metal/Makefile @@ -6,11 +6,11 @@ #CXX = g++ #CXX = clang++ -EXE = example_sdl_metal +EXE = example_sdl2_metal IMGUI_DIR = ../.. SOURCES = main.mm SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp -SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore diff --git a/examples/example_sdl_metal/main.mm b/examples/example_sdl2_metal/main.mm similarity index 99% rename from examples/example_sdl_metal/main.mm rename to examples/example_sdl2_metal/main.mm index ff7c5086c..01cf5fb73 100644 --- a/examples/example_sdl_metal/main.mm +++ b/examples/example_sdl2_metal/main.mm @@ -4,7 +4,7 @@ // Read online: https://github.com/ocornut/imgui/tree/master/docs #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_metal.h" #include #include diff --git a/examples/example_sdl_opengl2/Makefile b/examples/example_sdl2_opengl2/Makefile similarity index 94% rename from examples/example_sdl_opengl2/Makefile rename to examples/example_sdl2_opengl2/Makefile index 24790f188..a85ced023 100644 --- a/examples/example_sdl_opengl2/Makefile +++ b/examples/example_sdl2_opengl2/Makefile @@ -14,11 +14,11 @@ #CXX = g++ #CXX = clang++ -EXE = example_sdl_opengl2 +EXE = example_sdl2_opengl2 IMGUI_DIR = ../.. SOURCES = main.cpp SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp -SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl2.cpp +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl2.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) diff --git a/examples/example_sdl2_opengl2/README.md b/examples/example_sdl2_opengl2/README.md new file mode 100644 index 000000000..40a49e691 --- /dev/null +++ b/examples/example_sdl2_opengl2/README.md @@ -0,0 +1,29 @@ + +# How to Build + +- On Windows with Visual Studio's IDE + +Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) if necessary. + +- On Windows with Visual Studio's CLI + +``` +set SDL2_DIR=path_to_your_sdl2_folder +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries +# or for 64-bit: +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +``` + +- On Linux and similar Unixes + +``` +c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL +``` + +- On Mac OS X + +``` +brew install sdl2 +c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl +``` diff --git a/examples/example_sdl_opengl2/build_win32.bat b/examples/example_sdl2_opengl2/build_win32.bat similarity index 73% rename from examples/example_sdl_opengl2/build_win32.bat rename to examples/example_sdl2_opengl2/build_win32.bat index 47529e289..287a418b7 100644 --- a/examples/example_sdl_opengl2/build_win32.bat +++ b/examples/example_sdl2_opengl2/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug -@set OUT_EXE=example_sdl_opengl2 +@set OUT_EXE=example_sdl2_opengl2 @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib mkdir %OUT_DIR% cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj b/examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj similarity index 98% rename from examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj rename to examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj index d22a67bae..a55151131 100644 --- a/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj +++ b/examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj @@ -20,7 +20,7 @@ {2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741} - example_sdl_opengl2 + example_sdl2_opengl2 8.1 @@ -160,16 +160,16 @@ + - + - @@ -178,4 +178,4 @@ - \ No newline at end of file + diff --git a/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters b/examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj.filters similarity index 93% rename from examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters rename to examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj.filters index 430ad73f1..0419ea0d5 100644 --- a/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters +++ b/examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj.filters @@ -28,7 +28,7 @@ imgui - + sources @@ -48,7 +48,7 @@ sources - + sources @@ -58,4 +58,4 @@ imgui - \ No newline at end of file + diff --git a/examples/example_sdl_opengl2/main.cpp b/examples/example_sdl2_opengl2/main.cpp similarity index 98% rename from examples/example_sdl_opengl2/main.cpp rename to examples/example_sdl2_opengl2/main.cpp index 2677a5e57..2c3ad748b 100644 --- a/examples/example_sdl_opengl2/main.cpp +++ b/examples/example_sdl2_opengl2/main.cpp @@ -4,11 +4,11 @@ // Read online: https://github.com/ocornut/imgui/tree/master/docs // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** -// **Prefer using the code in the example_sdl_opengl3/ folder** -// See imgui_impl_sdl.cpp for details. +// **Prefer using the code in the example_sdl2_opengl3/ folder** +// See imgui_impl_sdl2.cpp for details. #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_opengl2.h" #include #include diff --git a/examples/example_sdl_opengl3/Makefile b/examples/example_sdl2_opengl3/Makefile similarity index 95% rename from examples/example_sdl_opengl3/Makefile rename to examples/example_sdl2_opengl3/Makefile index ae22ce20f..5b4f9419c 100644 --- a/examples/example_sdl_opengl3/Makefile +++ b/examples/example_sdl2_opengl3/Makefile @@ -14,11 +14,11 @@ #CXX = g++ #CXX = clang++ -EXE = example_sdl_opengl3 +EXE = example_sdl2_opengl3 IMGUI_DIR = ../.. SOURCES = main.cpp SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp -SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) LINUX_GL_LIBS = -lGL diff --git a/examples/example_sdl_opengl3/Makefile.emscripten b/examples/example_sdl2_opengl3/Makefile.emscripten similarity index 96% rename from examples/example_sdl_opengl3/Makefile.emscripten rename to examples/example_sdl2_opengl3/Makefile.emscripten index 778f1265c..da0348435 100644 --- a/examples/example_sdl_opengl3/Makefile.emscripten +++ b/examples/example_sdl2_opengl3/Makefile.emscripten @@ -20,7 +20,7 @@ EXE = $(WEB_DIR)/index.html IMGUI_DIR = ../.. SOURCES = main.cpp SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp -SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) CPPFLAGS = diff --git a/examples/example_sdl_opengl3/README.md b/examples/example_sdl2_opengl3/README.md similarity index 81% rename from examples/example_sdl_opengl3/README.md rename to examples/example_sdl2_opengl3/README.md index ccd580888..9ecb9e90a 100644 --- a/examples/example_sdl_opengl3/README.md +++ b/examples/example_sdl2_opengl3/README.md @@ -10,10 +10,10 @@ Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) i Use build_win32.bat or directly: ``` set SDL2_DIR=path_to_your_sdl2_folder -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console -# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries # or for 64-bit: -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console ``` ## Linux and similar Unixes @@ -21,7 +21,7 @@ cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_ Use our Makefile or directly: ``` c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends - main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp + main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -ldl ``` @@ -31,7 +31,7 @@ Use our Makefile or directly: ``` brew install sdl2 c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends - main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp + main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_opengl3.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -framework CoreFoundation ``` diff --git a/examples/example_sdl_opengl3/build_win32.bat b/examples/example_sdl2_opengl3/build_win32.bat similarity index 73% rename from examples/example_sdl_opengl3/build_win32.bat rename to examples/example_sdl2_opengl3/build_win32.bat index 20851bff6..abbf3c78b 100644 --- a/examples/example_sdl_opengl3/build_win32.bat +++ b/examples/example_sdl2_opengl3/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug -@set OUT_EXE=example_sdl_opengl3 +@set OUT_EXE=example_sdl2_opengl3 @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib mkdir %OUT_DIR% cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj b/examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj similarity index 98% rename from examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj rename to examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj index ace041df2..d45705ea1 100644 --- a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj +++ b/examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj @@ -20,7 +20,7 @@ {BBAEB705-1669-40F3-8567-04CF6A991F4C} - example_sdl_opengl3 + example_sdl2_opengl3 8.1 @@ -160,17 +160,17 @@ + - + - diff --git a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters b/examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj.filters similarity index 93% rename from examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters rename to examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj.filters index 4ba79ff00..fbc39b1e7 100644 --- a/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters +++ b/examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj.filters @@ -22,10 +22,10 @@ sources - + sources - + sources @@ -45,15 +45,15 @@ imgui + + sources + sources sources - - sources - @@ -61,4 +61,4 @@ imgui - \ No newline at end of file + diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl2_opengl3/main.cpp similarity index 99% rename from examples/example_sdl_opengl3/main.cpp rename to examples/example_sdl2_opengl3/main.cpp index bc660a519..3e63f7a27 100644 --- a/examples/example_sdl_opengl3/main.cpp +++ b/examples/example_sdl2_opengl3/main.cpp @@ -4,7 +4,7 @@ // Read online: https://github.com/ocornut/imgui/tree/master/docs #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_opengl3.h" #include #include diff --git a/examples/example_sdl_sdlrenderer/Makefile b/examples/example_sdl2_sdlrenderer/Makefile similarity index 93% rename from examples/example_sdl_sdlrenderer/Makefile rename to examples/example_sdl2_sdlrenderer/Makefile index aa3b2d2e7..0050f0e17 100644 --- a/examples/example_sdl_sdlrenderer/Makefile +++ b/examples/example_sdl2_sdlrenderer/Makefile @@ -14,11 +14,11 @@ #CXX = g++ #CXX = clang++ -EXE = example_sdl_sdlrenderer +EXE = example_sdl2_sdlrenderer IMGUI_DIR = ../.. SOURCES = main.cpp SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp -SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_sdlrenderer.cpp +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_sdlrenderer.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) UNAME_S := $(shell uname -s) diff --git a/examples/example_sdl2_sdlrenderer/README.md b/examples/example_sdl2_sdlrenderer/README.md new file mode 100644 index 000000000..4fa37433c --- /dev/null +++ b/examples/example_sdl2_sdlrenderer/README.md @@ -0,0 +1,25 @@ + +# How to Build + +- On Windows with Visual Studio's CLI + +``` +set SDL2_DIR=path_to_your_sdl2_folder +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /subsystem:console +# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries +# or for 64-bit: +cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib /subsystem:console +``` + +- On Linux and similar Unixes + +``` +c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL +``` + +- On Mac OS X + +``` +brew install sdl2 +c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl +``` diff --git a/examples/example_sdl_sdlrenderer/build_win32.bat b/examples/example_sdl2_sdlrenderer/build_win32.bat similarity index 71% rename from examples/example_sdl_sdlrenderer/build_win32.bat rename to examples/example_sdl2_sdlrenderer/build_win32.bat index 6c1b5fde0..1bae121bb 100644 --- a/examples/example_sdl_sdlrenderer/build_win32.bat +++ b/examples/example_sdl2_sdlrenderer/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. @set OUT_DIR=Debug -@set OUT_EXE=example_sdl_sdlrenderer_ +@set OUT_EXE=example_sdl2_sdlrenderer_ @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib mkdir %OUT_DIR% cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console diff --git a/examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj b/examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj similarity index 97% rename from examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj rename to examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj index 911d9da2f..df7e1442f 100644 --- a/examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj +++ b/examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj @@ -20,7 +20,7 @@ {0C0B2BEA-311F-473C-9652-87923EF639E3} - example_sdl_sdlrenderer + example_sdl2_sdlrenderer 8.1 @@ -160,16 +160,16 @@ + - + - @@ -178,4 +178,4 @@ - \ No newline at end of file + diff --git a/examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj.filters b/examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj.filters similarity index 93% rename from examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj.filters rename to examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj.filters index 6bb03815b..6c8f5a1e5 100644 --- a/examples/example_sdl_sdlrenderer/example_sdl_sdlrenderer.vcxproj.filters +++ b/examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer.vcxproj.filters @@ -28,7 +28,7 @@ imgui - + sources @@ -48,7 +48,7 @@ sources - + sources @@ -58,4 +58,4 @@ imgui - \ No newline at end of file + diff --git a/examples/example_sdl_sdlrenderer/main.cpp b/examples/example_sdl2_sdlrenderer/main.cpp similarity index 99% rename from examples/example_sdl_sdlrenderer/main.cpp rename to examples/example_sdl2_sdlrenderer/main.cpp index f4a2890b2..0812b76d3 100644 --- a/examples/example_sdl_sdlrenderer/main.cpp +++ b/examples/example_sdl2_sdlrenderer/main.cpp @@ -8,7 +8,7 @@ // For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX. #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_sdlrenderer.h" #include #include diff --git a/examples/example_sdl_vulkan/build_win32.bat b/examples/example_sdl2_vulkan/build_win32.bat similarity index 77% rename from examples/example_sdl_vulkan/build_win32.bat rename to examples/example_sdl2_vulkan/build_win32.bat index d4a718841..5bc519856 100644 --- a/examples/example_sdl_vulkan/build_win32.bat +++ b/examples/example_sdl2_vulkan/build_win32.bat @@ -1,8 +1,8 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. -@set OUT_EXE=example_sdl_vulkan +@set OUT_EXE=example_sdl2_vulkan @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include -@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp +@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib @set OUT_DIR=Debug diff --git a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj b/examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj similarity index 98% rename from examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj rename to examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj index fc69ca70b..35282cc02 100644 --- a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj +++ b/examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj @@ -20,7 +20,7 @@ {BAE3D0B5-9695-4EB1-AD0F-75890EB4A3B3} - example_sdl_vulkan + example_sdl2_vulkan 8.1 @@ -164,7 +164,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -182,4 +182,4 @@ - \ No newline at end of file + diff --git a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters b/examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj.filters similarity index 93% rename from examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters rename to examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj.filters index f1d404ce6..d3b129846 100644 --- a/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters +++ b/examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj.filters @@ -19,7 +19,7 @@ imgui - + sources @@ -45,7 +45,7 @@ imgui - + sources @@ -58,4 +58,4 @@ imgui - \ No newline at end of file + diff --git a/examples/example_sdl_vulkan/main.cpp b/examples/example_sdl2_vulkan/main.cpp similarity index 99% rename from examples/example_sdl_vulkan/main.cpp rename to examples/example_sdl2_vulkan/main.cpp index 3fc3bf0e1..c4130c152 100644 --- a/examples/example_sdl_vulkan/main.cpp +++ b/examples/example_sdl2_vulkan/main.cpp @@ -10,7 +10,7 @@ // Read comments in imgui_impl_vulkan.h. #include "imgui.h" -#include "imgui_impl_sdl.h" +#include "imgui_impl_sdl2.h" #include "imgui_impl_vulkan.h" #include // printf, fprintf #include // abort diff --git a/examples/example_sdl_opengl2/README.md b/examples/example_sdl_opengl2/README.md deleted file mode 100644 index 2bf4d03ad..000000000 --- a/examples/example_sdl_opengl2/README.md +++ /dev/null @@ -1,29 +0,0 @@ - -# How to Build - -- On Windows with Visual Studio's IDE - -Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) if necessary. - -- On Windows with Visual Studio's CLI - -``` -set SDL2_DIR=path_to_your_sdl2_folder -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console -# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries -# or for 64-bit: -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console -``` - -- On Linux and similar Unixes - -``` -c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -``` - -- On Mac OS X - -``` -brew install sdl2 -c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -``` diff --git a/examples/example_sdl_sdlrenderer/README.md b/examples/example_sdl_sdlrenderer/README.md deleted file mode 100644 index 209f15acf..000000000 --- a/examples/example_sdl_sdlrenderer/README.md +++ /dev/null @@ -1,25 +0,0 @@ - -# How to Build - -- On Windows with Visual Studio's CLI - -``` -set SDL2_DIR=path_to_your_sdl2_folder -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /subsystem:console -# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries -# or for 64-bit: -cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib /subsystem:console -``` - -- On Linux and similar Unixes - -``` -c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL -``` - -- On Mac OS X - -``` -brew install sdl2 -c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl -``` diff --git a/examples/imgui_examples.sln b/examples/imgui_examples.sln index aec5af3cc..9b442b276 100644 --- a/examples/imgui_examples.sln +++ b/examples/imgui_examples.sln @@ -17,15 +17,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "exa EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_vulkan", "example_glfw_vulkan\example_glfw_vulkan.vcxproj", "{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_directx11", "example_sdl_directx11\example_sdl_directx11.vcxproj", "{9E1987E3-1F19-45CA-B9C9-D31E791836D8}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_directx11", "example_sdl2_directx11\example_sdl2_directx11.vcxproj", "{9E1987E3-1F19-45CA-B9C9-D31E791836D8}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_opengl2", "example_sdl_opengl2\example_sdl_opengl2.vcxproj", "{2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_opengl2", "example_sdl2_opengl2\example_sdl2_opengl2.vcxproj", "{2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_opengl3", "example_sdl_opengl3\example_sdl_opengl3.vcxproj", "{BBAEB705-1669-40F3-8567-04CF6A991F4C}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_opengl3", "example_sdl2_opengl3\example_sdl2_opengl3.vcxproj", "{BBAEB705-1669-40F3-8567-04CF6A991F4C}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_sdlrenderer", "example_sdl_sdlrenderer\example_sdl_sdlrenderer.vcxproj", "{0C0B2BEA-311F-473C-9652-87923EF639E3}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_sdlrenderer", "example_sdl2_sdlrenderer\example_sdl2_sdlrenderer.vcxproj", "{0C0B2BEA-311F-473C-9652-87923EF639E3}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl_vulkan", "example_sdl_vulkan\example_sdl_vulkan.vcxproj", "{BAE3D0B5-9695-4EB1-AD0F-75890EB4A3B3}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_vulkan", "example_sdl2_vulkan\example_sdl2_vulkan.vcxproj", "{BAE3D0B5-9695-4EB1-AD0F-75890EB4A3B3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/imgui.cpp b/imgui.cpp index e04d623f8..d1e9807f5 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -386,6 +386,7 @@ CODE When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2023/02/07 (1.89.3) - backends: renamed "imgui_impl_sdl.cpp" to "imgui_impl_sdl2.cpp" and "imgui_impl_sdl.h" to "imgui_impl_sdl2.h". (#6146) This is in prevision for the future release of SDL3. - 2022/10/26 (1.89) - commented out redirecting OpenPopupContextItem() which was briefly the name of OpenPopupOnItemClick() from 1.77 to 1.79. - 2022/10/12 (1.89) - removed runtime patching of invalid "%f"/"%0.f" format strings for DragInt()/SliderInt(). This was obsoleted in 1.61 (May 2018). See 1.61 changelog for details. - 2022/09/26 (1.89) - renamed and merged keyboard modifiers key enums and flags into a same set. Kept inline redirection enums (will obsolete).