Example #1
0
// Internal initialization from state
// In this case, we don't stat the file, but use the stat info
//  restored in "state" passed to us by the application
bool
ReadUserLog::InternalInitialize( const ReadUserLog::FileState &state,
								 bool set_rotations,
								 int max_rotations,
								 bool read_only )
{
	if ( m_initialized ) {
		Error( LOG_ERROR_RE_INITIALIZE, __LINE__ );
		return false;
	}

	m_state = new ReadUserLogState( state, SCORE_RECENT_THRESH );
	if (  ( m_state->InitializeError() ) || ( !m_state->Initialized() )  ) {
		Error( LOG_ERROR_STATE_ERROR, __LINE__ );
		return false;
	}

	// If max rotations specified, store it away
	if ( set_rotations ) {
		m_state->MaxRotations( max_rotations );
	}
	else {
		max_rotations = m_state->MaxRotations( );
	}

	m_match = new ReadUserLogMatch( m_state );
	return InternalInitialize( max_rotations, false, true, true, read_only );
}
Example #2
0
// Restore from state, setting the rotation parameters
bool
ReadUserLog::initialize( const ReadUserLog::FileState &state,
						 int max_rotations,
						 bool read_only )
{
	return InternalInitialize( state, true, max_rotations, read_only );
}
Example #3
0
// Initializer which allows the specifying of the max rotation level
bool
ReadUserLog::initialize( const char *filename,
						 int max_rotations,
						 bool check_for_old,
						 bool read_only )
{
	if ( m_initialized ) {
		Error( LOG_ERROR_RE_INITIALIZE, __LINE__ );
		return false;
	}

	bool handle_rotation = ( max_rotations > 0 );
	m_state = new ReadUserLogState( filename, max_rotations,
									SCORE_RECENT_THRESH );
	if ( ! m_state->Initialized() ) {
		Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
		return false;
	}
	m_match = new ReadUserLogMatch( m_state );

	if (! InternalInitialize( max_rotations,
							  check_for_old,
							  false,
							  handle_rotation,
							  read_only ) ) {
		return false;
	}

	return true;
}
Example #4
0
void Game::Run(void) {

	InternalInitialize();
	Initialize();

	running = true;

	while (running) {
		currentTicks = SDL_GetTicks();

		this->input->Update();

		if(this->input->GetKey(SDL_SCANCODE_ESCAPE)) {
			running = false;
		}

		InternalUpdate(currentTicks - lastTicks);
		Update(currentTicks - lastTicks);

		InternalRender();
//		Render();
        renderer->Present();

		lastTicks = currentTicks;
		fpsCount++;
	}

	Shutdown();
}
Example #5
0
// Restore from state, use rotation parameters from state, too.
bool
ReadUserLog::initialize( const ReadUserLog::FileState &state,
						 bool read_only )
{
	return InternalInitialize( state, false, 0, read_only );
}