//////////////////////////////////////////////////////////////////////////
// update
//virtual
void ScnParticleSystemComponent::update( BcReal Tick )
{
	///*
	// TEST CODE.
	for( BcU32 Idx = 0; Idx < 4; ++Idx )
	{
		ScnParticle* pParticle = NULL;
		if( allocParticle( pParticle ) )
		{
			pParticle->Position_ = BcVec3d( 0.0f, 0.0f, 0.0f );
			pParticle->Velocity_ = BcVec3d( BcRandom::Global.randReal() - 0.5f, BcRandom::Global.randReal() - 0.5f, BcRandom::Global.randReal() - 0.5f ).normal() * 16.0f;
			pParticle->Acceleration_ = -pParticle->Velocity_ * 0.5f;
			pParticle->RotationMultiplier_ = ( BcRandom::Global.randReal() - 0.5f ) * 4.0f;
			pParticle->MinScale_ = BcVec2d( 0.5f, 0.5f );
			pParticle->MaxScale_ = BcVec2d( 4.0f, 4.0f );
			pParticle->MinColour_ = RsColour( 1.0f, 0.0f, 1.0f, 0.1f );
			pParticle->MaxColour_ = RsColour( 0.0f, 1.0f, 1.0f, 0.0f );
			pParticle->UVBounds_ = BcVec4d( 0.0f, 0.0f, 1.0f, 1.0f );
			pParticle->CurrentTime_ = 0.0f;
			pParticle->MaxTime_ = 4.0f;
			pParticle->Alive_ = BcTrue;
		}
	}
	//*/
	

	// Allocate particles.
	updateParticles( Tick );
}
Example #2
0
////////////////////////////////////////////////////////////////////////////////
// render
//virtual
void GaMainGameState::render()
{
	// NEILO HACK: REMOVE.
	OsClient* pClient = OsCore::pImpl()->getClient( 0 );
	RsViewport Viewport( 0, 0, pClient->getWidth(), pClient->getHeight() );
	
	// Render background.
	Projection_.perspProjectionHorizontal( BcPIDIV4, (BcReal)pClient->getWidth() / (BcReal)pClient->getHeight(), 1.0f, 1024.0f );
	WorldView_.lookAt( BcVec3d( 0.0f, 350.0f, 270.0f ), BcVec3d( 0.0f, 0.0f, 0.0f ), BcVec3d( 0.0f, 0.0f, 1.0f ) );

	if( SsCore::pImpl() != NULL )
	{
		SsCore::pImpl()->setListener( BcVec3d( 0.0f, 350.0f, 270.0f ), BcVec3d( 0.0f, -4.0f, -2.0f ).normal(), BcVec3d( 0.0f, 0.0f, 1.0f  ) );
	}

	setMaterialComponentParams( BackgroundMaterialComponent_, BcMat4d() );
	Canvas_->setMaterialComponent( BackgroundMaterialComponent_ );
	Canvas_->drawSpriteCentered3D( BcVec3d( 0.0f, 0.0f, 0.0f ), WorldHalfSize_ * 4.0f, 0, RsColour::WHITE, 0 );

	// Render entities.
	for( BcU32 Idx = 0; Idx < Entities_.size(); ++Idx )
	{
		GaGameComponent* pEntity = Entities_[ Idx ];
		pEntity->render( Canvas_ );
	}

	// Draw foreground.
	BcMat4d Ortho;
	Ortho.orthoProjection( -WorldHalfSize_.x(), WorldHalfSize_.x(), -WorldHalfSize_.y(), WorldHalfSize_.y(), -1.0f, 0.0f );

	Canvas_->pushMatrix( Ortho );
	Canvas_->setMaterialComponent( ForegroundMaterialComponent_ );
	Canvas_->drawSpriteCentered( BcVec2d( 0.0f, 0.0f ), BcVec2d( WorldHalfSize_.x() * 2.2f, WorldHalfSize_.y() * -2.0f ), 0, RsColour::WHITE, 20 );

	BcReal Width = BcMax( 0.0f, FoodHealth_ - 0.5f ) * 2.0f;

	RsColour Colour;
	Colour.lerp( RsColour::RED, RsColour::GREEN, Width );

	Canvas_->setMaterialComponent( BarMaterialComponent_ );
	Canvas_->drawSpriteCentered( 
		BcVec2d( 0.0f, WorldHalfSize_.y() - ( WorldHalfSize_.y() * 0.05f ) ), 
		BcVec2d( WorldHalfSize_.x() * 1.5f * Width, WorldHalfSize_.y() * 0.05f ), 
		0, Colour, 20 );

	Canvas_->popMatrix();

	// Base render.
	GaBaseGameState::render();
}
Example #3
0
//////////////////////////////////////////////////////////////////////////
// renderSelectionHUD
void GaGameUnit::renderSelectionHUD( ScnCanvasComponentRef Canvas, BcFixed TimeFraction, BcU32 TeamID )
{
	if( Behaviour_ != BEHAVIOUR_DEAD )
	{
		BcU32 TextureIdx = Desc_.Type_;
		BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) );
		const BcReal ScaleFactor = 32.0f;
		BcVec2d Position( GamePosition.x(), GamePosition.y() );
		BcVec2d Size( Desc_.Size_.x(), Desc_.Size_.y() );

		Position *= ScaleFactor;
		Size *= ScaleFactor;

		BcVec2d PositionA( Position + ( BcVec2d( -Size.x(), -Size.y() ) * 0.45f ) );
		BcVec2d PositionB( Position + ( BcVec2d(  Size.x(), -Size.y() ) * 0.45f ) );
		BcVec2d PositionC( Position + ( BcVec2d(  Size.x(),  Size.y() ) * 0.45f ) );
		BcVec2d PositionD( Position + ( BcVec2d( -Size.x(),  Size.y() ) * 0.45f ) );
		BcVec2d SizeA( BcVec2d(  16.0f,  16.0f ) );
		BcVec2d SizeB( BcVec2d( -16.0f,  16.0f ) );
		BcVec2d SizeC( BcVec2d( -16.0f, -16.0f ) );
		BcVec2d SizeD( BcVec2d(  16.0f, -16.0f ) );

		// Draw selection marker.
		RsColour MarkerColour = TeamID == TeamID_ ? ( RsColour::WHITE ) : ( RsColour::RED ) * RsColour( 1.0f, 1.0f, 1.0f, 0.75f );
		Canvas->drawSpriteCentered( PositionA, SizeA, 2, MarkerColour, 3 );
		Canvas->drawSpriteCentered( PositionB, SizeB, 2, MarkerColour, 3 );
		Canvas->drawSpriteCentered( PositionC, SizeC, 2, MarkerColour, 3 );
		Canvas->drawSpriteCentered( PositionD, SizeD, 2, MarkerColour, 3 );
	}
}
Example #4
0
//////////////////////////////////////////////////////////////////////////
// renderHUD
void GaGameUnit::renderHUD( ScnCanvasComponentRef Canvas, BcFixed TimeFraction )
{
	if( TeamID_ > 1 )
	{
		return;
	}

	if( Behaviour_ != BEHAVIOUR_DEAD )
	{
		BcU32 TextureIdx = Desc_.Type_;
		BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) );
		const BcReal ScaleFactor = 32.0f;
		BcVec2d Position( GamePosition.x(), GamePosition.y() );
		BcVec2d Size( Desc_.Size_.x(), Desc_.Size_.y() );

		Position *= ScaleFactor;
		Size *= ScaleFactor;

		// Draw range if selected.
		const BcReal MaxRangeRadius = Desc_.Range_ / ScaleFactor;
		
		
		// Draw health bar.
		BcFixed HealthFraction = Health_ / Desc_.Health_;
		BcVec2d HealthBarPosition = Position - Size * 0.5f + BcVec2d( 2.0f, -6.0f );
		BcVec2d HealthBarSize = BcVec2d( HealthFraction * ( Size.x() - 4.0f ), 2.0f );
		RsColour HealthColour = RsColour::GREEN ;

		if( HealthFraction <= 0.5f )
		{
			HealthColour = RsColour::YELLOW;
		}
		if( HealthFraction <= 0.25f )
		{
			HealthColour = RsColour::RED;
		}

		Canvas->drawSprite( HealthBarPosition, HealthBarSize, 0, HealthColour * RsColour( 1.0f, 1.0f, 1.0f, 0.75f ), 3 );

		// Draw cool down bar.
		BcFixed MaxAttackTime = BcFixed( 1.0f ) / Desc_.RateOfAttack_;
		BcFixed CoolDownFraction = BcFixed( 1.0f ) - ( AttackTimer_ / MaxAttackTime );
		BcVec2d CoolDownBarPosition = Position - Size * 0.5f + BcVec2d( 2.0f, -4.0f );
		BcVec2d CoolDownBarSize = BcVec2d( CoolDownFraction * ( Size.x() - 4.0f ), 2.0f );
		RsColour CoolDownColour = RsColour::PURPLE;

		Canvas->drawSprite( CoolDownBarPosition, CoolDownBarSize, 0, CoolDownColour * RsColour( 1.0f, 1.0f, 1.0f, 0.75f ), 3 );
	}
}
Example #5
0
//////////////////////////////////////////////////////////////////////////
// renderShadow
void GaGameUnit::renderShadow( ScnCanvasComponentRef Canvas, BcFixed TimeFraction )
{
	if( Behaviour_ != BEHAVIOUR_DEAD )
	{
		BcU32 TextureIdx = Desc_.Type_;
		BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) );
		const BcReal ScaleFactor = 32.0f;
		BcVec2d Position( GamePosition.x(), GamePosition.y() );
		BcVec2d Size( Desc_.Size_.x(), Desc_.Size_.y() );

		Position *= ScaleFactor;
		Size *= ScaleFactor;
		Canvas->drawSpriteCentered( Position + BcVec2d( 0.0f, Size.y() * 0.5f ), Size * BcVec2d( 1.4f, 0.4f ), 8, RsColour::WHITE, 1 );
	}
}
Example #6
0
//////////////////////////////////////////////////////////////////////////
// renderRangeHUD
void GaGameUnit::renderRangeHUD( ScnCanvasComponentRef Canvas, BcFixed TimeFraction, BcU32 TeamID )
{
	if( Behaviour_ != BEHAVIOUR_DEAD )
	{
		BcU32 TextureIdx = Desc_.Type_;
		BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) );
		const BcReal ScaleFactor = 32.0f;
		BcVec2d Position( GamePosition.x(), GamePosition.y() );
		Position *= ScaleFactor;

		// Draw range markers if need be.
		if( Desc_.Range_ > 12.0f )
		{
			BcReal Radius = Desc_.Range_ * ScaleFactor;
			for( BcReal Theta = 0.0f; Theta < BcPIMUL2; Theta += (BcPIMUL2 / 48.0f ) )
			{
				BcVec2d OutPos = Position + BcVec2d( BcCos( Theta ), -BcSin( Theta ) ) * Radius;
				Canvas->drawSpriteCentered( OutPos, BcVec2d( 8.0f, 8.0f ), 3, RsColour::WHITE, 4 );
			}
		}
	}
}
Example #7
0
////////////////////////////////////////////////////////////////////////////////
// render
//virtual
void GaGameComponent::render( ScnCanvasComponentRef Canvas )
{
	BcScopedLock< BcMutex > Lock( EmoteLock_ );

	Canvas->setMaterialComponent( EmoteMaterialComponent_ );
	pParent()->setMaterialComponentParams( EmoteMaterialComponent_, BcMat4d() );

	TEmoteList::iterator It( EmoteList_.begin() );

	while( It != EmoteList_.end() )
	{
		TEmote& Emote = (*It);
		Canvas->drawSpriteCenteredUp3D( Emote.Position_, BcVec2d( 64.0f, -64.0f ), Emote.Idx_, RsColour( 1.0f, 1.0f, 1.0f, Emote.Timeleft_ ), 10 );
		++It;
	}
}
Example #8
0
//////////////////////////////////////////////////////////////////////////
// render
void GaGameUnit::render( ScnCanvasComponentRef Canvas, BcFixed TimeFraction )
{
	if( Behaviour_ != BEHAVIOUR_DEAD )
	{
		BcU32 TextureIdx = Desc_.Type_;
		BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) );
		const BcReal ScaleFactor = 32.0f;
		BcVec2d Position( GamePosition.x(), GamePosition.y() );
		BcVec2d Size( Desc_.Size_.x(), Desc_.Size_.y() );

		Position *= ScaleFactor;
		Size *= ScaleFactor;

		Position = BcVec2d( BcFloor( Position.x() ), BcFloor( Position.y() ) );

		Canvas->drawSpriteCentered( Position, Size, TextureIdx, RsColour::WHITE, 2 );
	}
}
//virtual
void ScnParticleSystemComponent::render( RsFrame* pFrame, RsRenderSort Sort )
{
	// Grab vertex buffer and flip for next frame to use.
	TVertexBuffer& VertexBuffer = VertexBuffers_[ CurrentVertexBuffer_ ];
	//CurrentVertexBuffer_ = 1 - CurrentVertexBuffer_;

	// Lock vertex buffer.
	VertexBuffer.pVertexBuffer_->lock();

	// Iterate over alive particles, and setup vertex buffer.
	BcU32 NoofParticlesToRender = 0;
	ScnParticleVertex* pVertex = VertexBuffer.pVertexArray_;
	for( BcU32 Idx = 0; Idx < NoofParticles_; ++Idx )
	{
		ScnParticle& Particle = pParticleBuffer_[ Idx ];

		if( Particle.Alive_ )
		{
			// Half size.
			const BcVec2d HalfSize = Particle.Scale_ * 0.5f;

			// Crappy rotation implementation :P
			const BcReal Radians = Particle.CurrentTime_ * Particle.RotationMultiplier_;
			BcVec2d CornerA = BcVec2d( -1.0f, -1.0f ) * HalfSize;
			BcVec2d CornerB = BcVec2d(  1.0f, -1.0f ) * HalfSize;
			BcVec2d CornerC = BcVec2d(  1.0f,  1.0f ) * HalfSize;
			BcVec2d CornerD = BcVec2d( -1.0f,  1.0f ) * HalfSize;
			if( Radians != NULL )
			{
				BcMat4d Rotation;
				Rotation.rotation( BcVec3d( 0.0f, 0.0f, Radians ) );
				CornerA = CornerA * Rotation;
				CornerB = CornerB * Rotation;
				CornerC = CornerC * Rotation;
				CornerD = CornerD * Rotation;
			}

			const BcU32 Colour = Particle.Colour_.asABGR();

			// Grab vertices.
			ScnParticleVertex& VertexA = *pVertex++;
			ScnParticleVertex& VertexB = *pVertex++;
			ScnParticleVertex& VertexC = *pVertex++;

			ScnParticleVertex& VertexD = *pVertex++;
			ScnParticleVertex& VertexE = *pVertex++;
			ScnParticleVertex& VertexF = *pVertex++;
			
			// 
			VertexA.X_ = Particle.Position_.x();
			VertexA.Y_ = Particle.Position_.y();
			VertexA.Z_ = Particle.Position_.z();
			VertexA.NX_ = CornerA.x();
			VertexA.NY_ = CornerA.y();
			VertexA.NZ_ = 0.0f;
			VertexA.U_ = Particle.UVBounds_.x();
			VertexA.V_ = Particle.UVBounds_.y();
			VertexA.RGBA_ = Colour;

			// 
			VertexB.X_ = Particle.Position_.x();
			VertexB.Y_ = Particle.Position_.y();
			VertexB.Z_ = Particle.Position_.z();
			VertexB.NX_ = CornerB.x();
			VertexB.NY_ = CornerB.y();
			VertexB.NZ_ = 0.0f;
			VertexB.U_ = Particle.UVBounds_.z();
			VertexB.V_ = Particle.UVBounds_.y();
			VertexB.RGBA_ = Colour;

			// 
			VertexC.X_ = Particle.Position_.x();
			VertexC.Y_ = Particle.Position_.y();
			VertexC.Z_ = Particle.Position_.z();
			VertexC.NX_ = CornerC.x();
			VertexC.NY_ = CornerC.y();
			VertexC.NZ_ = 0.0f;
			VertexC.U_ = Particle.UVBounds_.z();
			VertexC.V_ = Particle.UVBounds_.w();
			VertexC.RGBA_ = Colour;

			// 
			VertexD.X_ = Particle.Position_.x();
			VertexD.Y_ = Particle.Position_.y();
			VertexD.Z_ = Particle.Position_.z();
			VertexD.NX_ = CornerC.x();
			VertexD.NY_ = CornerC.y();
			VertexD.NZ_ = 0.0f;
			VertexD.U_ = Particle.UVBounds_.z();
			VertexD.V_ = Particle.UVBounds_.w();
			VertexD.RGBA_ = Colour;

			// 
			VertexE.X_ = Particle.Position_.x();
			VertexE.Y_ = Particle.Position_.y();
			VertexE.Z_ = Particle.Position_.z();
			VertexE.NX_ = CornerD.x();
			VertexE.NY_ = CornerD.y();
			VertexE.NZ_ = 0.0f;
			VertexE.U_ = Particle.UVBounds_.x();
			VertexE.V_ = Particle.UVBounds_.w();
			VertexE.RGBA_ = Colour;

			// 
			VertexF.X_ = Particle.Position_.x();
			VertexF.Y_ = Particle.Position_.y();
			VertexF.Z_ = Particle.Position_.z();
			VertexF.NX_ = CornerA.x();
			VertexF.NY_ = CornerA.y();
			VertexF.NZ_ = 0.0f;
			VertexF.U_ = Particle.UVBounds_.x();
			VertexF.V_ = Particle.UVBounds_.y();
			VertexF.RGBA_ = Colour;

			//
			++NoofParticlesToRender;
		}
	}

	// Update and unlock vertex buffer.	VertexBuffer.pVertexBuffer_->setNoofUpdateVertices( NoofParticlesToRender * 6 );
	VertexBuffer.pVertexBuffer_->unlock();

	// Bind material.
	MaterialComponent_->setParameter( WorldTransformParam_, BcMat4d() );
	MaterialComponent_->bind( pFrame, Sort );

	// Setup render node.
	ScnParticleSystemComponentRenderNode* pRenderNode = pFrame->newObject< ScnParticleSystemComponentRenderNode >();
	pRenderNode->pPrimitive_ = VertexBuffer.pPrimitive_;
	pRenderNode->NoofIndices_ = NoofParticlesToRender * 6;

	// Add to frame.
	pRenderNode->Sort_ = Sort;
	pFrame->addRenderNode( pRenderNode );
}
Example #10
0
////////////////////////////////////////////////////////////////////////////////
// enterOnce
//virtual
void GaMainGameState::enterOnce()
{
	GaBaseGameState::enterOnce();

	WorldHalfSize_.set( 320.0f, 240.0f );

	//Level = 5;

	spawnPlayerEntity();
	spawnSwarmEntity( Level );

	switch( Level )
	{
	default:
	case 6:
		spawnFoodEntity( BcVec2d( -256.0f,   0.0f ) );
		spawnFoodEntity( BcVec2d( -128.0f,   0.0f ) );
		spawnFoodEntity( BcVec2d(    0.0f,   0.0f ) );
		spawnFoodEntity( BcVec2d(  128.0f,   0.0f ) );
		spawnFoodEntity( BcVec2d(  256.0f,   0.0f ) );

	case 5:
	case 4:
		spawnFoodEntity( BcVec2d( -256.0f,   128.0f ) );
		spawnFoodEntity( BcVec2d( -128.0f,   128.0f ) );
		spawnFoodEntity( BcVec2d(    0.0f,   128.0f ) );
		spawnFoodEntity( BcVec2d(  128.0f,   128.0f ) );
		spawnFoodEntity( BcVec2d(  256.0f,   128.0f ) );

	case 3:
	case 2:
		spawnFoodEntity( BcVec2d( -256.0f,  -128.0f ) );
		spawnFoodEntity( BcVec2d(  256.0f,  -128.0f ) );

	case 1:
	case 0:
		spawnFoodEntity( BcVec2d( -128.0f,  -128.0f ) );
		spawnFoodEntity( BcVec2d(    0.0f,  -128.0f ) );
		spawnFoodEntity( BcVec2d(  128.0f,  -128.0f ) );
	}

	ScnMaterialRef Material;
	GaTopState::pImpl()->getMaterial( GaTopState::MATERIAL_BACKGROUND, Material );
	CsCore::pImpl()->createResource( BcName::INVALID, BackgroundMaterialComponent_, Material, scnSPF_DEFAULT );
	CameraEntity_->attach( BackgroundMaterialComponent_ );

	GaTopState::pImpl()->getMaterial( GaTopState::MATERIAL_FOREGROUND, Material );
	CsCore::pImpl()->createResource( BcName::INVALID, ForegroundMaterialComponent_, Material, scnSPF_DEFAULT );
	CameraEntity_->attach( ForegroundMaterialComponent_ );

	GaTopState::pImpl()->getMaterial( GaTopState::MATERIAL_BAR, Material );
	CsCore::pImpl()->createResource( BcName::INVALID, BarMaterialComponent_, Material, scnSPF_DEFAULT );
	CameraEntity_->attach( BarMaterialComponent_ );

	// Get default render context.
	pContext_ = RsCore::pImpl()->getContext( NULL );
}
Example #11
0
//////////////////////////////////////////////////////////////////////////
// GaGameComponent
//virtual
void GaGameComponent::update( BcReal Tick )
{
	BcU32 Param = FontMaterial_->findParameter( "aAlphaTestStep" );
	FontMaterial_->setParameter( Param, BcVec2d( 0.4f, 0.5f ) );

	if( GameState_ == GS_PLAYING )
	{
		pSimulator_->tick( Tick );

		if( pSimulator_->getTimeOut() > 5.0f )
		{
			GameState_ = GS_TIMEOUT;
		}

		if( pSimulator_->getUnitCount( TeamID_ ) == 0 ||
			pSimulator_->getUnitCount( 1 - TeamID_ ) == 0 )
		{
			GameState_ = GS_OVER;
		}


		if( !Networked_ )
		{
			AITickTime_ -= Tick;

			if( AITickTime_ < 0.0f )
			{
				pSimulator_->runAI( 1 - TeamID_ );
				AITickTime_ = AITickMaxTime_;
			}
		}
	}
	
	//if( TeamID_ == 0 )
	{
		if( CanvasComponent_.isValid() )
		{
			OsClient* pClient = OsCore::pImpl()->getClient( 0 );
			BcReal HW = static_cast< BcReal >( pClient->getWidth() ) / 2.0f;
			BcReal HH = static_cast< BcReal >( pClient->getHeight() ) / 2.0f;
			BcReal AspectRatio = HW / HH;

			BcMat4d Ortho;
			Ortho.orthoProjection( -HW, HW, HH, -HH, -1.0f, 1.0f );

			// Clear canvas and push projection matrix.
			CanvasComponent_->clear();   

			CanvasComponent_->pushMatrix( Ortho );

			CanvasComponent_->setMaterialComponent( BackgroundMaterial_ );
			CanvasComponent_->drawSpriteCentered( BcVec2d( 0.0f, 0.0f ), BcVec2d( 1280.0f, 720.0f ), 0, RsColour( 1.0f, 1.0f, 1.0f, 1.0f ), 0 );

			CanvasComponent_->setMaterialComponent( SpriteSheetMaterials_[ 0 ] );
			pSimulator_->render( CanvasComponent_, 0 );
			CanvasComponent_->setMaterialComponent( SpriteSheetMaterials_[ 1 ] );
			pSimulator_->render( CanvasComponent_, 1 );

			// Find unit over mouse.
			GaGameUnitIDList SelectionList;
			if( MouseDown_ )
			{
				if( BoxSelection_ )
				{
					pSimulator_->findUnits( SelectionList, StartGameCursorPosition_, EndGameCursorPosition_, BcErrorCode, BcErrorCode );
				}
			}
			else
			{
				pSimulator_->findUnits( SelectionList, GameCursorPosition_, 0.8f, BcErrorCode, BcErrorCode );
				while( SelectionList.size() > 1 )
				{
					SelectionList.pop_back();
				}
			}

			for( BcU32 Idx = 0; Idx < UnitSelection_.size(); ++Idx )
			{
				SelectionList.push_back( UnitSelection_[ Idx ] );
			}

			CanvasComponent_->setMaterialComponent( HUDMaterial_ );
			pSimulator_->renderHUD( CanvasComponent_, SelectionList, TeamID_ );
		}

		switch( GameState_ )
		{
		case GS_PLAYING:
			{
				// Draw cursor.
				CanvasComponent_->setMaterialComponent( HUDMaterial_ );
				CanvasComponent_->drawSpriteCentered( BcVec2d( CursorPosition_.x(), CursorPosition_.y() ), BcVec2d( 64.0f, 64.0f ), 1, AttackMove_ ? RsColour::RED : RsColour::WHITE, 10 );

				// Draw selection box.
				if( MouseDown_ && BoxSelection_ ) 
				{
					BcVec2d Min = BcVec2d( StartGameCursorPosition_.x(), StartGameCursorPosition_.y() ) * 32.0f;
					BcVec2d Max = BcVec2d( GameCursorPosition_.x(), GameCursorPosition_.y() ) * 32.0f;
					CanvasComponent_->drawSprite( Min, Max - Min, 0, RsColour::GREEN * RsColour( 1.0f, 1.0f, 1.0f, 0.1f ), 11 );
				}

				std::string Text0 = TeamID_ == 0 ? "YOU ARE RED!" : "YOU ARE BLUE!";
				BcVec2d TextSize0 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text0, RsColour::WHITE, BcTrue );
				Font_->draw( CanvasComponent_, ( -TextSize0 / 2.0f ) + BcVec2d( 0.0f, -350.0f ), Text0, TeamID_ == 0 ? RsColour::RED : RsColour::BLUE, BcFalse );

			}
			break;

		case GS_TIMEOUT:
			{
				std::string Text0 = "Connection timed out :(";
				std::string Text1 = "Press ESC to Quit.";
				BcVec2d TextSize0 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text0, RsColour::WHITE, BcTrue );
				Font_->draw( CanvasComponent_, ( -TextSize0 / 2.0f ) + BcVec2d( 0.0f, -64.0f ), Text0, RsColour::WHITE, BcFalse );
				BcVec2d TextSize1 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text1, RsColour::WHITE, BcTrue );
				Font_->draw( CanvasComponent_, ( -TextSize1 / 2.0f ) + BcVec2d( 0.0f, 64.0f ), Text1, RsColour::WHITE, BcFalse );
			}
			break;

		case GS_OVER:
			{
				if( pSimulator_->getUnitCount( TeamID_ ) > 0 )
				{
					std::string Text0 = "You Won! :D";
					std::string Text1 = "Press ESC to Quit.";
					BcVec2d TextSize0 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text0, RsColour::WHITE, BcTrue );
					Font_->draw( CanvasComponent_, ( -TextSize0 / 2.0f ) + BcVec2d( 0.0f, -64.0f ), Text0, RsColour::WHITE, BcFalse );
					BcVec2d TextSize1 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text1, RsColour::WHITE, BcTrue );
					Font_->draw( CanvasComponent_, ( -TextSize1 / 2.0f ) + BcVec2d( 0.0f, 64.0f ), Text1, RsColour::WHITE, BcFalse );
				}
				else
				{
					std::string Text0 = "You Lost! :<";
					std::string Text1 = "Press ESC to Quit.";
					BcVec2d TextSize0 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text0, RsColour::WHITE, BcTrue );
					Font_->draw( CanvasComponent_, ( -TextSize0 / 2.0f ) + BcVec2d( 0.0f, -64.0f ), Text0, RsColour::WHITE, BcFalse );
					BcVec2d TextSize1 = Font_->draw( CanvasComponent_, BcVec2d( 0.0f, 0.0f ), Text1, RsColour::WHITE, BcTrue );
					Font_->draw( CanvasComponent_, ( -TextSize1 / 2.0f ) + BcVec2d( 0.0f, 64.0f ), Text1, RsColour::WHITE, BcFalse );
				}
			}
			break;
		}
	}


}