//
// gameover.cpp
//
// "game over" screen
//
//
// Author: Tomi Belan <tomi.belan@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include <string>
#include "gameover.h"
#include "mainmenu.h"
#include "main.h"

GameOver::GameOver(int defeatedPlayer)
{
  this->defeatedPlayer = defeatedPlayer;
}

GameOver::~GameOver() {
}
  
void GameOver::event(SDL_Event *e)
{
  if(e->type == SDL_KEYDOWN) {
    int sym = e->key.keysym.sym;
    if(sym == SDLK_ESCAPE)
      newProgramMode = new MainMenu();
  }
}

void GameOver::activate()
{
  SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0, 0, 0));
  simpleText("Game over.", -1);
  simpleText(defeatedPlayer==2?"Player 1 won.":"Player 2 won.", 0);
  simpleText("Press Escape to return to main menu.", 1);
  SDL_Flip(screen);
}

