// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
This example is the default XCode "OpenGL" example code, modified to support ImGui and [Synergy](http://synergy-project.org/).
This example is the default XCode "OpenGL" example code, modified to support ImGui and [Synergy](http://synergy-project.org/).
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.
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
## How to Use
----
0. In Synergy, go to Preferences, and uncheck "Use SSL encryption"
0. In Synergy, go to Preferences, and uncheck "Use SSL encryption"
0. Run the example app.
0. Run the example app.
@ -16,7 +16,6 @@ Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImG
0. Enter the name or the IP of your synergy host
0. Enter the name or the IP of your synergy host
0. If you had previously connected to a server, you may need to kill and re-start the app.
0. If you had previously connected to a server, you may need to kill and re-start the app.
----
## Notes and TODOs
## Notes and TODOs
Things that would be nice but I didn't get around to doing:
Things that would be nice but I didn't get around to doing:
@ -26,7 +25,6 @@ Things that would be nice but I didn't get around to doing:
* Graceful disconnect/reconnect from uSynergy.
* Graceful disconnect/reconnect from uSynergy.
* Copy/Paste not well-supported
* Copy/Paste not well-supported
----
## C++ on iOS
## C++ on iOS
ImGui is a c++ library. If you want to include it directly, rename your Obj-C file to have the ".mm" extension.
ImGui is a c++ library. If you want to include it directly, rename your Obj-C file to have the ".mm" extension.
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
//if ( gui_has_focus() )
//{
doublemouse_x,mouse_y;
doublemouse_x,mouse_y;
mouse_x=s3ePointerGetX();
mouse_x=s3ePointerGetX();
mouse_y=s3ePointerGetY();
mouse_y=s3ePointerGetY();
io.MousePos=ImVec2((float)mouse_x,(float)mouse_y);// Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.)
io.MousePos=ImVec2((float)mouse_x/g_scale.x,(float)mouse_y/g_scale.y);// Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.)
//}
//else
for(inti=0;i<3;i++){
//{
// io.MousePos = ImVec2(-1,-1);
//}
for(inti=0;i<3;i++)
{
io.MouseDown[i]=g_MousePressed[i]||s3ePointerGetState((s3ePointerButton)i)!=S3E_POINTER_STATE_UP;// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
io.MouseDown[i]=g_MousePressed[i]||s3ePointerGetState((s3ePointerButton)i)!=S3E_POINTER_STATE_UP;// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// You can copy and use unmodified imgui_impl_* files in your project.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
IMGUI_APIvoidCaptureKeyboardFromApp();// manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered.
IMGUI_APIvoidCaptureKeyboardFromApp();// manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered.
IMGUI_APIvoidCaptureMouseFromApp();// manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it).
IMGUI_APIvoidCaptureMouseFromApp();// manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it).
// Helpers functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO()
// Helpers functions to access functions pointers in ImGui::GetIO()
IMGUI_APIvoid*MemAlloc(size_tsz);
IMGUI_APIvoid*MemAlloc(size_tsz);
IMGUI_APIvoidMemFree(void*ptr);
IMGUI_APIvoidMemFree(void*ptr);
IMGUI_APIconstchar*GetClipboardText();
IMGUI_APIvoidSetClipboardText(constchar*text);
// Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself
// Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself
#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)
#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)