#ifndef CLASS_MINI_MAP_PANEL #define CLASS_MINI_MAP_PANEL #include "graphic/Surface.h" #include "graphic/Blitter.h" #include "graphic/Image.h" #include "DataTypes.h" #include "IsoMiniMap.h" /// this class implements a panel that contains a minimap with /// its view rectangle class MiniMapPanel { private: /// the rectangular image that limits the view of the scene graphic::Image * _view_rect; /// current visible limits of the minimap SDL_Rect _mm_limits; /// pointer to the minimap IsoMiniMap * _mm; // current visible limits of the renderer /// upper render limit Sint16 _u_rlimit; /// bottom render limit Sint16 _b_rlimit; /// left render limit Sint16 _l_rlimit; /// right render limit Sint16 _r_rlimit; /// scale of the minimap int _mm_scale; public: /// constructor MiniMapPanel(IsoMiniMap * mm, graphic::Image * view_rect, SDL_Rect mm_limits); /// destroyer ~MiniMapPanel() { }; /// set renderer limits void SetRendererLimits(Sint16 u_limit, Sint16 b_limit, Sint16 l_limit, Sint16 r_limit) { _u_rlimit = u_limit; _b_rlimit = b_limit; _l_rlimit = l_limit; _r_rlimit = r_limit; }; /// set X component of minimap limits void SetLimitX(Sint16 x) { _mm_limits.x = x; }; /// set Y component of minimap limits void SetLimitY(Sint16 y) { _mm_limits.y = y; }; /// set W component of minimap limits void SetLimitW(Uint16 w) { _mm_limits.w = w; }; /// set Y component of minimap limits void SetLimitH(Uint16 h) { _mm_limits.h = h; }; /// set all limits using the passed rectangle void SetLimit(SDL_Rect * limit) { _mm_limits.x = limit->x; _mm_limits.y = limit->y; _mm_limits.w = limit->w; _mm_limits.h = limit->h; }; /// update the view of the minimap according to scene view position void UpdateView(Sint16 x, Sint16 y); /// mouse has been clicked on the panel at (x,y) point void MouseClicked(Sint16 x, Sint16 y); /// blit the panel on a dest surface void Blit(graphic::Surface * dest); /// blit the panel on a dest surface in the dest_rect position void Blit(SDL_Rect dest_rect, graphic::Surface * dest); /// return the view X position for the scene Sint16 GetViewX() { return (_view_rect->GetX() + _mm_limits.x) * _mm_scale; }; /// return the view Y position for the scene Sint16 GetViewY() { return (_view_rect->GetY() + _mm_limits.y) * _mm_scale; }; /// return the scale of the minimap int GetScale() { return _mm_scale; }; }; #endif