-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlist_modes.c
45 lines (37 loc) · 1.07 KB
/
list_modes.c
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
38
39
40
41
42
43
44
45
#include <SDL/SDL.h>
int main(int argc, char ** argv) {
SDL_Rect** modes;
const SDL_VideoInfo* info;
int i;
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
exit(1);
}
/* Get available fullscreen/hardware modes */
modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_OPENGL);
/* Check if there are any modes available */
if (modes == (SDL_Rect**)0) {
printf("No modes available!\n");
exit(-1);
}
/* Check if our resolution is restricted */
if (modes == (SDL_Rect**)-1) {
printf("All resolutions available.\n");
} else{
/* Print valid modes */
printf("Available Modes\n");
for (i=0; modes[i]; ++i) {
printf(" %d x %d\n", modes[i]->w, modes[i]->h);
}
}
info = SDL_GetVideoInfo();
printf("suggested %d bits per pixel\n", info->vfmt->BitsPerPixel);
if(info->hw_available) {
printf("hardware acceleration available\n");
}
if(info->wm_available) {
printf("window manager available\n");
}
printf("video memory: %d KB\n", info->video_mem);
return 0;
}