- Timestamp:
- 07/30/2017 06:06:21 PM (7 years ago)
- Branches:
- master
- Children:
- 1efc42c
- Parents:
- a6da9fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.