- Main Page
- Classes
- Files

- File List
- File Members

# C:/Users/Public/AGS Final Folder/BFLETCHER D4010283/Source/Game/Source/BreakoutGameOverScene.cpp

Go to the documentation of this file.

    00001 #include "BreakoutGameOverScene.h"
    00002
    00003 #include "GameConfig.h"
    00004 #include "Visualisation.h"
    00005 #include "EventManager.h"
    00006 #include "InputEvents.h"
    00007 #include "BreakoutEvents.h"
    00008
    00009 BreakoutGameOverScene::BreakoutGameOverScene()
    00010 : BreakoutMainMenuScene()
    00011 {
    00012
    00013 }
    00014
    00015 BreakoutGameOverScene::~BreakoutGameOverScene()
    00016 {
    00017
    00018 }
    00019
    00020 void BreakoutGameOverScene::Initialise()
    00021 {
    00022         Visualisation* pVis = Visualisation::getSingleton();
    00023         MenuEntry startEntry;
    00024         startEntry.Name = MENU_PLAY_AGAIN_GAME_TEXT;
    00025         startEntry.NormalSprite = pVis->CreateSpriteText(startEntry.Name, MENU_NORMAL_COLOUR);
    00026         startEntry.SelectedSprite = pVis->CreateSpriteText(startEntry.Name, MENU_SELECTED_COLOUR);
    00027         m_vMenuEntries.push_back(startEntry);
    00028
    00029         MenuEntry quitEntry;
    00030         quitEntry.Name = MENU_QUIT_GAME_TEXT;
    00031         quitEntry.NormalSprite = pVis->CreateSpriteText(quitEntry.Name, MENU_NORMAL_COLOUR);
    00032         quitEntry.SelectedSprite = pVis->CreateSpriteText(quitEntry.Name, MENU_SELECTED_COLOUR);
    00033         m_vMenuEntries.push_back(quitEntry);
    00034
    00035         m_gameTitleID = Visualisation::getSingleton()->CreateSpriteText(GAME_OVER_TEXT, GAME_TITLE_COLOUR);
    00036         m_gameTitleShadowID = Visualisation::getSingleton()->CreateSpriteText(GAME_OVER_TEXT, GAME_TITLE_SHADOW_COLOUR);
    00037
    00038         EventManager::getSingleton()->AddEventListener(ButtonInputEvent::cEventName, this);
    00039 }
    00040
    00041 bool BreakoutGameOverScene::HandleEvent(IEvent* pEvent)
    00042 {
    00043         if(!m_bIsActive)
    00044                 return false;
    00045
    00046         if(pEvent->GetEventType() == ButtonInputEvent::cEventName)
    00047         {
    00048                 ButtonInputEvent* pButtonEvent = (ButtonInputEvent*)pEvent;
    00049                 if(pButtonEvent->GetKey() == eKeyButtonB)
    00050                 {
    00051                         std::string name = m_vMenuEntries[m_selectedEntry].Name;
    00052
    00053                         if(name == MENU_PLAY_AGAIN_GAME_TEXT)
    00054                         {
    00055                                 BreakoutStartGameEvent* pStartEvent = new BreakoutStartGameEvent();
    00056                                 EventManager::getSingleton()->QueueEvent(pStartEvent);
    00057
    00058                                 return true;
    00059                         }
    00060                 }
    00061         }
    00062
    00063         return BreakoutMainMenuScene::HandleEvent(pEvent);
    00064 }