0
|
1
|
|
2 /* Simple program -- figure out what kind of video display we have */
|
|
3
|
|
4 #include <stdio.h>
|
|
5 #include <stdlib.h>
|
|
6
|
|
7 #include "SDL.h"
|
|
8
|
|
9 int main(int argc, char *argv[])
|
|
10 {
|
|
11 const SDL_VideoInfo *info;
|
|
12 int i;
|
|
13 SDL_Rect **modes;
|
|
14
|
|
15 if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
|
|
16 fprintf(stderr,
|
|
17 "Couldn't initialize SDL: %s\n", SDL_GetError());
|
|
18 exit(1);
|
|
19 }
|
|
20 info = SDL_GetVideoInfo();
|
|
21 printf(
|
|
22 "Current display: %d bits-per-pixel\n",info->vfmt->BitsPerPixel);
|
|
23 if ( info->vfmt->palette == NULL ) {
|
|
24 printf(" Red Mask = 0x%.8x\n", info->vfmt->Rmask);
|
|
25 printf(" Green Mask = 0x%.8x\n", info->vfmt->Gmask);
|
|
26 printf(" Blue Mask = 0x%.8x\n", info->vfmt->Bmask);
|
|
27 }
|
|
28 /* Print available fullscreen video modes */
|
|
29 modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
|
|
30 if ( modes == (SDL_Rect **)0 ) {
|
|
31 printf("No available fullscreen video modes\n");
|
|
32 } else
|
|
33 if ( modes == (SDL_Rect **)-1 ) {
|
|
34 printf("No special fullscreen video modes\n");
|
|
35 } else {
|
|
36 printf("Fullscreen video modes:\n");
|
|
37 for ( i=0; modes[i]; ++i ) {
|
|
38 printf("\t%dx%d\n", modes[i]->w, modes[i]->h);
|
|
39 }
|
|
40 }
|
|
41 if ( info->wm_available ) {
|
|
42 printf("A window manager is available\n");
|
|
43 }
|
|
44 if ( info->hw_available ) {
|
|
45 printf("Hardware surfaces are available (%dK video memory)\n",
|
|
46 info->video_mem);
|
|
47 }
|
|
48 if ( info->blit_hw ) {
|
|
49 printf(
|
|
50 "Copy blits between hardware surfaces are accelerated\n");
|
|
51 }
|
|
52 if ( info->blit_hw_CC ) {
|
|
53 printf(
|
|
54 "Colorkey blits between hardware surfaces are accelerated\n");
|
|
55 }
|
|
56 if ( info->blit_hw_A ) {
|
|
57 printf(
|
|
58 "Alpha blits between hardware surfaces are accelerated\n");
|
|
59 }
|
|
60 if ( info->blit_sw ) {
|
|
61 printf(
|
|
62 "Copy blits from software surfaces to hardware surfaces are accelerated\n");
|
|
63 }
|
|
64 if ( info->blit_sw_CC ) {
|
|
65 printf(
|
|
66 "Colorkey blits from software surfaces to hardware surfaces are accelerated\n");
|
|
67 }
|
|
68 if ( info->blit_sw_A ) {
|
|
69 printf(
|
|
70 "Alpha blits from software surfaces to hardware surfaces are accelerated\n");
|
|
71 }
|
|
72 if ( info->blit_fill ) {
|
|
73 printf(
|
|
74 "Color fills on hardware surfaces are accelerated\n");
|
|
75 }
|
|
76 SDL_Quit();
|
|
77 return(0);
|
|
78 }
|