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

Function main

deps/SDL2/Xcode-iOS/Demos/src/fireworks.c:362–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362int
363main(int argc, char *argv[])
364{
365 SDL_Window *window; /* main window */
366 SDL_GLContext context;
367 int drawableW, drawableH;
368 int done; /* should we clean up and exit? */
369
370 /* initialize SDL */
371 if (SDL_Init(SDL_INIT_VIDEO) < 0) {
372 fatalError("Could not initialize SDL");
373 }
374 /* seed the random number generator */
375 srand(time(NULL));
376 /*
377 request some OpenGL parameters
378 that may speed drawing
379 */
380 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
381 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
382 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
383 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
384 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
385 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
386 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
387
388 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
389 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
390
391 /* create main window and renderer */
392 window = SDL_CreateWindow(NULL, 0, 0, 320, 480,
393 SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
394 context = SDL_GL_CreateContext(window);
395
396 /* The window size and drawable size may be different when highdpi is enabled,
397 * due to the increased pixel density of the drawable. */
398 SDL_GetWindowSize(window, &screen_w, &screen_h);
399 SDL_GL_GetDrawableSize(window, &drawableW, &drawableH);
400
401 /* In OpenGL, point sizes are always in pixels. We don't want them looking
402 * tiny on a retina screen. */
403 pointSizeScale = (float) drawableH / (float) screen_h;
404
405 /* load the particle texture */
406 initializeTexture();
407
408 /* check if GL_POINT_SIZE_ARRAY_OES is supported
409 this is used to give each particle its own size
410 */
411 pointSizeExtensionSupported =
412 SDL_GL_ExtensionSupported("GL_OES_point_size_array");
413
414 /* set up some OpenGL state */
415 glDisable(GL_DEPTH_TEST);
416 glDisable(GL_CULL_FACE);
417
418 glMatrixMode(GL_MODELVIEW);
419 glLoadIdentity();

Callers

nothing calls this directly

Calls 15

SDL_InitFunction · 0.85
fatalErrorFunction · 0.85
SDL_GL_SetAttributeFunction · 0.85
SDL_CreateWindowFunction · 0.85
SDL_GL_CreateContextFunction · 0.85
SDL_GetWindowSizeFunction · 0.85
SDL_GL_GetDrawableSizeFunction · 0.85
updateDeltaTimeFunction · 0.85
SDL_PollEventFunction · 0.85
SDL_GetMouseStateFunction · 0.85
spawnEmitterParticleFunction · 0.85

Tested by

no test coverage detected