Add glfw_opengl4
This commit is contained in:
parent
8ece4186aa
commit
2c67e9200c
@ -109,6 +109,7 @@ static struct nk_glfw {
|
||||
double last_button_click;
|
||||
int is_double_click_down;
|
||||
struct nk_vec2 double_click_pos;
|
||||
float delta_time_seconds_last;
|
||||
} glfw;
|
||||
|
||||
#define NK_SHADER_VERSION "#version 450 core\n"
|
||||
@ -539,6 +540,8 @@ nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state init_state,
|
||||
glfw.is_double_click_down = nk_false;
|
||||
glfw.double_click_pos = nk_vec2(0, 0);
|
||||
|
||||
glfw.delta_time_seconds_last = (float)glfwGetTime();
|
||||
|
||||
return &glfw.ctx;
|
||||
}
|
||||
|
||||
@ -569,6 +572,11 @@ nk_glfw3_new_frame(void)
|
||||
struct nk_context *ctx = &glfw.ctx;
|
||||
struct GLFWwindow *win = glfw.win;
|
||||
|
||||
/* update the timer */
|
||||
float delta_time_now = (float)glfwGetTime();
|
||||
glfw.ctx.delta_time_seconds = delta_time_now - glfw.delta_time_seconds_last;
|
||||
glfw.delta_time_seconds_last = delta_time_now;
|
||||
|
||||
glfwGetWindowSize(win, &glfw.width, &glfw.height);
|
||||
glfwGetFramebufferSize(win, &glfw.display_width, &glfw.display_height);
|
||||
glfw.fb_scale.x = (float)glfw.display_width/(float)glfw.width;
|
||||
|
Loading…
Reference in New Issue
Block a user