diff options
author | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-31 23:23:46 +0100 |
---|---|---|
committer | Leonard Kugis <leonardkugis@gmail.com> | 2018-01-31 23:23:46 +0100 |
commit | f6ecdf87b278d62a7259bca573e81484ad9932f6 (patch) | |
tree | 14cdab0d3db74ec437f71ba1c0975d1be8896b87 /src/render_cpu.c | |
parent | cc884ee71f017d9493da22565fc33e6828da123d (diff) |
improved controlscl
- 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
Diffstat (limited to 'src/render_cpu.c')
-rw-r--r-- | src/render_cpu.c | 21 |
1 files changed, 15 insertions, 6 deletions
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); } } |