Changeset 81d7cdc in buchla-emu
- Timestamp:
- 09/09/2017 03:16:51 PM (7 years ago)
- Branches:
- master
- Children:
- 18cbd53
- Parents:
- 1b30217
- Location:
- emu
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/all.h
r1b30217 r81d7cdc 69 69 extern uint32_t vid_win; 70 70 extern uint32_t ser_win; 71 extern uint32_t lcd_win; 71 72 72 73 extern void sdl_init(void); … … 164 165 extern void kbd_write(uint32_t off, int32_t sz, uint32_t val); 165 166 166 extern void kbd_key(SDL_KeyboardEvent *ev, bool dn);167 extern void kbd_key(SDL_KeyboardEvent *ev, bool vid, bool dn); -
emu/kbd.c
r1b30217 r81d7cdc 119 119 #endif 120 120 121 void kbd_key(SDL_KeyboardEvent *ev, bool dn)121 static void vid_key(SDL_KeyboardEvent *ev, bool dn) 122 122 { 123 123 if ((ev->keysym.mod & KMOD_SHIFT) != 0 && … … 173 173 } 174 174 175 static void lcd_key(SDL_KeyboardEvent *ev, bool dn) 176 { 177 if ((ev->keysym.mod & KMOD_CTRL) != 0 && 178 ev->keysym.sym >= SDLK_a && ev->keysym.sym <= SDLK_n) { 179 int32_t i = ev->keysym.sym - SDLK_a; 180 ver2("kbd lcd %d %s", i, dn ? "dn" : "up"); 181 182 if (dn) { 183 but_on(39 + i); 184 } 185 else { 186 but_off(39 + i); 187 } 188 } 189 } 190 191 void kbd_key(SDL_KeyboardEvent *ev, bool vid, bool dn) 192 { 193 if (vid) { 194 vid_key(ev, dn); 195 } 196 else { 197 lcd_key(ev, dn); 198 } 199 } 200 175 201 void kbd_init(void) 176 202 { -
emu/lcd.c
r1b30217 r81d7cdc 64 64 65 65 static SDL_Window *win; 66 uint32_t lcd_win; 67 66 68 static SDL_Renderer *ren; 67 69 static SDL_atomic_t frame; … … 116 118 for (int32_t y = 0; y < TXT_H; ++y) { 117 119 char line[TXT_W + 1]; 120 line[TXT_W] = 0; 118 121 119 122 if (SDL_LockMutex(cpu_mutex) < 0) { … … 132 135 } 133 136 } 134 135 line[TXT_W] = 0;136 137 137 138 SDL_Surface *lin = TTF_RenderText_Blended(fon, line, TXT_FGR); … … 207 208 } 208 209 210 lcd_win = SDL_GetWindowID(win); 211 212 if (lcd_win == 0) { 213 fail("SDL_GetWindowID() failed: %s", SDL_GetError()); 214 } 215 209 216 ren = SDL_CreateRenderer(win, -1, 0); 210 217 -
emu/sdl.c
r1b30217 r81d7cdc 161 161 } 162 162 else if (win == vid_win) { 163 kbd_key(&ev.key, true); 163 kbd_key(&ev.key, true, true); 164 } 165 else if (win == lcd_win) { 166 kbd_key(&ev.key, false, true); 164 167 } 165 168 … … 171 174 172 175 if (win == vid_win) { 173 kbd_key(&ev.key, false); 176 kbd_key(&ev.key, true, false); 177 } 178 else if (win == lcd_win) { 179 kbd_key(&ev.key, false, false); 174 180 } 175 181
Note:
See TracChangeset
for help on using the changeset viewer.