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