Apple: Fixed example_osx_opengl2, renamed to example_apple_opengl2 + misc comments

This commit is contained in:
Omar Cornut 2018-07-08 10:47:31 +02:00
parent d64157e803
commit c3f9220c15
8 changed files with 32 additions and 15 deletions

View File

@ -41,8 +41,13 @@ Other Changes:
- Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut] - Misc: Added ImGuiMouseCursor_Hand cursor enum + corresponding software cursor. (#1913, 1914) [@aiekick, @ocornut]
- Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors. - Misc: Tweaked software mouse cursor offset to match the offset of the corresponding Windows 10 cursors.
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276) - Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
- Examples: Metal: Added Metal rendering backend. (#1929, #1873) [@warrenm]
- Examples: OSX: Added early raw OSX platform backend. (#1873) [@pagghiu, @itamago, @ocornut]
- Examples: Added mac OSX & iOS + Metal example in example_apple_metal/. (#1929, #1873) [@warrenm]
- Examples: Added mac OSX + OpenGL2 example in example_apple_opengl2/. (#1873)
- Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor. - Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor.
----------------------------------------------------------------------- -----------------------------------------------------------------------
VERSION 1.62 (Released 2018-06-22) VERSION 1.62 (Released 2018-06-22)
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -125,10 +125,9 @@ Languages: (third-party bindings)
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui) - Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
Frameworks: Frameworks:
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, OpenGL2, OpenGL3+, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples) - Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
- Platform: GLFW, SDL, Win32, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples) - Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples) - Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
- Unmerged Branch: OSX platform without GLFW/SDL: [#1873](https://github.com/ocornut/imgui/tree/osx)
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336) - Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
- Unmerged PR: Native Win32 and OSX: [#281](https://github.com/ocornut/imgui/pull/281) - Unmerged PR: Native Win32 and OSX: [#281](https://github.com/ocornut/imgui/pull/281)
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421) - Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
@ -170,6 +169,7 @@ User screenshots:
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017) <br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018) <br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 onward) <br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 onward)
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1902) (June 2018 onward)
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features. <br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
Various tools Various tools

View File

@ -113,7 +113,8 @@ List of Renderer Bindings in this repository:
imgui_impl_dx9.cpp ; DirectX9 imgui_impl_dx9.cpp ; DirectX9
imgui_impl_dx10.cpp ; DirectX10 imgui_impl_dx10.cpp ; DirectX10
imgui_impl_dx11.cpp ; DirectX11 imgui_impl_dx11.cpp ; DirectX11
imgui_impl_dx12.cpp ; DirectX12 imgui_impl_dx12.cpp ; DirectX12
imgui_impl_metal.mm ; Metal (with ObjC)
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context) imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline) imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
imgui_impl_vulkan.cpp ; Vulkan imgui_impl_vulkan.cpp ; Vulkan
@ -144,6 +145,7 @@ Building:
- Makefiles for Linux/OSX - Makefiles for Linux/OSX
- Batch files for Visual Studio 2008+ - Batch files for Visual Studio 2008+
- A .sln project file for Visual Studio 2010+ - A .sln project file for Visual Studio 2010+
- Xcode project files for the Apple examples
Please let me know if they don't work with your setup! Please let me know if they don't work with your setup!
You can probably just import the imgui_impl_xxx.cpp/.h files into your own codebase or compile those You can probably just import the imgui_impl_xxx.cpp/.h files into your own codebase or compile those
directly with a command-line compiler. directly with a command-line compiler.
@ -208,7 +210,12 @@ example_sdl_vulkan/
This is quite long and tedious, because: Vulkan. This is quite long and tedious, because: Vulkan.
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp = main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
example_osx_opengl2/ example_apple_metal/
OSX & iOS + Metal.
It is based on the cross-platform game template provided with Xcode as of Xcode 9.
= game template + imgui_impl_osx.mm + imgui_impl_metal.mm
example_apple_opengl2/
OSX Cocoa + OpenGL2. OSX Cocoa + OpenGL2.
= main.mm + imgui_impl_osx.mm + imgui_impl_opengl2.cpp = main.mm + imgui_impl_osx.mm + imgui_impl_opengl2.cpp

View File

@ -144,12 +144,12 @@
} }
// Forward Mouse/Keyboard events to dear imgui OSX back-end. It returns true when imgui is expecting to use the event. // Forward Mouse/Keyboard events to dear imgui OSX back-end. It returns true when imgui is expecting to use the event.
-(void)keyUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)keyUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)keyDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)keyDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)flagsChanged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)flagsChanged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)mouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)mouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)mouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)mouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event); } -(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
@end @end

View File

@ -10,7 +10,7 @@
// CHANGELOG // CHANGELOG
// (minor and older changes stripped away, please see git history for details) // (minor and older changes stripped away, please see git history for details)
// 2018-07-05: Metal: Added new Metal backend implementation // 2018-07-05: Metal: Added new Metal backend implementation.
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_metal.h" #include "imgui_impl_metal.h"

View File

@ -1,5 +1,10 @@
// ImGui Platform Binding for: OSX / Cocoa // ImGui Platform Binding for: OSX / Cocoa
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
// Issues:
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
@class NSEvent; @class NSEvent;
@class NSView; @class NSView;

View File

@ -1,10 +1,10 @@
// ImGui Platform Binding for: OSX / Cocoa // ImGui Platform Binding for: OSX / Cocoa
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
// Issues: // Issues:
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
// [ ] Platform: Mouse cursor shapes are not supported (see end of https://github.com/glfw/glfw/issues/427) // [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
// [ ] Test with another renderer back-end than OpenGL2. e.g. OpenGL3.
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_osx.h" #include "imgui_impl_osx.h"
@ -12,7 +12,7 @@
// CHANGELOG // CHANGELOG
// (minor and older changes stripped away, please see git history for details) // (minor and older changes stripped away, please see git history for details)
// 2018-06-XX: Initial version. // 2018-07-07: Initial version.
// Data // Data
static clock_t g_Time = 0; static clock_t g_Time = 0;