comparison test/common.c @ 3186:51750b7a966f

indent
author Sam Lantinga <slouken@libsdl.org>
date Wed, 10 Jun 2009 13:34:20 +0000
parents 68d3b48a6002
children c18c03927a77
comparison
equal deleted inserted replaced
3185:44d5474c2c8a 3186:51750b7a966f
9 "[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display %d] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" 9 "[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display %d] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
10 10
11 #define AUDIO_USAGE \ 11 #define AUDIO_USAGE \
12 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" 12 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
13 13
14 struct pformat { 14 struct pformat
15 {
15 Uint32 id; 16 Uint32 id;
16 const char* idstr; 17 const char *idstr;
17 } pixel_format[]={ 18 } pixel_format[] = {
18 {SDL_PIXELFORMAT_INDEX1LSB, "SDL_PIXELFORMAT_INDEX1LSB"}, 19 {
19 {SDL_PIXELFORMAT_INDEX1MSB, "SDL_PIXELFORMAT_INDEX1MSB"}, 20 SDL_PIXELFORMAT_INDEX1LSB, "SDL_PIXELFORMAT_INDEX1LSB"}, {
20 {SDL_PIXELFORMAT_INDEX4LSB, "SDL_PIXELFORMAT_INDEX4LSB"}, 21 SDL_PIXELFORMAT_INDEX1MSB, "SDL_PIXELFORMAT_INDEX1MSB"}, {
21 {SDL_PIXELFORMAT_INDEX4MSB, "SDL_PIXELFORMAT_INDEX4MSB"}, 22 SDL_PIXELFORMAT_INDEX4LSB, "SDL_PIXELFORMAT_INDEX4LSB"}, {
22 {SDL_PIXELFORMAT_INDEX8, "SDL_PIXELFORMAT_INDEX8"}, 23 SDL_PIXELFORMAT_INDEX4MSB, "SDL_PIXELFORMAT_INDEX4MSB"}, {
23 {SDL_PIXELFORMAT_RGB332, "SDL_PIXELFORMAT_RGB332"}, 24 SDL_PIXELFORMAT_INDEX8, "SDL_PIXELFORMAT_INDEX8"}, {
24 {SDL_PIXELFORMAT_RGB444, "SDL_PIXELFORMAT_RGB444"}, 25 SDL_PIXELFORMAT_RGB332, "SDL_PIXELFORMAT_RGB332"}, {
25 {SDL_PIXELFORMAT_RGB555, "SDL_PIXELFORMAT_RGB555"}, 26 SDL_PIXELFORMAT_RGB444, "SDL_PIXELFORMAT_RGB444"}, {
26 {SDL_PIXELFORMAT_BGR555, "SDL_PIXELFORMAT_BGR555"}, 27 SDL_PIXELFORMAT_RGB555, "SDL_PIXELFORMAT_RGB555"}, {
27 {SDL_PIXELFORMAT_ARGB4444, "SDL_PIXELFORMAT_ARGB4444"}, 28 SDL_PIXELFORMAT_BGR555, "SDL_PIXELFORMAT_BGR555"}, {
28 {SDL_PIXELFORMAT_ABGR4444, "SDL_PIXELFORMAT_ABGR4444"}, 29 SDL_PIXELFORMAT_ARGB4444, "SDL_PIXELFORMAT_ARGB4444"}, {
29 {SDL_PIXELFORMAT_ARGB1555, "SDL_PIXELFORMAT_ARGB1555"}, 30 SDL_PIXELFORMAT_ABGR4444, "SDL_PIXELFORMAT_ABGR4444"}, {
30 {SDL_PIXELFORMAT_ABGR1555, "SDL_PIXELFORMAT_ABGR1555"}, 31 SDL_PIXELFORMAT_ARGB1555, "SDL_PIXELFORMAT_ARGB1555"}, {
31 {SDL_PIXELFORMAT_RGB565, "SDL_PIXELFORMAT_RGB565"}, 32 SDL_PIXELFORMAT_ABGR1555, "SDL_PIXELFORMAT_ABGR1555"}, {
32 {SDL_PIXELFORMAT_BGR565, "SDL_PIXELFORMAT_BGR565"}, 33 SDL_PIXELFORMAT_RGB565, "SDL_PIXELFORMAT_RGB565"}, {
33 {SDL_PIXELFORMAT_RGB24, "SDL_PIXELFORMAT_RGB24"}, 34 SDL_PIXELFORMAT_BGR565, "SDL_PIXELFORMAT_BGR565"}, {
34 {SDL_PIXELFORMAT_BGR24, "SDL_PIXELFORMAT_BGR24"}, 35 SDL_PIXELFORMAT_RGB24, "SDL_PIXELFORMAT_RGB24"}, {
35 {SDL_PIXELFORMAT_RGB888, "SDL_PIXELFORMAT_RGB888"}, 36 SDL_PIXELFORMAT_BGR24, "SDL_PIXELFORMAT_BGR24"}, {
36 {SDL_PIXELFORMAT_BGR888, "SDL_PIXELFORMAT_BGR888"}, 37 SDL_PIXELFORMAT_RGB888, "SDL_PIXELFORMAT_RGB888"}, {
37 {SDL_PIXELFORMAT_ARGB8888, "SDL_PIXELFORMAT_ARGB8888"}, 38 SDL_PIXELFORMAT_BGR888, "SDL_PIXELFORMAT_BGR888"}, {
38 {SDL_PIXELFORMAT_RGBA8888, "SDL_PIXELFORMAT_RGBA8888"}, 39 SDL_PIXELFORMAT_ARGB8888, "SDL_PIXELFORMAT_ARGB8888"}, {
39 {SDL_PIXELFORMAT_ABGR8888, "SDL_PIXELFORMAT_ABGR8888"}, 40 SDL_PIXELFORMAT_RGBA8888, "SDL_PIXELFORMAT_RGBA8888"}, {
40 {SDL_PIXELFORMAT_BGRA8888, "SDL_PIXELFORMAT_BGRA8888"}, 41 SDL_PIXELFORMAT_ABGR8888, "SDL_PIXELFORMAT_ABGR8888"}, {
41 {SDL_PIXELFORMAT_ARGB2101010, "SDL_PIXELFORMAT_ARGB2101010"}, 42 SDL_PIXELFORMAT_BGRA8888, "SDL_PIXELFORMAT_BGRA8888"}, {
42 {SDL_PIXELFORMAT_YV12, "SDL_PIXELFORMAT_YV12"}, 43 SDL_PIXELFORMAT_ARGB2101010, "SDL_PIXELFORMAT_ARGB2101010"}, {
43 {SDL_PIXELFORMAT_IYUV, "SDL_PIXELFORMAT_IYUV"}, 44 SDL_PIXELFORMAT_YV12, "SDL_PIXELFORMAT_YV12"}, {
44 {SDL_PIXELFORMAT_YUY2, "SDL_PIXELFORMAT_YUY2"}, 45 SDL_PIXELFORMAT_IYUV, "SDL_PIXELFORMAT_IYUV"}, {
45 {SDL_PIXELFORMAT_UYVY, "SDL_PIXELFORMAT_UYVY"}, 46 SDL_PIXELFORMAT_YUY2, "SDL_PIXELFORMAT_YUY2"}, {
46 {SDL_PIXELFORMAT_YVYU, "SDL_PIXELFORMAT_YVYU"} 47 SDL_PIXELFORMAT_UYVY, "SDL_PIXELFORMAT_UYVY"}, {
48 SDL_PIXELFORMAT_YVYU, "SDL_PIXELFORMAT_YVYU"}
47 }; 49 };
48 50
49 const char* PixelFormatToString(Uint32 pformat) 51 const char *
50 { 52 PixelFormatToString(Uint32 pformat)
51 Uint32 it=0; 53 {
52 54 Uint32 it = 0;
53 do { 55
54 if (pixel_format[it].idstr == NULL) { 56 do {
55 break; 57 if (pixel_format[it].idstr == NULL) {
56 } 58 break;
57 if (pixel_format[it].id == pformat) { 59 }
58 return pixel_format[it].idstr; 60 if (pixel_format[it].id == pformat) {
59 } 61 return pixel_format[it].idstr;
60 it++; 62 }
61 } while(1); 63 it++;
62 64 } while (1);
63 return "SDL_PIXELFORMAT_UNKNOWN"; 65
66 return "SDL_PIXELFORMAT_UNKNOWN";
64 } 67 }
65 68
66 CommonState * 69 CommonState *
67 CommonCreateState(char **argv, Uint32 flags) 70 CommonCreateState(char **argv, Uint32 flags)
68 { 71 {
704 break; 707 break;
705 } 708 }
706 fullscreen_mode.w = state->window_w; 709 fullscreen_mode.w = state->window_w;
707 fullscreen_mode.h = state->window_h; 710 fullscreen_mode.h = state->window_h;
708 fullscreen_mode.refresh_rate = state->refresh_rate; 711 fullscreen_mode.refresh_rate = state->refresh_rate;
709 if (SDL_SetFullscreenDisplayMode(&fullscreen_mode)<0) { 712 if (SDL_SetFullscreenDisplayMode(&fullscreen_mode) < 0) {
710 fprintf(stderr, "Can't switch to fullscreen display mode: %s\n", 713 fprintf(stderr, "Can't switch to fullscreen display mode: %s\n",
711 SDL_GetError()); 714 SDL_GetError());
712 return SDL_FALSE; 715 return SDL_FALSE;
713 } 716 }
714 717