imgui/examples/apple_example/README.md
James Chen 67b604412b Remove local glfw3 lib for osx. (+1 squashed commit)
Squashed commits:
[34cc3b7] Adds osx example. (+6 squashed commits)
Squashed commits:
[20330f2] Uses glfw by brew install.
[0427861] Renames imguiex folder name to imguiex-ios
[f9e27e5] Renames ios_example to apple_example.
[44f8fe3] Updates the glfw header/library path.
[919f279] Renames target from imguiex to imguiex-ios since there is already a imguiex-osx target now.
[24395f5] Adds osx example.
2016-04-05 18:13:48 +08:00

1.8 KiB

iOS / OSX example

Introduction

This example is the default XCode "OpenGL" example code, modified to support ImGui and Synergy.

It is a rather complex example because of all of the faff required to get an XCode/iOS application running. Refer to the regular OpenGL examples if you want to learn about integrating ImGui.

Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active.

How to Use

  1. In Synergy, go to Preferences, and uncheck "Use SSL encryption"
  2. Run the example app.
  3. Tap the "servername" button in the corner
  4. Enter the name or the IP of your synergy host
  5. If you had previously connected to a server, you may need to kill and re-start the app.

How to Run on OSX

  • Make sure you have install brew, if not, please refer to Homebrew Website
  • Run the command: brew install glfw3
  • Double click imguiex.xcodeproj and select imguiex-osx scheme
  • Click Run button

Notes and TODOs

Things that would be nice but I didn't get around to doing:

  • iOS software keyboard not supported for text inputs
  • iOS hardware (bluetooth) keyboards not supported
  • Graceful disconnect/reconnect from uSynergy.
  • Copy/Paste not well-supported

C++ on iOS / OSX

ImGui is a c++ library. If you want to include it directly, rename your Obj-C file to have the ".mm" extension.

Alternatively, you can wrap your debug code in a C interface, this is what I am demonstrating here with the "debug_hud.h" interface. Either approach works, use whatever you prefer.

In my case, most of my game code is already in C++ so it's not really an issue and I can use ImGui directly.