コード例 #1
0
ファイル: BaseEngine.cpp プロジェクト: ryan-shaw/G52CPP
/*
Initialise game-specific things.
Base class just calls InitialiseObjects() to create the moving objects
*/
int BaseEngine::GameInit()
{
	// Create the moving objects
	InitialiseObjects();
	// Set up the initial background
	SetupBackgroundBuffer();

	return 0; // success
}
コード例 #2
0
ファイル: Demo4Main.cpp プロジェクト: ikanyu/Jumping-Game
/*
Handle any key presses here.
Note that the objects themselves (e.g. player) may also check whether a key is pressed
*/
void Demo4Main::KeyDown(int iKeyCode)
{
	// NEW SWITCH
	switch ( iKeyCode )
	{
	case SDLK_ESCAPE: // End program when escape is pressed
		SetExitWithCode( 0 );
		break;
	case SDLK_SPACE: // SPACE Pauses
		switch( m_state )
		{
		case stateInit:
			// Go to state main
			m_state = stateMain;
			// Force redraw of background
			SetupBackgroundBuffer();
			// Redraw the whole screen now
			Redraw(true);
			break;
		case stateMain:
			// Go to state paused
			m_state = statePaused;
			// Force redraw of background
			SetupBackgroundBuffer();
			// Redraw the whole screen now
			Redraw(true);
			break;
		case statePaused:
			// Go to state main
			m_state = stateMain;
			// Force redraw of background
			SetupBackgroundBuffer();
			// Redraw the whole screen now
			Redraw(true);
			break;
		} // End switch on current state
		break; // End of case SPACE
	}
}
コード例 #3
0
// Override to handle a mouse press
void MyProjectMain::MouseDown( int iButton, int iX, int iY )
{
	// Redraw the background
	SetupBackgroundBuffer();
	Redraw(true); // Force total redraw
}
コード例 #4
0
ファイル: SimpleDemo.cpp プロジェクト: sydafq/CPP_CW2015
// Override to handle a mouse press
void SimpleDemo::MouseDown( int iButton, int iX, int iY )
{
	// Redraw the background
	SetupBackgroundBuffer();
	Redraw(true); // Force total redraw
}