- Timestamp:
- 07/23/2017 10:17:42 AM (7 years ago)
- Branches:
- master
- Children:
- a23f3d9
- Parents:
- a1fd5d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/cpu.c
ra1fd5d5 rbb4fd0c 92 92 static void hw_init(void) 93 93 { 94 inf(" initializing hardware");94 inf("starting hardware"); 95 95 96 96 for (int32_t i = 0; i < ARRAY_COUNT(hw_map); ++i) { 97 97 hw_map[i].init(); 98 } 99 } 100 101 static void hw_quit(void) 102 { 103 inf("halting hardware"); 104 105 for (int32_t i = 0; i < ARRAY_COUNT(hw_map); ++i) { 106 hw_map[i].quit(); 98 107 } 99 108 } … … 611 620 612 621 bool run = true; 622 bool down = false; 613 623 614 624 while (run) { … … 621 631 622 632 while (SDL_PollEvent(&ev) > 0) { 623 if (ev.type == SDL_QUIT) { 633 // Work around duplicate key-down events on Linux. 634 635 if (ev.type == SDL_KEYDOWN) { 636 if (down) { 637 continue; 638 } 639 640 down = true; 641 } 642 else if (ev.type == SDL_KEYUP) { 643 down = false; 644 } 645 646 if (ev.type == SDL_QUIT || 647 (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_ESCAPE)) { 624 648 run = false; 649 continue; 650 } 651 652 if (ev.type == SDL_TEXTINPUT) { 653 ser_text(&ev.text); 654 continue; 655 } 656 657 if (ev.type == SDL_KEYDOWN) { 658 ser_key(&ev.key); 659 continue; 625 660 } 626 661 } … … 632 667 633 668 inf("leaving CPU loop"); 634 } 669 hw_quit(); 670 }
Note:
See TracChangeset
for help on using the changeset viewer.