//
// gamehandler.h
//
// "in-game" program mode
//
//
// Author: Tomi Belan <tomi.belan@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef _gamehandler_h_
#define _gamehandler_h_

#include <SDL.h>
#include <vector>

#include "programmode.h"
#include "gameobject.h"

class PlayerShip;
class Bullet;
class Barrier;

class GameHandler : public ProgramMode {
private:
  SDL_Surface *background;
  SDL_Rect viewportSize;
  SDL_Rect viewport1, viewport2;
  
public:
  GameHandler();
  virtual ~GameHandler();
  
  virtual void event(SDL_Event *);
  virtual void update();
  virtual void cleanUp();
  virtual void activate();
  
  bool collidesWithBarriers(SDL_Rect);
  
  void moveViewport(int viewportId);
  
  int mapWorldRGB(Uint8 r, Uint8 g, Uint8 b);
  
  std::vector<GameObject*> objects;
  std::vector<Barrier*> barriers;
  
  SDL_Surface *world;
  int shipType1, shipType2;
  PlayerShip *ship1, *ship2;
  Bullet *bullet1, *bullet2;
  SDL_Rect viewport1Pos, viewport2Pos;
};

#endif

