MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / main

Function main

deps/SDL2/test/testrendertarget.c:251–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251int
252main(int argc, char *argv[])
253{
254 int i;
255 int frames;
256 Uint32 then, now;
257
258 /* Enable standard application logging */
259 SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
260
261 /* Initialize test framework */
262 state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
263 if (!state) {
264 return 1;
265 }
266 for (i = 1; i < argc;) {
267 int consumed;
268
269 consumed = SDLTest_CommonArg(state, i);
270 if (consumed == 0) {
271 consumed = -1;
272 if (SDL_strcasecmp(argv[i], "--composite") == 0) {
273 test_composite = SDL_TRUE;
274 consumed = 1;
275 }
276 }
277 if (consumed < 0) {
278 static const char *options[] = { "[--composite]", NULL };
279 SDLTest_CommonLogUsage(state, argv[0], options);
280 quit(1);
281 }
282 i += consumed;
283 }
284 if (!SDLTest_CommonInit(state)) {
285 quit(2);
286 }
287
288 drawstates = SDL_stack_alloc(DrawState, state->num_windows);
289 for (i = 0; i < state->num_windows; ++i) {
290 DrawState *drawstate = &drawstates[i];
291
292 drawstate->window = state->windows[i];
293 drawstate->renderer = state->renderers[i];
294 if (test_composite) {
295 drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE);
296 } else {
297 drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE);
298 }
299 drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE);
300 if (!drawstate->sprite || !drawstate->background) {
301 quit(2);
302 }
303 SDL_QueryTexture(drawstate->sprite, NULL, NULL,
304 &drawstate->sprite_rect.w, &drawstate->sprite_rect.h);
305 drawstate->scale_direction = 1;
306 }
307
308 /* Main render loop */

Callers

nothing calls this directly

Calls 12

SDL_LogSetPriorityFunction · 0.85
SDLTest_CommonArgFunction · 0.85
SDL_strcasecmpFunction · 0.85
SDLTest_CommonLogUsageFunction · 0.85
SDLTest_CommonInitFunction · 0.85
SDL_QueryTextureFunction · 0.85
SDL_LogFunction · 0.85
quitFunction · 0.70
LoadTextureFunction · 0.70
loopFunction · 0.70
SDL_GetTicksFunction · 0.50

Tested by

no test coverage detected