home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2002 April / Game.EXE_04_2002.iso / Alawar / Scene2D.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-02-25  |  1021 b   |  53 lines

  1. #ifndef SCENE2D_H
  2. #define SCENE2D_H
  3.  
  4. class Object2D;
  5. class Color;
  6. class Hardware2D;
  7. class HardwarePicture2D;
  8. #include <list>
  9. #include <vector>
  10.  
  11. class Scene2D
  12. {
  13. public:    
  14.     explicit Scene2D(Hardware2D * hardware);
  15.     virtual ~Scene2D();
  16.  
  17.     static int hidden_layer()
  18.     {
  19.         return 1000;
  20.     }
  21.     bool render(int camera_x, int camera_y, const Color & back_color);
  22.  
  23.     void push_shift_add(int shx, int shy);
  24.     void pop_shift();
  25.  
  26.     HardwarePicture2D * load_picture(const Color * colors, unsigned width, unsigned height, unsigned stride);
  27.     void blit(HardwarePicture2D * pic, int alpha);
  28.  
  29.     void remove_object2d(Object2D * obj);
  30.     void add_object2d(Object2D * obj);
  31.  
  32. private:
  33.     Hardware2D * hardware;
  34.     std::list<Object2D *> object_list;
  35.  
  36.     struct Shift
  37.     {
  38.         int x;
  39.         int y;
  40.         Shift()
  41.             :    x( 0 ), y( 0 )
  42.         {}
  43.         Shift( int x, int y )
  44.             :    x( x ), y( y )
  45.         {}
  46.         Shift operator+ ( const Shift & sh )
  47.         {
  48.             return Shift( x + sh.x, y + sh.y );
  49.         }
  50.     };
  51.     std::vector<Shift> shift;
  52. };
  53. #endif //SCENE2D_H