samples;
float refresh_rate;
- v2f mouse,
+ double mouse_pos[2];
+ v2f
+ mouse_delta,
mouse_wheel;
/* Runtime */
int gamepad_ready;
const char *gamepad_name;
int gamepad_id;
+ int gamepad_use_trackpad_look;
}
VG_STATIC vg = { .time_rate = 1.0 };
void vg_mouse_callback( GLFWwindow* ptrW, double xpos, double ypos )
{
- vg.mouse[0] = xpos;
- vg.mouse[1] = ypos;
+ vg.mouse_delta[0] += xpos - vg.mouse_pos[0];
+ vg.mouse_delta[1] += ypos - vg.mouse_pos[1];
+
+ vg.mouse_pos[0] = xpos;
+ vg.mouse_pos[1] = ypos;
}
void vg_scroll_callback( GLFWwindow* ptrW, double xoffset, double yoffset )
glfwSetCharCallback( vg.window, console_proc_wchar );
glfwSetKeyCallback( vg.window, console_proc_key );
- glfwSetInputMode( vg.window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN );
+ glfwSetInputMode( vg.window, GLFW_CURSOR, GLFW_CURSOR_DISABLED );
+
+ if( glfwRawMouseMotionSupported() )
+ glfwSetInputMode( vg.window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE );
if( !gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) )
{
if( glfwWindowShouldClose( vg.window ) )
break;
- v2_copy( (v2f){ 0.0f, 0.0f }, vg.mouse_wheel );
+ v2_zero( vg.mouse_wheel );
+ v2_zero( vg.mouse_delta );
+
glfwPollEvents();
vg.time_real_last = vg.time_real;
vg.engine_stage = k_engine_stage_ui;
{
ui_begin( vg.window_x, vg.window_y );
- ui_set_mouse( vg.mouse[0], vg.mouse[1],
- vg_get_button_state( "primary" ) );
+
+ /* TODO */
+ ui_set_mouse( vg.mouse_pos[0], vg.mouse_pos[1], 0 );
vg_profile_drawn(
(struct vg_profile *[]){&vg_prof_update,&vg_prof_render}, 2,