@ -33,7 +33,7 @@ static GLuint g_FontTexture = 0;
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// 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:
// 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)
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
void ImGui_ImplGlfw _RenderDrawLists( ImDrawData * draw_data )
void ImGui_ImplGlfw GL2 _RenderDrawLists( ImDrawData * draw_data )
{
{
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
@ -126,18 +126,18 @@ static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
glfwSetClipboardString ( ( GLFWwindow * ) user_data , text ) ;
glfwSetClipboardString ( ( GLFWwindow * ) user_data , text ) ;
}
}
void ImGui_ImplGlfw _MouseButtonCallback( GLFWwindow * , int button , int action , int /*mods*/ )
void ImGui_ImplGlfw GL2 _MouseButtonCallback( GLFWwindow * , int button , int action , int /*mods*/ )
{
{
if ( action = = GLFW_PRESS & & button > = 0 & & button < 3 )
if ( action = = GLFW_PRESS & & button > = 0 & & button < 3 )
g_MousePressed [ button ] = true ;
g_MousePressed [ button ] = true ;
}
}
void ImGui_ImplGlfw _ScrollCallback( GLFWwindow * , double /*xoffset*/ , double yoffset )
void ImGui_ImplGlfw GL2 _ScrollCallback( GLFWwindow * , 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.
}
}
void ImGui_ImplGl Fw _KeyCallback( GLFWwindow * , int key , int , int action , int mods )
void ImGui_ImplGl fwGL2 _KeyCallback( GLFWwindow * , int key , int , int action , int mods )
{
{
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
if ( action = = GLFW_PRESS )
if ( action = = GLFW_PRESS )
@ -152,14 +152,14 @@ void ImGui_ImplGlFw_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
io . KeySuper = io . KeysDown [ GLFW_KEY_LEFT_SUPER ] | | io . KeysDown [ GLFW_KEY_RIGHT_SUPER ] ;
io . KeySuper = io . KeysDown [ GLFW_KEY_LEFT_SUPER ] | | io . KeysDown [ GLFW_KEY_RIGHT_SUPER ] ;
}
}
void ImGui_ImplGlfw _CharCallback( GLFWwindow * , unsigned int c )
void ImGui_ImplGlfw GL2 _CharCallback( GLFWwindow * , unsigned int c )
{
{
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
if ( c > 0 & & c < 0x10000 )
if ( c > 0 & & c < 0x10000 )
io . AddInputCharacter ( ( unsigned short ) c ) ;
io . AddInputCharacter ( ( unsigned short ) c ) ;
}
}
bool ImGui_ImplGlfw _CreateDeviceObjects( )
bool ImGui_ImplGlfw GL2 _CreateDeviceObjects( )
{
{
// Build texture atlas
// Build texture atlas
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
@ -185,7 +185,7 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
return true ;
return true ;
}
}
void ImGui_ImplGlfw _InvalidateDeviceObjects( )
void ImGui_ImplGlfw GL2 _InvalidateDeviceObjects( )
{
{
if ( g_FontTexture )
if ( g_FontTexture )
{
{
@ -195,7 +195,7 @@ void ImGui_ImplGlfw_InvalidateDeviceObjects()
}
}
}
}
bool ImGui_ImplGlfw _Init( GLFWwindow * window , bool install_callbacks )
bool ImGui_ImplGlfw GL2 _Init( GLFWwindow * window , bool install_callbacks )
{
{
g_Window = window ;
g_Window = window ;
@ -220,7 +220,7 @@ bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks)
io . KeyMap [ ImGuiKey_Y ] = GLFW_KEY_Y ;
io . KeyMap [ ImGuiKey_Y ] = GLFW_KEY_Y ;
io . KeyMap [ ImGuiKey_Z ] = GLFW_KEY_Z ;
io . KeyMap [ ImGuiKey_Z ] = GLFW_KEY_Z ;
io . RenderDrawListsFn = ImGui_ImplGlfw _RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
io . RenderDrawListsFn = ImGui_ImplGlfw GL2 _RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
io . SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText ;
io . SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText ;
io . GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText ;
io . GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText ;
io . ClipboardUserData = g_Window ;
io . ClipboardUserData = g_Window ;
@ -230,25 +230,25 @@ bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks)
if ( install_callbacks )
if ( install_callbacks )
{
{
glfwSetMouseButtonCallback ( window , ImGui_ImplGlfw _MouseButtonCallback) ;
glfwSetMouseButtonCallback ( window , ImGui_ImplGlfw GL2 _MouseButtonCallback) ;
glfwSetScrollCallback ( window , ImGui_ImplGlfw _ScrollCallback) ;
glfwSetScrollCallback ( window , ImGui_ImplGlfw GL2 _ScrollCallback) ;
glfwSetKeyCallback ( window , ImGui_ImplGl Fw _KeyCallback) ;
glfwSetKeyCallback ( window , ImGui_ImplGl fwGL2 _KeyCallback) ;
glfwSetCharCallback ( window , ImGui_ImplGlfw _CharCallback) ;
glfwSetCharCallback ( window , ImGui_ImplGlfw GL2 _CharCallback) ;
}
}
return true ;
return true ;
}
}
void ImGui_ImplGlfw _Shutdown( )
void ImGui_ImplGlfw GL2 _Shutdown( )
{
{
ImGui_ImplGlfw _InvalidateDeviceObjects( ) ;
ImGui_ImplGlfw GL2 _InvalidateDeviceObjects( ) ;
ImGui : : Shutdown ( ) ;
ImGui : : Shutdown ( ) ;
}
}
void ImGui_ImplGlfw _NewFrame( )
void ImGui_ImplGlfw GL2 _NewFrame( )
{
{
if ( ! g_FontTexture )
if ( ! g_FontTexture )
ImGui_ImplGlfw _CreateDeviceObjects( ) ;
ImGui_ImplGlfw GL2 _CreateDeviceObjects( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;
ImGuiIO & io = ImGui : : GetIO ( ) ;