00001
00002
00003
00004
00005
00006
00007
00008 #ifndef QAF_BGLAYER_H
00009 #define QAF_BGLAYER_H
00010
00011 #include <hge.h>
00012 #include "qafutil/qafBigTexture.h"
00013 #include "qafutil/qafMatrix.h"
00014 #include <string>
00015
00016 #define QAF_TILE_PURE_ID_MASK 0x0000FFFF
00017 #define QAF_TILE_FLIPPED_X_MASK 0x80000000
00018 #define QAF_TILE_FLIPPED_Y_MASK 0x40000000
00019 #define QAF_TILE_COLORED_MASK 0x20000000
00020
00021
00022 namespace qaf {
00023
00024 #ifndef QAF_ENVIRONMENT_H
00025 class Environment;
00026 #endif
00027
00028 #ifndef QAF_ROOM_H
00029 class Room;
00030 #endif
00031
00045 class BGLayer {
00046 public:
00047
00049 const int tileWidth;
00050
00052 const int tileHeight;
00053
00055
00064 const float parallaxFactorX;
00065 const float parallaxFactorY;
00067
00069
00073 int translateX;
00074 int translateY;
00076
00077
00078
00079 private:
00080 const BigTexture * libTexture;
00081
00082 friend class Environment;
00083 friend class Room;
00084
00085
00086
00087
00088
00089
00090 BGLayer ( std::string sourceImagePath,
00091 int tileWidth, int tileHeight,
00092 float parallaxFactorX, float parallaxFactorY,
00093 int translateX, int translateY,
00094 int rows, int columns );
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 void render ( int x, int y );
00106
00107
00108 virtual ~BGLayer ();
00109
00110 struct ColorTile {
00111 DWORD blend;
00112 DWORD colors[4];
00113
00114 inline ColorTile ( DWORD _blend, DWORD _argb0, DWORD _argb1, DWORD _argb2, DWORD _argb3 ) {
00115 blend = _blend;
00116 colors[0] = _argb0;
00117 colors[1] = _argb1;
00118 colors[2] = _argb2;
00119 colors[3] = _argb3;
00120 }
00121 };
00122
00123 Matrix<int> bgData;
00124 Matrix<ColorTile *> bgColorData;
00125 };
00126
00127 }
00128
00129
00130 #endif