From d029e67223a1a4afa74375e81c82f1f5266bcff0 Mon Sep 17 00:00:00 2001 From: Joel de Vahl Date: Sun, 9 Dec 2007 15:43:18 +0000 Subject: Doubleclick to join server. Correct name on disconnect. --- src/engine/client/inp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/engine/client/inp.c') diff --git a/src/engine/client/inp.c b/src/engine/client/inp.c index ce973246..2a82196c 100644 --- a/src/engine/client/inp.c +++ b/src/engine/client/inp.c @@ -20,6 +20,8 @@ static struct static unsigned char input_state[2][1024] = {{0}, {0}}; static int input_current = 0; +static unsigned int last_release = 0; +static unsigned int release_delta = -1; void inp_mouse_relative(int *x, int *y) { @@ -72,7 +74,14 @@ static void mousebutton_callback(int button, int action) if(action == GLFW_PRESS) input_count[input_current^1][KEY_MOUSE_FIRST+button].presses++; if(action == GLFW_RELEASE) + { + if(button == 0) + { + release_delta = time_get() - last_release; + last_release = time_get(); + } input_count[input_current^1][KEY_MOUSE_FIRST+button].releases++; + } input_state[input_current^1][KEY_MOUSE_FIRST+button] = action; } @@ -134,6 +143,11 @@ void inp_mouse_mode_relative() glfwDisable(GLFW_MOUSE_CURSOR); } +int inp_mouse_doubleclick() +{ + return release_delta < (time_freq() >> 2); +} + int inp_key_presses(int key) { return input_count[input_current][key].presses; -- cgit 1.4.1