Skip to content

Latest commit

 

History

History
78 lines (73 loc) · 2 KB

testvidinfo.c

File metadata and controls

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