diff options
| author | erdgeist <erdgeist@bauklotz.fritz.box> | 2018-04-16 15:37:20 +0200 | 
|---|---|---|
| committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2018-04-16 15:37:20 +0200 | 
| commit | ed5ec5c193630c230e4a4d3a1a8b0f218381511b (patch) | |
| tree | 290352200fef48338d3f126c966a4cfbce6d5f23 /main-sdl.c | |
| parent | 8c978328b0d69216a1e60c3330c07d83c1408e12 (diff) | |
Add normalizing and pitch bending delay code
Diffstat (limited to 'main-sdl.c')
| -rw-r--r-- | main-sdl.c | 17 | 
1 files changed, 16 insertions, 1 deletions
| @@ -34,7 +34,8 @@ enum { | |||
| 34 | int g_harfe_connected = 0; | 34 | int g_harfe_connected = 0; | 
| 35 | int g_harfe_fd = -1; | 35 | int g_harfe_fd = -1; | 
| 36 | 36 | ||
| 37 | static int g_up_pressed = 0, g_down_pressed = 0; | 37 | static int g_up_pressed, g_down_pressed, g_mouse_down; | 
| 38 | static LPoint g_last_mouse; | ||
| 38 | 39 | ||
| 39 | static char * | 40 | static char * | 
| 40 | find_harfe() | 41 | find_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 | ||
