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 )
vg.samples = VG_MAX( 0, VG_MIN( 8, atoi( arg ) ) );
}
- if( (arg = vg_long_opt_arg( "use-libc-malloc" )) )
+ if( vg_long_opt( "use-libc-malloc" ) )
{
vg_mem.use_libc_malloc = atoi( arg );
}
- if( (arg = vg_long_opt_arg( "high-performance" )) )
+ if( vg_long_opt( "high-performance" ) )
{
vg.quality_profile = k_quality_profile_low;
}
vg_log_init();
vg_console_init();
- vg_convar_push( (struct vg_convar){
- .name = "vg_quality",
- .data = &vg.quality_profile,
- .data_type = k_convar_dtype_i32,
- .opt_i32 = { .min=0, .max=1, .clamp=1 },
- .persistent = 0
- });
-
glfwInit();
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 );
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,