diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defs.h | 3 | ||||
-rw-r--r-- | src/render_cpu.c | 21 | ||||
-rw-r--r-- | src/render_opencl.c | 20 |
3 files changed, 27 insertions, 17 deletions
@@ -25,9 +25,6 @@ #define MODE_CPU 0 #define MODE_OPENCL 1 -// Available keys - - typedef unsigned char u8; typedef signed char s8; diff --git a/src/render_cpu.c b/src/render_cpu.c index 8f8d439..64fc9ec 100644 --- a/src/render_cpu.c +++ b/src/render_cpu.c @@ -131,17 +131,26 @@ void mouse_cpu(int button, int state, int x, int y) { if (state == GLUT_DOWN) { - switch(button) + switch (button) { case GLUT_LEFT_BUTTON: - config_cpu->to_x = x_min + ((d64) x * (x_max - x_min)) / config_cpu->width; - config_cpu->to_y = y_min + ((d64) (config_cpu->height - y) * (y_max - y_min)) / config_cpu->height; - t_old_cpu = glutGet(GLUT_ELAPSED_TIME); - glutIdleFunc(idle_cpu); + if (config_cpu->speed < 0) + config_cpu->speed = (-1) * config_cpu->speed; break; case GLUT_RIGHT_BUTTON: - glutIdleFunc(idle_cpu_dummy); + if (config_cpu->speed > 0) + config_cpu->speed = (-1) * config_cpu->speed; break; } + config_cpu->to_x = x_min + + ((d64) x * (x_max - x_min)) / config_cpu->width; + config_cpu->to_y = y_min + + ((d64) y * (y_max - y_min)) / config_cpu->height; + t_old_cpu = glutGet(GLUT_ELAPSED_TIME); + glutIdleFunc(idle_cpu); + } + else if (state == GLUT_UP) + { + glutIdleFunc(idle_cpu_dummy); } } 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); } } |