author | Sam Lantinga <slouken@libsdl.org> |
Fri, 07 Jul 2006 08:05:39 +0000 | |
branch | SDL-1.3 |
changeset 1725 | 98a3207ddde8 |
parent 1668 | 4da1ee79c9af |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
/* Simple program -- figure out what kind of video display we have */ |
|
3 |
||
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
4 |
#include <stdlib.h> |
0 | 5 |
#include <stdio.h> |
6 |
#include <stdlib.h> |
|
524
1b8ea19e9ee4
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
483
diff
changeset
|
7 |
#include <string.h> |
0 | 8 |
|
9 |
#include "SDL.h" |
|
10 |
||
480
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
11 |
#define NUM_BLITS 10 |
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
12 |
#define NUM_UPDATES 500 |
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
13 |
|
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
14 |
#define FLAG_MASK (SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF | \ |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
15 |
SDL_SRCCOLORKEY | SDL_SRCALPHA | SDL_RLEACCEL | \ |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
16 |
SDL_RLEACCELOK) |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
17 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
18 |
#if 0 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
19 |
void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
20 |
PrintFlags(Uint32 flags) |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
21 |
{ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
22 |
printf("0x%8.8x", (flags & FLAG_MASK)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
23 |
if (flags & SDL_HWSURFACE) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
24 |
printf(" SDL_HWSURFACE"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
25 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
26 |
printf(" SDL_SWSURFACE"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
27 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
28 |
if (flags & SDL_FULLSCREEN) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
29 |
printf(" | SDL_FULLSCREEN"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
30 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
31 |
if (flags & SDL_DOUBLEBUF) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
32 |
printf(" | SDL_DOUBLEBUF"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
33 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
34 |
if (flags & SDL_SRCCOLORKEY) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
35 |
printf(" | SDL_SRCCOLORKEY"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
36 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
37 |
if (flags & SDL_SRCALPHA) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
38 |
printf(" | SDL_SRCALPHA"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
39 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
40 |
if (flags & SDL_RLEACCEL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
41 |
printf(" | SDL_RLEACCEL"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
42 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
43 |
if (flags & SDL_RLEACCELOK) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
44 |
printf(" | SDL_RLEACCELOK"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
45 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
46 |
} |
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
47 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
48 |
int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
49 |
RunBlitTests(SDL_Surface * screen, SDL_Surface * bmp, int blitcount) |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
50 |
{ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
51 |
int i, j; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
52 |
int maxx; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
53 |
int maxy; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
54 |
SDL_Rect dst; |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
55 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
56 |
maxx = (int) screen->w - bmp->w + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
57 |
maxy = (int) screen->h - bmp->h + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
58 |
for (i = 0; i < NUM_UPDATES; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
59 |
for (j = 0; j < blitcount; ++j) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
60 |
if (maxx) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
61 |
dst.x = rand() % maxx; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
62 |
} else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
63 |
dst.x = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
64 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
65 |
if (maxy) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
66 |
dst.y = rand() % maxy; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
67 |
} else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
68 |
dst.y = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
69 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
70 |
dst.w = bmp->w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
71 |
dst.h = bmp->h; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
72 |
SDL_BlitSurface(bmp, NULL, screen, &dst); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
73 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
74 |
SDL_Flip(screen); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
75 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
76 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
77 |
return i; |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
78 |
} |
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
79 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
80 |
int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
81 |
RunModeTests(SDL_Surface * screen) |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
82 |
{ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
83 |
Uint32 then, now; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
84 |
Uint32 frames; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
85 |
float seconds; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
86 |
int i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
87 |
Uint8 r, g, b; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
88 |
SDL_Surface *bmp, *bmpcc, *tmp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
89 |
SDL_Event event; |
480
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
90 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
91 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
92 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
93 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
94 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
95 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
96 |
/* First test fills and screen update speed */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
97 |
printf("Running color fill and fullscreen update test\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
98 |
then = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
99 |
frames = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
100 |
for (i = 0; i < 256; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
101 |
r = i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
102 |
g = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
103 |
b = 0; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
104 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
105 |
SDL_Flip(screen); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
106 |
++frames; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
107 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
108 |
for (i = 0; i < 256; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
109 |
r = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
110 |
g = i; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
111 |
b = 0; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
112 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
113 |
SDL_Flip(screen); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
114 |
++frames; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
115 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
116 |
for (i = 0; i < 256; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
117 |
r = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
118 |
g = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
119 |
b = i; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
120 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
121 |
SDL_Flip(screen); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
122 |
++frames; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
123 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
124 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
125 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
126 |
if (seconds > 0.0f) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
127 |
printf("%d fills and flips in %2.2f seconds, %2.2f FPS\n", frames, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
128 |
seconds, (float) frames / seconds); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
129 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
130 |
printf("%d fills and flips in zero seconds!n", frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
131 |
} |
480
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
132 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
133 |
/* clear the screen after fill test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
134 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
135 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
136 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
137 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
138 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
139 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
140 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
141 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
142 |
/* run the generic blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
143 |
bmp = SDL_LoadBMP("sample.bmp"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
144 |
if (!bmp) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
145 |
printf("Couldn't load sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
146 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
147 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
148 |
printf("Running freshly loaded blit test: %dx%d at %d bpp, flags: ", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
149 |
bmp->w, bmp->h, bmp->format->BitsPerPixel); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
150 |
PrintFlags(bmp->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
151 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
152 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
153 |
frames = RunBlitTests(screen, bmp, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
154 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
155 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
156 |
if (seconds > 0.0f) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
157 |
printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
158 |
NUM_BLITS * frames, frames, seconds, (float) frames / seconds); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
159 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
160 |
printf("%d blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
161 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
162 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
163 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
164 |
/* clear the screen after blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
165 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
166 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
167 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
168 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
169 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
170 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
171 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
172 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
173 |
/* run the colorkeyed blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
174 |
bmpcc = SDL_LoadBMP("sample.bmp"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
175 |
if (!bmpcc) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
176 |
printf("Couldn't load sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
177 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
178 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
179 |
printf("Running freshly loaded cc blit test: %dx%d at %d bpp, flags: ", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
180 |
bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
181 |
SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
182 |
*(Uint8 *) bmpcc->pixels); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
524
diff
changeset
|
183 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
184 |
PrintFlags(bmpcc->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
185 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
186 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
187 |
frames = RunBlitTests(screen, bmpcc, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
188 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
189 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
190 |
if (seconds > 0.0f) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
191 |
printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
192 |
NUM_BLITS * frames, frames, seconds, (float) frames / seconds); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
193 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
194 |
printf("%d cc blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
195 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
196 |
} |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
524
diff
changeset
|
197 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
198 |
/* clear the screen after cc blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
199 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
200 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
201 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
202 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
203 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
204 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
205 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
206 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
207 |
/* run the generic blit test */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
208 |
tmp = bmp; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
209 |
bmp = SDL_DisplayFormat(bmp); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
210 |
SDL_FreeSurface(tmp); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
211 |
if (!bmp) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
212 |
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
213 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
214 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
215 |
printf("Running display format blit test: %dx%d at %d bpp, flags: ", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
216 |
bmp->w, bmp->h, bmp->format->BitsPerPixel); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
217 |
PrintFlags(bmp->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
218 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
219 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
220 |
frames = RunBlitTests(screen, bmp, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
221 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
222 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
223 |
if (seconds > 0.0f) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
224 |
printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
225 |
NUM_BLITS * frames, frames, seconds, (float) frames / seconds); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
226 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
227 |
printf("%d blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
228 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
229 |
} |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
524
diff
changeset
|
230 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
231 |
/* clear the screen after blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
232 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
233 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
234 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
235 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
236 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
237 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
238 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
239 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
240 |
/* run the colorkeyed blit test */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
241 |
tmp = bmpcc; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
242 |
bmpcc = SDL_DisplayFormat(bmpcc); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
243 |
SDL_FreeSurface(tmp); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
244 |
if (!bmpcc) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
245 |
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
246 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
247 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
248 |
printf("Running display format cc blit test: %dx%d at %d bpp, flags: ", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
249 |
bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
250 |
PrintFlags(bmpcc->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
251 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
252 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
253 |
frames = RunBlitTests(screen, bmpcc, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
254 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
255 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
256 |
if (seconds > 0.0f) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
257 |
printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
258 |
NUM_BLITS * frames, frames, seconds, (float) frames / seconds); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
259 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
260 |
printf("%d cc blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
261 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
262 |
} |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
524
diff
changeset
|
263 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
264 |
/* clear the screen after cc blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
265 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
266 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
267 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
268 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
269 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
270 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
271 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
272 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
273 |
/* run the alpha blit test only if screen bpp>8 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
274 |
if (bmp->format->BitsPerPixel > 8) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
275 |
SDL_FreeSurface(bmp); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
276 |
bmp = SDL_LoadBMP("sample.bmp"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
277 |
SDL_SetAlpha(bmp, SDL_SRCALPHA, 85); /* 85 - 33% alpha */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
278 |
tmp = bmp; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
279 |
bmp = SDL_DisplayFormat(bmp); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
280 |
SDL_FreeSurface(tmp); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
281 |
if (!bmp) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
282 |
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
283 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
284 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
285 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
286 |
("Running display format alpha blit test: %dx%d at %d bpp, flags: ", |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
287 |
bmp->w, bmp->h, bmp->format->BitsPerPixel); |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
288 |
PrintFlags(bmp->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
289 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
290 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
291 |
frames = RunBlitTests(screen, bmp, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
292 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
293 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
294 |
if (seconds > 0.0f) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
295 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
296 |
("%d alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
297 |
NUM_BLITS * frames, frames, seconds, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
298 |
(float) frames / seconds); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
299 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
300 |
printf("%d alpha blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
301 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
302 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
303 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
304 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
305 |
/* clear the screen after alpha blit test */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
306 |
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
307 |
SDL_Flip(screen); |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
308 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
309 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
310 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
311 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
312 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
313 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
314 |
/* run the cc+alpha blit test only if screen bpp>8 */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
315 |
if (bmp->format->BitsPerPixel > 8) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
316 |
SDL_FreeSurface(bmpcc); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
317 |
bmpcc = SDL_LoadBMP("sample.bmp"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
318 |
SDL_SetAlpha(bmpcc, SDL_SRCALPHA, 85); /* 85 - 33% alpha */ |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
319 |
SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
320 |
*(Uint8 *) bmpcc->pixels); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
321 |
tmp = bmpcc; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
322 |
bmpcc = SDL_DisplayFormat(bmpcc); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
323 |
SDL_FreeSurface(tmp); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
324 |
if (!bmpcc) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
325 |
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
326 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
327 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
328 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
329 |
("Running display format cc+alpha blit test: %dx%d at %d bpp, flags: ", |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
330 |
bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel); |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
331 |
PrintFlags(bmpcc->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
332 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
333 |
then = SDL_GetTicks(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
334 |
frames = RunBlitTests(screen, bmpcc, NUM_BLITS); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
335 |
now = SDL_GetTicks(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
336 |
seconds = (float) (now - then) / 1000.0f; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
337 |
if (seconds > 0.0f) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
338 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
339 |
("%d cc+alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
340 |
NUM_BLITS * frames, frames, seconds, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
341 |
(float) frames / seconds); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
342 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
343 |
printf("%d cc+alpha blits / %d updates in zero seconds!\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
344 |
NUM_BLITS * frames, frames); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
345 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
346 |
} |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
347 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
348 |
SDL_FreeSurface(bmpcc); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
349 |
SDL_FreeSurface(bmp); |
480
92596bfe8446
Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents:
479
diff
changeset
|
350 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
351 |
while (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
352 |
if (event.type == SDL_KEYDOWN) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
353 |
return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
354 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
355 |
return 1; |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
356 |
} |
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
357 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
358 |
void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
359 |
RunVideoTests() |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
360 |
{ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
361 |
static const struct |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
362 |
{ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
363 |
int w, h, bpp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
364 |
} mode_list[] = { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
365 |
{ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
366 |
640, 480, 8}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
367 |
640, 480, 16}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
368 |
640, 480, 32}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
369 |
800, 600, 8}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
370 |
800, 600, 16}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
371 |
800, 600, 32}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
372 |
1024, 768, 8}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
373 |
1024, 768, 16}, { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
374 |
1024, 768, 32} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
375 |
}; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
376 |
static const Uint32 flags[] = { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
377 |
(SDL_SWSURFACE), |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
378 |
(SDL_SWSURFACE | SDL_FULLSCREEN), |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
379 |
(SDL_HWSURFACE | SDL_FULLSCREEN), |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
380 |
(SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
381 |
}; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
382 |
int i, j; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
383 |
SDL_Surface *screen; |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
384 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
385 |
/* Test out several different video mode combinations */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
386 |
SDL_WM_SetCaption("SDL Video Benchmark", "vidtest"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
387 |
SDL_ShowCursor(0); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
388 |
for (i = 0; i < SDL_TABLESIZE(mode_list); ++i) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
389 |
for (j = 0; j < SDL_TABLESIZE(flags); ++j) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
390 |
printf("===================================\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
391 |
printf("Setting video mode: %dx%d at %d bpp, flags: ", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
392 |
mode_list[i].w, mode_list[i].h, mode_list[i].bpp); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
393 |
PrintFlags(flags[j]); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
394 |
printf("\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
395 |
screen = SDL_SetVideoMode(mode_list[i].w, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
396 |
mode_list[i].h, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
397 |
mode_list[i].bpp, flags[j]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
398 |
if (!screen) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
399 |
printf("Setting video mode failed: %s\n", SDL_GetError()); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
400 |
continue; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
401 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
402 |
if ((screen->flags & FLAG_MASK) != flags[j]) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
403 |
printf("Flags didn't match: "); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
404 |
PrintFlags(screen->flags); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
405 |
printf("\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
406 |
continue; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
407 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
408 |
if (!RunModeTests(screen)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
409 |
return; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
410 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
411 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
412 |
} |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
413 |
} |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
414 |
#endif |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
415 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
416 |
int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
417 |
main(int argc, char *argv[]) |
0 | 418 |
{ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
419 |
const SDL_VideoInfo *info; |
1725
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
420 |
int i, d, n; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
421 |
const char *driver; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
422 |
const SDL_DisplayMode *mode; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
423 |
int bpp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
424 |
Uint32 Rmask, Gmask, Bmask, Amask; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
425 |
int nmodes; |
1660
8b9d79e7eacf
Added API requested in bug #43:
Sam Lantinga <slouken@libsdl.org>
parents:
1545
diff
changeset
|
426 |
|
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
427 |
/* Print available video drivers */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
428 |
n = SDL_GetNumVideoDrivers(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
429 |
if (n == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
430 |
printf("No built-in video drivers\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
431 |
} else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
432 |
printf("Built-in video drivers:"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
433 |
for (i = 0; i < n; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
434 |
if (i > 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
435 |
printf(","); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
436 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
437 |
printf(" %s", SDL_GetVideoDriver(i)); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
438 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
439 |
printf("\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
440 |
} |
0 | 441 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
442 |
if (SDL_Init(SDL_INIT_VIDEO) < 0) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
443 |
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
444 |
exit(1); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
445 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
446 |
driver = SDL_GetCurrentVideoDriver(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
447 |
if (driver) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
448 |
printf("Video driver: %s\n", driver); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
449 |
} |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
450 |
printf("Number of displays: %d\n", SDL_GetNumVideoDisplays()); |
1725
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
451 |
for (d = 0; d < SDL_GetNumVideoDisplays(); ++d) { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
452 |
printf("Display %d:\n", d); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
453 |
SDL_SelectVideoDisplay(d); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
454 |
|
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
455 |
mode = SDL_GetDesktopDisplayMode(); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
456 |
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, &Gmask, &Bmask, |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
457 |
&Amask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
458 |
printf(" Current mode: %dx%d@%dHz, %d bits-per-pixel\n", mode->w, |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
459 |
mode->h, mode->refresh_rate, bpp); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
460 |
if (Rmask || Gmask || Bmask) { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
461 |
printf(" Red Mask = 0x%.8x\n", Rmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
462 |
printf(" Green Mask = 0x%.8x\n", Gmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
463 |
printf(" Blue Mask = 0x%.8x\n", Bmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
464 |
if (Amask) |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
465 |
printf(" Alpha Mask = 0x%.8x\n", Amask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
466 |
} |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
467 |
|
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
468 |
/* Print available fullscreen video modes */ |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
469 |
nmodes = SDL_GetNumDisplayModes(); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
470 |
if (nmodes == 0) { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
471 |
printf("No available fullscreen video modes\n"); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
472 |
} else { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
473 |
printf(" Fullscreen video modes:\n"); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
474 |
for (i = 0; i < nmodes; ++i) { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
475 |
mode = SDL_GetDisplayMode(i); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
476 |
SDL_PixelFormatEnumToMasks(mode->format, &bpp, &Rmask, |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
477 |
&Gmask, &Bmask, &Amask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
478 |
printf(" Mode %d: %dx%d@%dHz, %d bits-per-pixel\n", i, |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
479 |
mode->w, mode->h, mode->refresh_rate, bpp); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
480 |
if (Rmask || Gmask || Bmask) { |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
481 |
printf(" Red Mask = 0x%.8x\n", Rmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
482 |
printf(" Green Mask = 0x%.8x\n", Gmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
483 |
printf(" Blue Mask = 0x%.8x\n", Bmask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
484 |
if (Amask) |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
485 |
printf(" Alpha Mask = 0x%.8x\n", Amask); |
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
486 |
} |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
487 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
488 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
489 |
} |
1725
98a3207ddde8
Implemented Win32 video mode support
Sam Lantinga <slouken@libsdl.org>
parents:
1668
diff
changeset
|
490 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
491 |
info = SDL_GetVideoInfo(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
492 |
if (info->wm_available) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
493 |
printf("A window manager is available\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
494 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
495 |
if (info->hw_available) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
496 |
printf("Hardware surfaces are available (%dK video memory)\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
497 |
info->video_mem); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
498 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
499 |
if (info->blit_hw) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
500 |
printf("Copy blits between hardware surfaces are accelerated\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
501 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
502 |
if (info->blit_hw_CC) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
503 |
printf("Colorkey blits between hardware surfaces are accelerated\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
504 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
505 |
if (info->blit_hw_A) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
506 |
printf("Alpha blits between hardware surfaces are accelerated\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
507 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
508 |
if (info->blit_sw) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
509 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
510 |
("Copy blits from software surfaces to hardware surfaces are accelerated\n"); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
511 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
512 |
if (info->blit_sw_CC) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
513 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
514 |
("Colorkey blits from software surfaces to hardware surfaces are accelerated\n"); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
515 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
516 |
if (info->blit_sw_A) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
517 |
printf |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
518 |
("Alpha blits from software surfaces to hardware surfaces are accelerated\n"); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
519 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
520 |
if (info->blit_fill) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
521 |
printf("Color fills on hardware surfaces are accelerated\n"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
522 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
523 |
#if 0 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
524 |
if (argv[1] && (strcmp(argv[1], "-benchmark") == 0)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
525 |
RunVideoTests(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
526 |
} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
527 |
#endif |
479
c0a1744bc2cf
Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
528 |
|
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
529 |
SDL_Quit(); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1660
diff
changeset
|
530 |
return (0); |
0 | 531 |
} |