00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef GELAYER_H
00022 #define GELAYER_H
00023 
00024 #include <iostream.h>
00025 #include <stdio.h>
00026 #include <SDL/SDL.h>
00027 #include <SDL/SDL_image.h>
00028 #include <vector.h>
00029 #include "GE_Types.h"
00030 
00032 
00035 class GE_Layer
00036 {
00037 protected:
00038     
00040 
00041     bool visibilidad;
00042     
00044     SDL_Rect rect;
00045     
00047     SDL_Surface *surface;
00048     
00050 
00051     SDL_Surface* stored;
00052 
00053 public:
00054     
00056     vector <GE_Layer *> SubLayer;
00057 
00059     GE_Layer();
00060     
00062 
00063     GE_Layer(char *file_name, int x=0, int y=0 , int w=0, int h=0);
00064     
00066     GE_Layer(SDL_Surface *surface, int x=0, int y=0 , int w=0, int h=0);
00067     
00069     virtual ~GE_Layer();
00070 
00071     
00073     inline void setSurface(SDL_Surface *sdl_surface)
00074     {
00075         surface = sdl_surface;
00076     };
00077     
00079     void setSurface(char *);
00080     
00081     
00083     inline void setRect(SDL_Rect sdl_rect)
00084     {
00085         rect = sdl_rect;
00086     };
00087     
00089     inline void setRect(int x, int y)
00090     {
00091         rect.x=x;
00092         rect.y = y;
00093     };
00094     
00096     void setRect(GE_Vector vector);
00097     
00099     inline SDL_Surface* getSurface(void)
00100     {
00101         return surface;
00102     };
00103     
00105     inline SDL_Rect getRect (void)
00106     {
00107         return rect;
00108     };
00109     
00111 
00112     void addSubLayer(GE_Layer &NewLayer,int x = 0, int y = 0);
00113     
00115 
00116     void addSubLayer(GE_Layer&, SDL_Rect);
00117     
00119 
00120     void addSubLayer(GE_Layer*,int x = 0, int y = 0);
00121     
00122 
00124     Uint32 getPixel( int x, int y);
00125     
00127     SDL_PixelFormat * getPixelFormat();
00128     
00130 
00131     inline bool isVisible ()
00132     {
00133         return visibilidad;
00134     };
00135     
00136     
00138 
00139     inline void visible(bool v)
00140     {
00141         visibilidad = v;
00142     };
00143     
00145 
00146     GE_Layer& operator= (const GE_Layer&);
00147 };
00148 #endif