#ifndef _LAYER_H_ #define _LAYER_H_ #include #include #include #include "Bugsy.h" #include "Level.h" class Object; class Layer : public wgd::Instance2D { public: OBJECT(wgd::Instance2D, Layer) static const float LEDGE_HEIGHT; Layer(const wgd::OID& oid); Layer(Level *level, int width, int height, float vOffset = 0.0f, float alpha = 1.0f); ~Layer(); void draw(wgd::SceneGraph& graph, wgd::Camera2D* camera); void update(float timeStep); int getHeight(int x, int y); int getHeight(const wgd::vector3d& pos); float getWaterHeight(int x, int y); float getWaterHeight(const wgd::vector3d& pos); bool isWaterAboveTile(int x, int y); bool isWaterAboveTile(const wgd::vector3d& pos); TileType getTileType(int x, int y); Level* getLevel() { return level; } void setHeight(int x, int y, int height); void changeHeight(int x, int y, int deltaHeight); void addObject(::Object* obj); void removeObject(::Object* obj); float getTop(); void setTop(float newY); float getAlpha(); void setAlpha(float newAlpha); private: void clearTiles(int x, int y, int width=1, int height=1); void makeTiles(int x, int y, int width=1, int height=1); void markForRefresh(int x, int y, int width, int height); Level* level; TileType* tileData; int* heightData; float* waterData; float top, alpha; //Deformable Terrain flags bool refreshRequired; int refX, refY, refW, refH; std::vector > tiles; std::vector< ::Object*> objects; //Debugging vars wgd::Sprite2D** dbgTileMap; float dbgMaxHeight; wgd::Drawable* lines; }; #endif //_LAYER_H_