mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Windows: setup a default handler for ImeSetInputScreenPosFn so IME (Japanese/Chinese) inputs are positioned correctly.
User need to set io.ImeWindowHandle
This commit is contained in:
@ -448,7 +448,9 @@ void InitImGui()
|
||||
io.KeyMap[ImGuiKey_X] = 'X';
|
||||
io.KeyMap[ImGuiKey_Y] = 'Y';
|
||||
io.KeyMap[ImGuiKey_Z] = 'Z';
|
||||
|
||||
io.RenderDrawListsFn = ImImpl_RenderDrawLists;
|
||||
io.ImeWindowHandle = hWnd;
|
||||
|
||||
// Create the vertex buffer
|
||||
{
|
||||
|
@ -240,6 +240,7 @@ void InitImGui()
|
||||
io.KeyMap[ImGuiKey_Z] = 'Z';
|
||||
|
||||
io.RenderDrawListsFn = ImImpl_RenderDrawLists;
|
||||
io.ImeWindowHandle = hWnd;
|
||||
|
||||
// Create the vertex buffer
|
||||
if (g_pd3dDevice->CreateVertexBuffer(10000 * sizeof(CUSTOMVERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL) < 0)
|
||||
|
@ -10,14 +10,21 @@
|
||||
#include "../../imgui.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// Gl3w/Glfw
|
||||
// Gl3W / GLFW
|
||||
#include <GL/gl3w.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
#ifdef _MSC_VER
|
||||
#undef APIENTRY
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#include <GLFW/glfw3native.h>
|
||||
#endif
|
||||
|
||||
static GLFWwindow* window;
|
||||
static bool mousePressed[2] = { false, false };
|
||||
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
|
||||
// Shader variables
|
||||
static int shader_handle, vert_handle, frag_handle;
|
||||
static int texture_location, proj_mtx_location;
|
||||
@ -279,6 +286,9 @@ void InitImGui()
|
||||
io.RenderDrawListsFn = ImImpl_RenderDrawLists;
|
||||
io.SetClipboardTextFn = ImImpl_SetClipboardTextFn;
|
||||
io.GetClipboardTextFn = ImImpl_GetClipboardTextFn;
|
||||
#ifdef _MSC_VER
|
||||
io.ImeWindowHandle = glfwGetWin32Window(window);
|
||||
#endif
|
||||
|
||||
LoadFontsTexture();
|
||||
}
|
||||
|
@ -10,13 +10,20 @@
|
||||
#include "../../imgui.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// Glfw
|
||||
// GLFW
|
||||
#include <GLFW/glfw3.h>
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
#ifdef _MSC_VER
|
||||
#undef APIENTRY
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#include <GLFW/glfw3native.h>
|
||||
#endif
|
||||
|
||||
static GLFWwindow* window;
|
||||
static bool mousePressed[2] = { false, false };
|
||||
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||
// If text or lines are blurry when integrating ImGui in your engine:
|
||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
@ -92,7 +99,7 @@ static void ImImpl_SetClipboardTextFn(const char* text)
|
||||
glfwSetClipboardString(window, text);
|
||||
}
|
||||
|
||||
// GLFW callbacks to get events
|
||||
// GLFW callbacks
|
||||
static void glfw_error_callback(int error, const char* description)
|
||||
{
|
||||
fputs(description, stderr);
|
||||
@ -190,6 +197,9 @@ void InitImGui()
|
||||
io.RenderDrawListsFn = ImImpl_RenderDrawLists;
|
||||
io.SetClipboardTextFn = ImImpl_SetClipboardTextFn;
|
||||
io.GetClipboardTextFn = ImImpl_GetClipboardTextFn;
|
||||
#ifdef _MSC_VER
|
||||
io.ImeWindowHandle = glfwGetWin32Window(window);
|
||||
#endif
|
||||
|
||||
LoadFontsTexture();
|
||||
}
|
||||
|
Reference in New Issue
Block a user