Skip to content

Commit

Permalink
client/input: fix fps-dependent controller input
Browse files Browse the repository at this point in the history
  • Loading branch information
LizzyFleckenstein03 committed Aug 25, 2024
1 parent 765952f commit a3bc379
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/client/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,17 @@ static bool move(Axis *axis, vec3 dir)
return true;
}

static void update_camera()
static void update_camera(f64 dtime)
{
ClientEntity *entity = client_player_entity_local();
if (!entity)
return;

double delta_x = cursor_delta_x
+ get_axis(GLFW_GAMEPAD_AXIS_RIGHT_X) * client_config.gamepad_sensitivity;
double delta_y = cursor_delta_y
+ get_axis(GLFW_GAMEPAD_AXIS_RIGHT_Y) * client_config.gamepad_sensitivity;

double sensitivity = dtime * 60.0 * client_config.gamepad_sensitivity;

double delta_x = cursor_delta_x + get_axis(GLFW_GAMEPAD_AXIS_RIGHT_X) * sensitivity;
double delta_y = cursor_delta_y + get_axis(GLFW_GAMEPAD_AXIS_RIGHT_Y) * sensitivity;
pthread_rwlock_wrlock(&entity->lock_pos_rot);

entity->data.rot.y -= (f32) delta_x * M_PI / 180.0f / 8.0f;
Expand Down Expand Up @@ -293,7 +293,7 @@ void input_tick(f64 dtime)
}

if (!paused)
update_camera();
update_camera(dtime);
cursor_delta_x = 0.0;
cursor_delta_y = 0.0;

Expand Down

0 comments on commit a3bc379

Please sign in to comment.