This commit is contained in:
gzito
2015-10-14 23:01:52 +02:00
23 changed files with 283 additions and 201 deletions

View File

@ -1,4 +1,7 @@
// ImGui Allegro 5 bindings
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
// by @birthggd

View File

@ -1,4 +1,7 @@
// ImGui Allegro 5 bindings
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
// by @birthggd

View File

@ -1,4 +1,7 @@
// ImGui Win32 + DirectX11 binding
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
#include <imgui.h>
@ -328,9 +331,9 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
// Create the input layout
D3D11_INPUT_ELEMENT_DESC localLayout[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
if (g_pd3dDevice->CreateInputLayout(localLayout, 3, g_pVertexShaderBlob->GetBufferPointer(), g_pVertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)

View File

@ -1,4 +1,7 @@
// ImGui Win32 + DirectX11 binding
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
struct ID3D11Device;

View File

@ -1,4 +1,7 @@
// ImGui Win32 + DirectX9 binding
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
#include <imgui.h>

View File

@ -1,4 +1,7 @@
// ImGui Win32 + DirectX9 binding
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
struct IDirect3DDevice9;

View File

@ -1,14 +1,14 @@
# iOS example
----
## Introduction
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.
## How to Use
----
0. In Synergy, go to Preferences, and uncheck "Use SSL encryption"
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. If you had previously connected to a server, you may need to kill and re-start the app.
----
## Notes and TODOs
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.
* Copy/Paste not well-supported
----
## 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.

View File

@ -20,6 +20,8 @@
MemSize=6000000
MemSizeDebug=6000000
DispFixRot=FixedLandscape
# emulate iphone 5 resolution, change these settings to emulate other display resolution
WinWidth=1136
WinHeight=640

View File

@ -17,151 +17,160 @@ static double g_Time = 0.0f;
static bool g_MousePressed[3] = { false, false, false };
static float g_MouseWheel = 0.0f;
static CIwTexture* g_FontTexture = 0;
static int g_KeyboardGetCharAvailable = 0 ;
static char* g_ClipboardText = 0 ;
static bool g_osdKeyboardEnabled = false ;
// use this setting to scale the interface - e.g. on device you could use 2 or 3 scale factor
static ImVec2 g_scale = ImVec2(1.0f,1.0f) ;
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
void ImGui_Marmalade_RenderDrawLists(ImDrawData* draw_data)
{
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
ImGuiIO& io = ImGui::GetIO();
float fb_height = io.DisplaySize.y * io.DisplayFramebufferScale.y;
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
ImGuiIO& io = ImGui::GetIO();
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
// Render command lists
for(int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
const unsigned char* vtx_buffer = (const unsigned char*)&cmd_list->VtxBuffer.front();
const ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
int nVert = cmd_list->VtxBuffer.size() ;
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2,nVert) ;
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2,nVert) ;
CIwColour* pColStream = IW_GX_ALLOC(CIwColour,nVert) ;
// Render command lists
for(int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
const unsigned char* vtx_buffer = (const unsigned char*)&cmd_list->VtxBuffer.front();
const ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
int nVert = cmd_list->VtxBuffer.size() ;
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2,nVert) ;
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2,nVert) ;
CIwColour* pColStream = IW_GX_ALLOC(CIwColour,nVert) ;
for( int i=0; i < nVert; i++ ) {
pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x ;
pVertStream[i].y = cmd_list->VtxBuffer[i].pos.y ;
pUVStream[i].x = cmd_list->VtxBuffer[i].uv.x ;
pUVStream[i].y = cmd_list->VtxBuffer[i].uv.y ;
pColStream[i] = cmd_list->VtxBuffer[i].col ;
}
for( int i=0; i < nVert; i++ ) {
// todo - optimize multiplication on gpu using vertex shader
pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x * g_scale.x ;
pVertStream[i].y = cmd_list->VtxBuffer[i].pos.y * g_scale.y ;
pUVStream[i].x = cmd_list->VtxBuffer[i].uv.x ;
pUVStream[i].y = cmd_list->VtxBuffer[i].uv.y ;
pColStream[i] = cmd_list->VtxBuffer[i].col ;
}
IwGxSetVertStreamScreenSpace(pVertStream,nVert) ;
IwGxSetUVStream(pUVStream) ;
IwGxSetColStream(pColStream,nVert) ;
IwGxSetNormStream(0) ;
IwGxSetVertStreamScreenSpace(pVertStream,nVert) ;
IwGxSetUVStream(pUVStream) ;
IwGxSetColStream(pColStream,nVert) ;
IwGxSetNormStream(0) ;
for(int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
{
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
if(pcmd->UserCallback)
{
pcmd->UserCallback(cmd_list,pcmd);
}
else
{
CIwMaterial* pCurrentMaterial = IW_GX_ALLOC_MATERIAL() ;
pCurrentMaterial->SetShadeMode(CIwMaterial::SHADE_FLAT) ;
pCurrentMaterial->SetCullMode(CIwMaterial::CULL_NONE) ;
pCurrentMaterial->SetFiltering(false) ;
pCurrentMaterial->SetAlphaMode(CIwMaterial::ALPHA_BLEND) ;
pCurrentMaterial->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_NORMAL);
pCurrentMaterial->SetAlphaTestMode(CIwMaterial::ALPHATEST_DISABLED);
pCurrentMaterial->SetTexture((CIwTexture*)pcmd->TextureId) ;
IwGxSetMaterial(pCurrentMaterial) ;
for(int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
{
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
if(pcmd->UserCallback)
{
pcmd->UserCallback(cmd_list,pcmd);
}
else
{
CIwMaterial* pCurrentMaterial = IW_GX_ALLOC_MATERIAL() ;
pCurrentMaterial->SetShadeMode(CIwMaterial::SHADE_FLAT) ;
pCurrentMaterial->SetCullMode(CIwMaterial::CULL_NONE) ;
pCurrentMaterial->SetFiltering(false) ;
pCurrentMaterial->SetAlphaMode(CIwMaterial::ALPHA_BLEND) ;
pCurrentMaterial->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_NORMAL);
pCurrentMaterial->SetAlphaTestMode(CIwMaterial::ALPHATEST_DISABLED);
pCurrentMaterial->SetTexture((CIwTexture*)pcmd->TextureId) ;
IwGxSetMaterial(pCurrentMaterial) ;
IwGxDrawPrims(IW_GX_TRI_LIST,(uint16*)idx_buffer,pcmd->ElemCount) ;
}
idx_buffer += pcmd->ElemCount;
}
IwGxFlush() ;
}
IwGxDrawPrims(IW_GX_TRI_LIST,(uint16*)idx_buffer,pcmd->ElemCount) ;
}
idx_buffer += pcmd->ElemCount;
}
IwGxFlush() ;
}
// TODO restore modified state (i.e. mvp matrix)
// TODO restore modified state (i.e. mvp matrix)
}
static const char* ImGui_Marmalade_GetClipboardText()
{
static char clipBuf[512] ;
if(s3eClipboardAvailable()) {
s3eClipboardGetText( clipBuf, 512 );
}
else {
clipBuf[0] = '\0' ;
}
if(s3eClipboardAvailable()) {
int size = s3eClipboardGetText( NULL, 0 );
if( size > 0 ) {
if(g_ClipboardText) {
delete[] g_ClipboardText ;
g_ClipboardText = 0 ;
}
g_ClipboardText = new char[size] ;
g_ClipboardText[0] = '\0' ;
s3eClipboardGetText(g_ClipboardText,size) ;
}
}
return clipBuf ;
return g_ClipboardText ;
}
static void ImGui_Marmalade_SetClipboardText(const char* text)
{
if( s3eClipboardAvailable() ) {
s3eClipboardSetText(text);
}
if( s3eClipboardAvailable() ) {
s3eClipboardSetText(text);
}
}
int32 ImGui_Marmalade_PointerButtonEventCallback(void* SystemData,void* pUserData)
{
// pEvent->m_Button is of type s3ePointerButton and indicates which mouse
// button was pressed. For touchscreens this should always have the value
// S3E_POINTER_BUTTON_SELECT
s3ePointerEvent* pEvent = (s3ePointerEvent*)SystemData ;
// pEvent->m_Button is of type s3ePointerButton and indicates which mouse
// button was pressed. For touchscreens this should always have the value
// S3E_POINTER_BUTTON_SELECT
s3ePointerEvent* pEvent = (s3ePointerEvent*)SystemData ;
if(pEvent->m_Pressed==1) {
if(pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE) {
g_MousePressed[0] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_RIGHTMOUSE) {
g_MousePressed[1] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MIDDLEMOUSE) {
g_MousePressed[2] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELUP) {
g_MouseWheel += pEvent->m_y ;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELDOWN) {
g_MouseWheel += pEvent->m_y ;
}
}
if(pEvent->m_Pressed==1) {
if(pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE) {
g_MousePressed[0] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_RIGHTMOUSE) {
g_MousePressed[1] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MIDDLEMOUSE) {
g_MousePressed[2] = true;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELUP) {
g_MouseWheel += pEvent->m_y ;
}
if(pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELDOWN) {
g_MouseWheel += pEvent->m_y ;
}
}
return 0;
return 0;
}
//void ImGui_Marmalade_ScrollCallback(GLFWwindow*,double /*xoffset*/,double yoffset)
//void ImGui_Marmalade_ScrollCallback(double /*xoffset*/,double yoffset)
//{
// g_MouseWheel += (float)yoffset; // Use fractional mouse wheel, 1.0 unit 5 lines.
// g_MouseWheel += (float)yoffset; // Use fractional mouse wheel, 1.0 unit 5 lines.
//}
int32 ImGui_Marmalade_KeyCallback(void* SystemData, void* userData)
{
ImGuiIO& io = ImGui::GetIO();
s3eKeyboardEvent* e = (s3eKeyboardEvent*)SystemData ;
if( e->m_Pressed == 1 ) {
io.KeysDown[e->m_Key] = true;
}
if(e->m_Pressed == 0) {
io.KeysDown[e->m_Key] = false;
}
io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN ;
io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN ;
io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN ;
ImGuiIO& io = ImGui::GetIO();
s3eKeyboardEvent* e = (s3eKeyboardEvent*)SystemData ;
if( e->m_Pressed == 1 ) {
io.KeysDown[e->m_Key] = true;
}
if(e->m_Pressed == 0) {
io.KeysDown[e->m_Key] = false;
}
io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN ;
io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN ;
io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN ;
return 0 ;
return 0 ;
}
int32 ImGui_Marmalade_CharCallback(void* SystemData,void* userData)
{
ImGuiIO& io = ImGui::GetIO();
ImGuiIO& io = ImGui::GetIO();
s3eKeyboardCharEvent* e = (s3eKeyboardCharEvent*)SystemData ;
if( (e->m_Char > 0 && e->m_Char < 0x10000) && io.WantTextInput ) {
io.AddInputCharacter((unsigned short)e->m_Char);
}
s3eKeyboardCharEvent* e = (s3eKeyboardCharEvent*)SystemData ;
if( (e->m_Char > 0 && e->m_Char < 0x10000) ) {
io.AddInputCharacter((unsigned short)e->m_Char);
}
return 0 ;
return 0 ;
}
bool ImGui_Marmalade_CreateDeviceObjects()
@ -174,17 +183,17 @@ bool ImGui_Marmalade_CreateDeviceObjects()
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
// Create texture
g_FontTexture = new CIwTexture() ;
g_FontTexture->SetModifiable(true) ;
CIwImage& image = g_FontTexture->GetImage() ;
image.SetFormat(CIwImage::Format::ARGB_8888) ;
image.SetWidth(width) ;
image.SetHeight(height) ;
image.SetBuffers(); // allocates and own buffers
image.ReadTexels(pixels) ;
g_FontTexture->SetMipMapping(false) ;
g_FontTexture->SetFiltering(false) ;
g_FontTexture->Upload() ;
g_FontTexture = new CIwTexture() ;
g_FontTexture->SetModifiable(true) ;
CIwImage& image = g_FontTexture->GetImage() ;
image.SetFormat(CIwImage::ARGB_8888) ;
image.SetWidth(width) ;
image.SetHeight(height) ;
image.SetBuffers(); // allocates and own buffers
image.ReadTexels(pixels) ;
g_FontTexture->SetMipMapping(false) ;
g_FontTexture->SetFiltering(false) ;
g_FontTexture->Upload() ;
// Store the pointer
io.Fonts->TexID = (void *)g_FontTexture;
@ -198,6 +207,11 @@ bool ImGui_Marmalade_CreateDeviceObjects()
void ImGui_Marmalade_InvalidateDeviceObjects()
{
if(g_ClipboardText) {
delete[] g_ClipboardText ;
g_ClipboardText = 0 ;
}
if (g_FontTexture)
{
delete g_FontTexture ;
@ -208,7 +222,7 @@ void ImGui_Marmalade_InvalidateDeviceObjects()
bool ImGui_Marmalade_Init( bool install_callbacks)
{
IwGxInit() ;
IwGxInit() ;
ImGuiIO& io = ImGui::GetIO();
io.KeyMap[ImGuiKey_Tab] = s3eKeyTab; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
@ -237,16 +251,10 @@ bool ImGui_Marmalade_Init( bool install_callbacks)
if (install_callbacks)
{
s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,ImGui_Marmalade_PointerButtonEventCallback,0) ;
s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT,ImGui_Marmalade_KeyCallback,0) ;
// enable KEYBOARD_GET_CHAR
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR,1) ;
g_KeyboardGetCharAvailable = s3eKeyboardGetInt(S3E_KEYBOARD_GET_CHAR) ;
if( g_KeyboardGetCharAvailable ) {
s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT,ImGui_Marmalade_CharCallback,0) ;
}
}
s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,ImGui_Marmalade_PointerButtonEventCallback,0) ;
s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT,ImGui_Marmalade_KeyCallback,0) ;
s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT,ImGui_Marmalade_CharCallback,0) ;
}
return true;
}
@ -255,43 +263,34 @@ void ImGui_Marmalade_Shutdown()
{
ImGui_Marmalade_InvalidateDeviceObjects();
ImGui::Shutdown();
IwGxTerminate();
IwGxTerminate();
}
void ImGui_Marmalade_NewFrame()
{
if (!g_FontTexture)
if (!g_FontTexture) {
ImGui_Marmalade_CreateDeviceObjects();
}
ImGuiIO& io = ImGui::GetIO();
// Setup display size (every frame to accommodate for window resizing)
int w = IwGxGetScreenWidth(), h = IwGxGetScreenHeight() ;
io.DisplaySize = ImVec2((float)w, (float)h);
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
io.DisplayFramebufferScale = ImVec2((float)1.0f, (float)1.0f);
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
io.DisplayFramebufferScale = g_scale;
// Setup time step
double current_time = s3eTimerGetUST() / 1000.0f ;
io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
g_Time = current_time;
// Setup inputs
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
//if ( gui_has_focus() )
//{
double mouse_x, mouse_y;
mouse_x = s3ePointerGetX();
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.)
//}
//else
//{
// io.MousePos = ImVec2(-1,-1);
//}
double mouse_x, mouse_y;
mouse_x = s3ePointerGetX();
mouse_y = s3ePointerGetY();
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.)
for (int i = 0; i < 3; i++)
{
for (int i = 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.
g_MousePressed[i] = false;
}
@ -300,8 +299,22 @@ void ImGui_Marmalade_NewFrame()
g_MouseWheel = 0.0f;
// Hide OS mouse cursor if ImGui is drawing it
// s3ePointerSetInt(S3E_POINTER_HIDE_CURSOR,(io.MouseDrawCursor ? 0 : 1));
// s3ePointerSetInt(S3E_POINTER_HIDE_CURSOR,(io.MouseDrawCursor ? 0 : 1));
// Start the frame
ImGui::NewFrame();
// show/hide OSD keyboard
if( io.WantTextInput ) { // some text input widget is active?
if( !g_osdKeyboardEnabled ) {
g_osdKeyboardEnabled = true ;
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR,1) ; // show OSD keyboard
}
}
else { // no text input widget is active
if(g_osdKeyboardEnabled) {
g_osdKeyboardEnabled = false ;
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR,0) ; // hide OSD keyboard
}
}
}

View File

@ -13,7 +13,7 @@ IMGUI_API bool ImGui_Marmalade_CreateDeviceObjects();
// callbacks (installed by default if you enable 'install_callbacks' during initialization)
// You can also handle inputs yourself and use those as a reference.
IMGUI_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* SystemData,void* pUserData);
IMGUI_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* SystemData,void* pUserData);
//IMGUI_API void ImGui_Marmalade_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
IMGUI_API int32 ImGui_Marmalade_KeyCallback(void* SystemData,void* userData);
IMGUI_API int32 ImGui_Marmalade_CharCallback(void* SystemData,void* userData);
IMGUI_API int32 ImGui_Marmalade_KeyCallback(void* SystemData,void* userData);
IMGUI_API int32 ImGui_Marmalade_CharCallback(void* SystemData,void* userData);

View File

@ -8,36 +8,38 @@
define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
define _snprintf=snprintf
options
{
optimise-speed=1
optimise-speed=1
cxx11
}
includepaths
{
../..
../..
}
subprojects
{
iwgx
iwgx
}
files
{
(.)
["imgui"]
../../imgui.cpp
../../imgui_demo.cpp
../../imgui_draw.cpp
../../imconfig.h
../../imgui.h
(.)
["imgui"]
../../imgui.cpp
../../imgui_demo.cpp
../../imgui_draw.cpp
../../imconfig.h
../../imgui.h
../../imgui_internal.h
["imgui","Marmalade binding"]
imgui_impl_marmalade.h
imgui_impl_marmalade.cpp
main.cpp
["imgui","Marmalade binding"]
imgui_impl_marmalade.h
imgui_impl_marmalade.cpp
main.cpp
}

View File

@ -1,4 +1,7 @@
// ImGui GLFW binding with OpenGL3 + shaders
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
#include <imgui.h>

View File

@ -1,4 +1,7 @@
// ImGui GLFW binding with OpenGL3 + shaders
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
struct GLFWwindow;

View File

@ -1,4 +1,7 @@
// ImGui GLFW binding with OpenGL
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
#include <imgui.h>

View File

@ -1,4 +1,7 @@
// ImGui GLFW binding with OpenGL
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
struct GLFWwindow;

View File

@ -1,4 +1,7 @@
// ImGui SDL2 binding with OpenGL
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
#include <SDL.h>

View File

@ -1,4 +1,7 @@
// ImGui SDL2 binding with OpenGL
// 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().
// See main.cpp for an example of using this.
// https://github.com/ocornut/imgui
struct SDL_Window;