From f6ecdf87b278d62a7259bca573e81484ad9932f6 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Wed, 31 Jan 2018 23:23:46 +0100 Subject: improved controls - hold mouse left to zoom to desired point - hold mouse right to zoom out from that point - press/hold i to increase iterations - press/hold d to decrease iterations - dont press anything to pause --- src/render_opencl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/render_opencl.c') diff --git a/src/render_opencl.c b/src/render_opencl.c index 127bae2..055a7f3 100644 --- a/src/render_opencl.c +++ b/src/render_opencl.c @@ -310,17 +310,21 @@ void mouse_opencl(int button, int state, int x, int y) switch (button) { case GLUT_LEFT_BUTTON: - config_opencl->to_x = x_min_cl - + ((d64) x * (x_max_cl - x_min_cl)) / config_opencl->width; - config_opencl->to_y = y_min_cl - + ((d64) (config_opencl->height - y) * (y_max_cl - y_min_cl)) - / config_opencl->height; - t_old_opencl = glutGet(GLUT_ELAPSED_TIME); - glutIdleFunc(idle_opencl); + if (config_opencl->speed < 0) + config_opencl->speed = (-1) * config_opencl->speed; break; case GLUT_RIGHT_BUTTON: - glutIdleFunc(idle_opencl_dummy); + if (config_opencl->speed > 0) + config_opencl->speed = (-1) * config_opencl->speed; break; } + config_opencl->to_x = x_min_cl + ((d64) x * (x_max_cl - x_min_cl)) / config_opencl->width; + config_opencl->to_y = y_min_cl + ((d64) y * (y_max_cl - y_min_cl)) / config_opencl->height; + t_old_opencl = glutGet(GLUT_ELAPSED_TIME); + glutIdleFunc(idle_opencl); + } + else if(state == GLUT_UP) + { + glutIdleFunc(idle_opencl_dummy); } } -- cgit v1.2.1