summaryrefslogtreecommitdiff
path: root/main-sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'main-sdl.c')
-rw-r--r--main-sdl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/main-sdl.c b/main-sdl.c
index b61806b..2ac648c 100644
--- a/main-sdl.c
+++ b/main-sdl.c
@@ -34,7 +34,8 @@ enum {
34int g_harfe_connected = 0; 34int g_harfe_connected = 0;
35int g_harfe_fd = -1; 35int g_harfe_fd = -1;
36 36
37static int g_up_pressed = 0, g_down_pressed = 0; 37static int g_up_pressed, g_down_pressed, g_mouse_down;
38static LPoint g_last_mouse;
38 39
39static char * 40static char *
40find_harfe() 41find_harfe()
@@ -387,6 +388,12 @@ handle_keydown(SDL_Event *ev) {
387 write(g_harfe_fd, "ME20020\nM824C00\n", 16); 388 write(g_harfe_fd, "ME20020\nM824C00\n", 16);
388 } 389 }
389 break; 390 break;
391 case SDL_SCANCODE_N:
392 engine_toggle_normalize_mode();
393 break;
394 case SDL_SCANCODE_P:
395 config_flip_pitch();
396 break;
390 case SDL_SCANCODE_Q: 397 case SDL_SCANCODE_Q:
391 config_reset(); 398 config_reset();
392 break; 399 break;
@@ -472,6 +479,8 @@ main(int argc, char **argv)
472 if (ev.motion.state & SDL_BUTTON_LMASK) { 479 if (ev.motion.state & SDL_BUTTON_LMASK) {
473 LPoint p = { display_scale_screen_to_harfe(ev.motion.x), 768 - display_scale_screen_to_harfe(ev.motion.y) }; 480 LPoint p = { display_scale_screen_to_harfe(ev.motion.x), 768 - display_scale_screen_to_harfe(ev.motion.y) };
474 engine_handle_point(&p, now()); 481 engine_handle_point(&p, now());
482 g_last_mouse = p;
483 engine_mouse_y((65336 * (SCREEN_HEIGHT-ev.motion.y))/ SCREEN_HEIGHT);
475 } 484 }
476 break; 485 break;
477 case SDL_MOUSEBUTTONDOWN: 486 case SDL_MOUSEBUTTONDOWN:
@@ -479,12 +488,15 @@ main(int argc, char **argv)
479 LPoint p = { display_scale_screen_to_harfe(ev.button.x), 768 - display_scale_screen_to_harfe(ev.button.y) }; 488 LPoint p = { display_scale_screen_to_harfe(ev.button.x), 768 - display_scale_screen_to_harfe(ev.button.y) };
480 if (menu_test_mouse_down(ev.button.x, ev.button.y)) 489 if (menu_test_mouse_down(ev.button.x, ev.button.y))
481 engine_handle_point(&p, now()); 490 engine_handle_point(&p, now());
491 g_last_mouse = p;
492 g_mouse_down = 1;
482 } 493 }
483 break; 494 break;
484 case SDL_MOUSEBUTTONUP: 495 case SDL_MOUSEBUTTONUP:
485 { 496 {
486 LPoint p = { display_scale_screen_to_harfe(ev.button.x), 768 - display_scale_screen_to_harfe(ev.button.y) }; 497 LPoint p = { display_scale_screen_to_harfe(ev.button.x), 768 - display_scale_screen_to_harfe(ev.button.y) };
487 menu_handle_button_up(ev.button.x, ev.button.y); 498 menu_handle_button_up(ev.button.x, ev.button.y);
499 g_mouse_down = 0;
488 } 500 }
489 501
490 break; 502 break;
@@ -502,6 +514,9 @@ main(int argc, char **argv)
502 break; 514 break;
503 } 515 }
504 516
517 if (g_mouse_down)
518 engine_handle_point(&g_last_mouse, now());
519
505 if (!g_calibration_running || !g_importing_config) 520 if (!g_calibration_running || !g_importing_config)
506 engine_checksilence(now()); 521 engine_checksilence(now());
507 522