author | Sam Lantinga <slouken@libsdl.org> |
Sat, 18 May 2013 14:17:52 -0700 | |
changeset 7191 | 75360622e65f |
parent 6785 | c094c438c0a6 |
child 7517 | 965d57022c01 |
permissions | -rw-r--r-- |
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
1 |
/* |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
2 |
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org> |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
3 |
|
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
4 |
This software is provided 'as-is', without any express or implied |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
5 |
warranty. In no event will the authors be held liable for any damages |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
6 |
arising from the use of this software. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
7 |
|
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
8 |
Permission is granted to anyone to use this software for any purpose, |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
9 |
including commercial applications, and to alter it and redistribute it |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
10 |
freely. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5297
diff
changeset
|
11 |
*/ |
2901 | 12 |
|
13 |
/* Simple program: draw as many random objects on the screen as possible */ |
|
14 |
||
15 |
#include <stdlib.h> |
|
16 |
#include <stdio.h> |
|
17 |
#include <time.h> |
|
18 |
||
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
19 |
#include "SDL_test_common.h" |
2901 | 20 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
6785
diff
changeset
|
21 |
#define NUM_OBJECTS 100 |
2901 | 22 |
|
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
23 |
static SDLTest_CommonState *state; |
2901 | 24 |
static int num_objects; |
25 |
static SDL_bool cycle_color; |
|
26 |
static SDL_bool cycle_alpha; |
|
27 |
static int cycle_direction = 1; |
|
28 |
static int current_alpha = 255; |
|
29 |
static int current_color = 255; |
|
30 |
static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; |
|
31 |
||
32 |
void |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
33 |
DrawPoints(SDL_Renderer * renderer) |
2901 | 34 |
{ |
35 |
int i; |
|
36 |
int x, y; |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
37 |
SDL_Rect viewport; |
2901 | 38 |
|
39 |
/* Query the sizes */ |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
40 |
SDL_RenderGetViewport(renderer, &viewport); |
2901 | 41 |
|
2902
83c3a4b0e421
Fixed crash in testdraw2, added more points
Sam Lantinga <slouken@libsdl.org>
parents:
2901
diff
changeset
|
42 |
for (i = 0; i < num_objects * 4; ++i) { |
2901 | 43 |
/* Cycle the color and alpha, if desired */ |
44 |
if (cycle_color) { |
|
45 |
current_color += cycle_direction; |
|
46 |
if (current_color < 0) { |
|
47 |
current_color = 0; |
|
48 |
cycle_direction = -cycle_direction; |
|
49 |
} |
|
50 |
if (current_color > 255) { |
|
51 |
current_color = 255; |
|
52 |
cycle_direction = -cycle_direction; |
|
53 |
} |
|
54 |
} |
|
55 |
if (cycle_alpha) { |
|
56 |
current_alpha += cycle_direction; |
|
57 |
if (current_alpha < 0) { |
|
58 |
current_alpha = 0; |
|
59 |
cycle_direction = -cycle_direction; |
|
60 |
} |
|
61 |
if (current_alpha > 255) { |
|
62 |
current_alpha = 255; |
|
63 |
cycle_direction = -cycle_direction; |
|
64 |
} |
|
65 |
} |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
66 |
SDL_SetRenderDrawColor(renderer, 255, (Uint8) current_color, |
2901 | 67 |
(Uint8) current_color, (Uint8) current_alpha); |
68 |
||
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
69 |
x = rand() % viewport.w; |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
70 |
y = rand() % viewport.h; |
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
71 |
SDL_RenderDrawPoint(renderer, x, y); |
2901 | 72 |
} |
73 |
} |
|
74 |
||
75 |
void |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
76 |
DrawLines(SDL_Renderer * renderer) |
2901 | 77 |
{ |
78 |
int i; |
|
79 |
int x1, y1, x2, y2; |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
80 |
SDL_Rect viewport; |
2901 | 81 |
|
82 |
/* Query the sizes */ |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
83 |
SDL_RenderGetViewport(renderer, &viewport); |
2901 | 84 |
|
85 |
for (i = 0; i < num_objects; ++i) { |
|
86 |
/* Cycle the color and alpha, if desired */ |
|
87 |
if (cycle_color) { |
|
88 |
current_color += cycle_direction; |
|
89 |
if (current_color < 0) { |
|
90 |
current_color = 0; |
|
91 |
cycle_direction = -cycle_direction; |
|
92 |
} |
|
93 |
if (current_color > 255) { |
|
94 |
current_color = 255; |
|
95 |
cycle_direction = -cycle_direction; |
|
96 |
} |
|
97 |
} |
|
98 |
if (cycle_alpha) { |
|
99 |
current_alpha += cycle_direction; |
|
100 |
if (current_alpha < 0) { |
|
101 |
current_alpha = 0; |
|
102 |
cycle_direction = -cycle_direction; |
|
103 |
} |
|
104 |
if (current_alpha > 255) { |
|
105 |
current_alpha = 255; |
|
106 |
cycle_direction = -cycle_direction; |
|
107 |
} |
|
108 |
} |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
109 |
SDL_SetRenderDrawColor(renderer, 255, (Uint8) current_color, |
2901 | 110 |
(Uint8) current_color, (Uint8) current_alpha); |
111 |
||
112 |
if (i == 0) { |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
113 |
SDL_RenderDrawLine(renderer, 0, 0, viewport.w - 1, viewport.h - 1); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
114 |
SDL_RenderDrawLine(renderer, 0, viewport.h - 1, viewport.w - 1, 0); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
115 |
SDL_RenderDrawLine(renderer, 0, viewport.h / 2, viewport.w - 1, viewport.h / 2); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
116 |
SDL_RenderDrawLine(renderer, viewport.w / 2, 0, viewport.w / 2, viewport.h - 1); |
2901 | 117 |
} else { |
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
118 |
x1 = (rand() % (viewport.w*2)) - viewport.w; |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
119 |
x2 = (rand() % (viewport.w*2)) - viewport.w; |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
120 |
y1 = (rand() % (viewport.h*2)) - viewport.h; |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
121 |
y2 = (rand() % (viewport.h*2)) - viewport.h; |
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
122 |
SDL_RenderDrawLine(renderer, x1, y1, x2, y2); |
2901 | 123 |
} |
124 |
} |
|
125 |
} |
|
126 |
||
127 |
void |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
128 |
DrawRects(SDL_Renderer * renderer) |
2901 | 129 |
{ |
130 |
int i; |
|
131 |
SDL_Rect rect; |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
132 |
SDL_Rect viewport; |
2901 | 133 |
|
134 |
/* Query the sizes */ |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
135 |
SDL_RenderGetViewport(renderer, &viewport); |
2901 | 136 |
|
2902
83c3a4b0e421
Fixed crash in testdraw2, added more points
Sam Lantinga <slouken@libsdl.org>
parents:
2901
diff
changeset
|
137 |
for (i = 0; i < num_objects / 4; ++i) { |
2901 | 138 |
/* Cycle the color and alpha, if desired */ |
139 |
if (cycle_color) { |
|
140 |
current_color += cycle_direction; |
|
141 |
if (current_color < 0) { |
|
142 |
current_color = 0; |
|
143 |
cycle_direction = -cycle_direction; |
|
144 |
} |
|
145 |
if (current_color > 255) { |
|
146 |
current_color = 255; |
|
147 |
cycle_direction = -cycle_direction; |
|
148 |
} |
|
149 |
} |
|
150 |
if (cycle_alpha) { |
|
151 |
current_alpha += cycle_direction; |
|
152 |
if (current_alpha < 0) { |
|
153 |
current_alpha = 0; |
|
154 |
cycle_direction = -cycle_direction; |
|
155 |
} |
|
156 |
if (current_alpha > 255) { |
|
157 |
current_alpha = 255; |
|
158 |
cycle_direction = -cycle_direction; |
|
159 |
} |
|
160 |
} |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
161 |
SDL_SetRenderDrawColor(renderer, 255, (Uint8) current_color, |
2901 | 162 |
(Uint8) current_color, (Uint8) current_alpha); |
163 |
||
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
164 |
rect.w = rand() % (viewport.h / 2); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
165 |
rect.h = rand() % (viewport.h / 2); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
166 |
rect.x = (rand() % (viewport.w*2) - viewport.w) - (rect.w / 2); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
167 |
rect.y = (rand() % (viewport.h*2) - viewport.h) - (rect.h / 2); |
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
168 |
SDL_RenderFillRect(renderer, &rect); |
2901 | 169 |
} |
170 |
} |
|
171 |
||
172 |
int |
|
173 |
main(int argc, char *argv[]) |
|
174 |
{ |
|
175 |
int i, done; |
|
176 |
SDL_Event event; |
|
177 |
Uint32 then, now, frames; |
|
178 |
||
179 |
/* Initialize parameters */ |
|
180 |
num_objects = NUM_OBJECTS; |
|
181 |
||
182 |
/* Initialize test framework */ |
|
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
183 |
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); |
2901 | 184 |
if (!state) { |
185 |
return 1; |
|
186 |
} |
|
187 |
for (i = 1; i < argc;) { |
|
188 |
int consumed; |
|
189 |
||
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
190 |
consumed = SDLTest_CommonArg(state, i); |
2901 | 191 |
if (consumed == 0) { |
192 |
consumed = -1; |
|
193 |
if (SDL_strcasecmp(argv[i], "--blend") == 0) { |
|
194 |
if (argv[i + 1]) { |
|
195 |
if (SDL_strcasecmp(argv[i + 1], "none") == 0) { |
|
196 |
blendMode = SDL_BLENDMODE_NONE; |
|
197 |
consumed = 2; |
|
198 |
} else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) { |
|
199 |
blendMode = SDL_BLENDMODE_BLEND; |
|
200 |
consumed = 2; |
|
201 |
} else if (SDL_strcasecmp(argv[i + 1], "add") == 0) { |
|
202 |
blendMode = SDL_BLENDMODE_ADD; |
|
203 |
consumed = 2; |
|
5184
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5147
diff
changeset
|
204 |
} else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) { |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5147
diff
changeset
|
205 |
blendMode = SDL_BLENDMODE_MOD; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5147
diff
changeset
|
206 |
consumed = 2; |
2901 | 207 |
} |
208 |
} |
|
209 |
} else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) { |
|
210 |
cycle_color = SDL_TRUE; |
|
211 |
consumed = 1; |
|
212 |
} else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) { |
|
213 |
cycle_alpha = SDL_TRUE; |
|
214 |
consumed = 1; |
|
215 |
} else if (SDL_isdigit(*argv[i])) { |
|
216 |
num_objects = SDL_atoi(argv[i]); |
|
217 |
consumed = 1; |
|
218 |
} |
|
219 |
} |
|
220 |
if (consumed < 0) { |
|
221 |
fprintf(stderr, |
|
5184
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5147
diff
changeset
|
222 |
"Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n", |
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
223 |
argv[0], SDLTest_CommonUsage(state)); |
2901 | 224 |
return 1; |
225 |
} |
|
226 |
i += consumed; |
|
227 |
} |
|
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
228 |
if (!SDLTest_CommonInit(state)) { |
2901 | 229 |
return 2; |
230 |
} |
|
231 |
||
232 |
/* Create the windows and initialize the renderers */ |
|
233 |
for (i = 0; i < state->num_windows; ++i) { |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
234 |
SDL_Renderer *renderer = state->renderers[i]; |
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
235 |
SDL_SetRenderDrawBlendMode(renderer, blendMode); |
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
236 |
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); |
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
237 |
SDL_RenderClear(renderer); |
2901 | 238 |
} |
239 |
||
4884
27ab20a36eba
- added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
3685
diff
changeset
|
240 |
srand((unsigned int)time(NULL)); |
2901 | 241 |
|
242 |
/* Main render loop */ |
|
243 |
frames = 0; |
|
244 |
then = SDL_GetTicks(); |
|
245 |
done = 0; |
|
246 |
while (!done) { |
|
247 |
/* Check for events */ |
|
248 |
++frames; |
|
249 |
while (SDL_PollEvent(&event)) { |
|
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
250 |
SDLTest_CommonEvent(state, &event, &done); |
2901 | 251 |
} |
252 |
for (i = 0; i < state->num_windows; ++i) { |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
253 |
SDL_Renderer *renderer = state->renderers[i]; |
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
254 |
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); |
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
255 |
SDL_RenderClear(renderer); |
2901 | 256 |
|
5297
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
257 |
DrawRects(renderer); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
258 |
DrawLines(renderer); |
1800dc39b74c
Changed the concept of a render clip rect to a render viewport.
Sam Lantinga <slouken@libsdl.org>
parents:
5184
diff
changeset
|
259 |
DrawPoints(renderer); |
2901 | 260 |
|
5147
ad50b3db78bd
The rendering functions take a context so it's clear what window they're drawing to. This also potentially opens to the door to multi-threaded rendering in the future.
Sam Lantinga <slouken@libsdl.org>
parents:
5140
diff
changeset
|
261 |
SDL_RenderPresent(renderer); |
2901 | 262 |
} |
263 |
} |
|
264 |
||
6785
c094c438c0a6
Switched the test code over to use the common functions in the test library.
Sam Lantinga <slouken@libsdl.org>
parents:
5535
diff
changeset
|
265 |
SDLTest_CommonQuit(state); |
3371
438ba87e9578
Call CommonQuit() at exit has been added.
Mike Gorchak <lestat@i.com.ua>
parents:
2902
diff
changeset
|
266 |
|
2901 | 267 |
/* Print out some timing information */ |
268 |
now = SDL_GetTicks(); |
|
269 |
if (now > then) { |
|
270 |
double fps = ((double) frames * 1000) / (now - then); |
|
271 |
printf("%2.2f frames per second\n", fps); |
|
272 |
} |
|
273 |
return 0; |
|
274 |
} |
|
275 |
||
276 |
/* vi: set ts=4 sw=4 expandtab: */ |