/******************************************************************************* * Title: * Blastoids * * Author: * Rob Loach ( http://www.robloach.net ) * * Description: * A simple asteroids clone. * * License: * Blastoids - a simple asteroids clone * Copyright (C) 2005 Rob Loach * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * /******************************************************************************/ #include #include "states.h" #include "lucid/lucid.h" #include "player.h" #include "asteroids.h" #include "bullets.h" #include "powerups.h" CHighScoreState* HighScoreState; CHighScoreBackButton* HighScoreBackButton; CHighScoreTextBox* HighScoreTextBox; CMainMenu* MainMenu; CMainMenuState* MainMenuState; COptionsMenu* OptionsMenu; COptionsState* OptionsState; CGameState* GameState; CGamePauseState* GamePauseState; CGamePauseMenu* GamePauseMenu; CGameScore* GameScore; CGameOver* GameOver; std::string MusicMenu; std::string MusicGame; bool HighDetail; bool ShowFPS; bool MusicOn; System::Graphics::Sprite Background; System::Graphics::ParticleSystem Particles; void DisplayFPS(){ if(ShowFPS) System::Text::Print(System::Width,System::Height,"FPS: " + System::Text::ToString(System::FPS()),150,10,10,255,2,2,"Small"); } void StartGame(){ System::SetState(GameState); Player.Initialize(); Player.PrepareForGame(); Score = 0; Asteroids::Clear(); Bullets::Clear(); Player.Status(1); Level = 0; Player.Shields(100); Player.Hull(100); Player.Lives(3); LevelUp(); System::Audio.Play("MusicGame"); } void LevelUp(){ Level++; Player.PrepareForGame(); for(int x = 0; xHighscores.AddRecord(HighScoreTextBox->Text(), Score); } void CGameOver::Draw(){ Background.Draw(); Player.Paint(); Asteroids::Draw(); Particles.Draw(); Bullets::Draw(); PowerUps::Draw(); System::Text::Print(System::Width/2,System::Height/2,"Game Over",255,20,20,220,1,2,"Big"); DisplayFPS(); } void CGameOver::Update(){ Particles.Update(); Player.Update(); Asteroids::Update(); Bullets::Update(); PowerUps::Update(); } void CHighScoreBackButton::Click(){ System::SetState(MainMenuState); } void CHighScoreTextBox::Initialize(){ this->Width(200); this->Height(30); this->x(System::Width/2-this->Width()/2); this->y(System::Height/2+this->Height()/2); this->Text("Type Your Name"); this->MaxCharacters(10); } void CHighScoreTextBox::Enter(){ //HighScoreBackButton->Click(); }