- Timestamp:
- 07/30/2017 06:06:21 PM (7 years ago)
- Branches:
- master
- Children:
- 1efc42c
- Parents:
- a6da9fb
- Location:
- emu
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/all.h
ra6da9fb rcaff491 61 61 extern int32_t led_verbose; 62 62 extern int32_t kbd_verbose; 63 64 extern SDL_Window *sdl_win;65 extern SDL_Renderer *sdl_ren;66 63 67 64 extern void sdl_init(void); -
emu/sdl.c
ra6da9fb rcaff491 24 24 #define ver3(...) _ver(sdl_verbose, 2, __VA_ARGS__) 25 25 26 SDL_Window *sdl_win;27 SDL_Renderer *sdl_ren;28 29 26 void sdl_init(void) 30 27 { … … 41 38 42 39 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); 43 44 sdl_win = SDL_CreateWindow("Emu", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,45 WIN_W, WIN_H, 0);46 47 if (sdl_win == NULL) {48 fail("SDL_CreateWindow() failed: %s", SDL_GetError());49 }50 51 sdl_ren = SDL_CreateRenderer(sdl_win, -1, 0);52 53 if (sdl_ren == NULL) {54 fail("SDL_CreateRenderer() failed: %s", SDL_GetError());55 }56 57 40 SDL_StartTextInput(); 58 41 } … … 60 43 void sdl_quit(void) 61 44 { 62 SDL_DestroyRenderer(sdl_ren);63 SDL_DestroyWindow(sdl_win);64 45 TTF_Quit(); 65 46 SDL_Quit(); -
emu/ser.c
ra6da9fb rcaff491 55 55 static uint8_t mem[CON_H][CON_W + 1]; 56 56 57 static SDL_Window *win; 58 static SDL_Renderer *ren; 59 57 60 static TTF_Font *fon; 58 61 static int32_t fon_w, fon_h; … … 63 66 static int32_t cur_x = 0, cur_y = 0; 64 67 static int32_t bel = 0; 65 66 static void out(int32_t un, uint8_t c)67 {68 state[un].rdr = c;69 state[un].rdr_ok = true;70 state[un].irq_r = true;71 }72 68 73 69 static void update(void) … … 105 101 } 106 102 107 SDL_Texture *tex = SDL_CreateTextureFromSurface( sdl_ren, sur);103 SDL_Texture *tex = SDL_CreateTextureFromSurface(ren, sur); 108 104 109 105 if (tex == NULL) { … … 111 107 } 112 108 113 if (SDL_RenderCopy( sdl_ren, tex, NULL, NULL) < 0) {109 if (SDL_RenderCopy(ren, tex, NULL, NULL) < 0) { 114 110 fail("SDL_RenderCopy() failed: %s", SDL_GetError()); 115 111 } 116 112 117 113 SDL_DestroyTexture(tex); 118 SDL_RenderPresent( sdl_ren);114 SDL_RenderPresent(ren); 119 115 } 120 116 … … 201 197 } 202 198 199 static void out(int32_t un, uint8_t c) 200 { 201 state[un].rdr = c; 202 state[un].rdr_ok = true; 203 state[un].irq_r = true; 204 } 205 203 206 void ser_key(SDL_KeyboardEvent *ev) 204 207 { … … 233 236 ver("ser init"); 234 237 238 win = SDL_CreateWindow("Serial Console", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 239 WIN_W, WIN_H, 0); 240 241 if (win == NULL) { 242 fail("SDL_CreateWindow() failed: %s", SDL_GetError()); 243 } 244 245 ren = SDL_CreateRenderer(win, -1, 0); 246 247 if (ren == NULL) { 248 fail("SDL_CreateRenderer() failed: %s", SDL_GetError()); 249 } 250 235 251 SDL_RWops *ops = SDL_RWFromFile(CON_FONT, "rb"); 236 252 … … 277 293 SDL_FreeSurface(sur); 278 294 TTF_CloseFont(fon); 295 296 SDL_DestroyRenderer(ren); 297 SDL_DestroyWindow(win); 279 298 } 280 299
Note:
See TracChangeset
for help on using the changeset viewer.