home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2002 June / Game.EXE_06_2002.iso / Alawar / Lib / 2D / Scene2D.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-26  |  1.1 KB  |  58 lines

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