Ejemplo n.º 1
0
int Application::startup()
{
  // Already initialised!
  if(initialised)
  {
    LOG_W("Application startup", "Application already loaded!");
    return EXIT_SUCCESS;
  }

  // Set up SDL (create window and context for OpenGL)
  ASSERT(startSDL() == EXIT_SUCCESS, "Starting SDL");

  // Set up OpenGL/GLES "propre"
  ASSERT(startGL() == EXIT_SUCCESS, "Starting OpenGL/GLES");

  // Start up resource subsystems
  ASSERT(GraphicsManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Graphics Manager");
  // Start the Audio Manager
  ASSERT(AudioManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Audio Manager");
  // Start the Font Manager
  ASSERT(FontManager::getInstance()->startup()
    == EXIT_SUCCESS, "Starting Font Manager");

  // Load the initial scene
  ASSERT(scene->startup() == EXIT_SUCCESS, "Loading initial Scene");

  // Initialisation successful!
  initialised = true;
  return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
int main (void) {
	/* center messages, etc. */
	setupRects();

	/* Basic setup */
	startSDL();

	/* load images */
	loadImages();

	/* blit them onto the screen */
	showControls();

	clearScreen(screen);

	/* go 3, 2, and 1 */
	countdown();

	/* put the paddle and the ball in the initial position */
	initiateImages();

	/* call game loop here, defined in gameloop.c, handover all the filled structs */
	initGameloop(&mainPaddle, &mainBall, screen);	
	int score = runGameloop();
	
	printf("Score: %d\n", score);

	SDL_Quit();
	
	
	return 0;
}