Esempio n. 1
0
void CEngine::Init()
{
	atexit(SDL_Quit);
	if(SDL_Init(SDL_INIT_VIDEO < 0))
	{
		fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
		exit(1);
	}
	SetSize(m_iWidth, m_iHeight);
	if(m_pScreen == NULL)
	{
		fprintf(stderr, "unable to set video: %s\n", SDL_GetError());
		exit(1);
	}
	AdditionalInit();
}
Esempio n. 2
0
/** Initialize SDL, the window and the additional data. **/
void CEngine::Init()
{
	// Register SDL_Quit to be called at exit; makes sure things are cleaned up when we quit.
	atexit( SDL_Quit );

	// Initialize SDL's subsystems - in this case, only video.
	if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
	{
		fprintf( stderr, "Unable to init SDL: %s\n", SDL_GetError() );
		exit( 1 );
	}

	// Attempt to create a window with the specified height and width.
	SetSize( m_iWidth, m_iHeight );

	// If we fail, return error.
	if ( m_pScreen == NULL )
	{
		fprintf( stderr, "Unable to set up video: %s\n", SDL_GetError() );
		exit( 1 );
	}

	AdditionalInit();
}