diff options
| author | Joel de Vahl <joel@stalverk80.se> | 2007-12-09 15:43:18 +0000 |
|---|---|---|
| committer | Joel de Vahl <joel@stalverk80.se> | 2007-12-09 15:43:18 +0000 |
| commit | d029e67223a1a4afa74375e81c82f1f5266bcff0 (patch) | |
| tree | c0f585e9e7795f7a86be858409c26253f8f5fdc2 /src/engine/client | |
| parent | 8854bacf6d24cbb3ade4f86a1a8c848e08ceb32b (diff) | |
| download | zcatch-d029e67223a1a4afa74375e81c82f1f5266bcff0.tar.gz zcatch-d029e67223a1a4afa74375e81c82f1f5266bcff0.zip | |
Doubleclick to join server. Correct name on disconnect.
Diffstat (limited to 'src/engine/client')
| -rw-r--r-- | src/engine/client/inp.c | 14 |
1 files changed, 14 insertions, 0 deletions
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; |