comparison render_sdl.c @ 340:58a085cfc6bd

Set window title based on ROM header name
author Mike Pavone <pavone@retrodev.com>
date Wed, 15 May 2013 23:32:21 -0700
parents 80d934369fd5
children 13f994c88c34
comparison
equal deleted inserted replaced
339:80d934369fd5 340:58a085cfc6bd
13 int32_t color_map[1 << 12]; 13 int32_t color_map[1 << 12];
14 uint8_t levels[] = {0, 27, 49, 71, 87, 103, 119, 130, 146, 157, 174, 190, 206, 228, 255}; 14 uint8_t levels[] = {0, 27, 49, 71, 87, 103, 119, 130, 146, 157, 174, 190, 206, 228, 255};
15 15
16 uint32_t min_delay; 16 uint32_t min_delay;
17 17
18 void render_init(int width, int height) 18 void render_init(int width, int height, char * title)
19 { 19 {
20 if (SDL_Init(SDL_INIT_VIDEO) < 0) { 20 if (SDL_Init(SDL_INIT_VIDEO) < 0) {
21 fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); 21 fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
22 exit(1); 22 exit(1);
23 } 23 }
30 } 30 }
31 if (screen->format->BytesPerPixel < 2) { 31 if (screen->format->BytesPerPixel < 2) {
32 fprintf(stderr, "BlastEm requires at least a 16-bit surface, SDL returned a %d-bit surface\n", screen->format->BytesPerPixel * 8); 32 fprintf(stderr, "BlastEm requires at least a 16-bit surface, SDL returned a %d-bit surface\n", screen->format->BytesPerPixel * 8);
33 exit(1); 33 exit(1);
34 } 34 }
35 SDL_WM_SetCaption(title, title);
35 uint8_t b,g,r; 36 uint8_t b,g,r;
36 for (uint16_t color = 0; color < (1 << 12); color++) { 37 for (uint16_t color = 0; color < (1 << 12); color++) {
37 if (color & FBUF_SHADOW) { 38 if (color & FBUF_SHADOW) {
38 b = levels[(color >> 9) & 0x7]; 39 b = levels[(color >> 9) & 0x7];
39 g = levels[(color >> 5) & 0x7]; 40 g = levels[(color >> 5) & 0x7];