- Timestamp:
- 08/01/2017 10:32:52 PM (7 years ago)
- Branches:
- master
- Children:
- 6e313dd
- Parents:
- ea878ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/sdl.c
rea878ba rbdd5a63 51 51 SDL_Quit(); 52 52 } 53 54 void sdl_loop(void) 55 { 56 inf("entering SDL loop"); 57 58 #if defined EMU_LINUX 59 SDL_Scancode down = SDL_SCANCODE_UNKNOWN; 60 #endif 61 62 while (SDL_AtomicGet(&run) != 0) { 63 ser_sdl(); 64 65 SDL_Event ev; 66 67 while (SDL_PollEvent(&ev) > 0) { 68 #if defined EMU_LINUX 69 // Work around duplicate key-down events on Linux. 70 71 if (ev.type == SDL_KEYDOWN) { 72 if (down == ev.key.keysym.scancode) { 73 continue; 74 } 75 76 down = ev.key.keysym.scancode; 77 } 78 else if (ev.type == SDL_KEYUP) { 79 down = SDL_SCANCODE_UNKNOWN; 80 } 81 #endif 82 83 if (ev.type == SDL_QUIT || 84 (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_ESCAPE)) { 85 ver("quit"); 86 SDL_AtomicSet(&run, 0); 87 continue; 88 } 89 90 if (ev.type == SDL_TEXTINPUT) { 91 ser_text(&ev.text); 92 continue; 93 } 94 95 if (ev.type == SDL_KEYDOWN) { 96 ser_key(&ev.key); 97 continue; 98 } 99 100 SDL_Delay(50); 101 } 102 } 103 104 inf("leaving SDL loop"); 105 }
Note:
See TracChangeset
for help on using the changeset viewer.