Expose a map scrolling event, for use with sound sources.

This commit is contained in:
Karol Nowak 2007-02-16 20:17:56 +00:00
parent 46915a7411
commit d2404994e0
2 changed files with 10 additions and 1 deletions

View file

@ -76,6 +76,7 @@ namespace {
display::display(unit_map& units, CVideo& video, const gamemap& map,
const gamestatus& status, const std::vector<team>& t,
const config& theme_cfg, const config& cfg, const config& level) :
_scroll_event("scrolled"),
screen_(video), xpos_(0), ypos_(0),
zoom_(DefaultZoom), map_(map), units_(units),
temp_unit_(NULL),
@ -508,6 +509,7 @@ void display::scroll(int xmove, int ymove)
invalidate_locations_in_rect(r);
}
_scroll_event.notify_observers();
update_rect(map_area());
redrawMinimap_ = true;
@ -639,7 +641,6 @@ void display::scroll_to_tile(int x, int y, SCROLL_TYPE scroll_type, bool check_f
draw();
}
}
void display::scroll_to_tiles(int x1, int y1, int x2, int y2,

View file

@ -17,6 +17,8 @@ class config;
class gamestatus;
class unit;
class unit_map;
#include "generic_event.hpp"
#include "image.hpp"
#include "key.hpp"
#include "map.hpp"
@ -196,6 +198,9 @@ public:
const gamemap& get_map()const { return map_;}
//expose the event so that observers can be notified about map scrolling
events::generic_event &scroll_event() const { return _scroll_event; }
// The last action in drawing a tile is adding the overlays
// these overlays are drawn in the following order
// hex_overlay_ if the drawn location is in the map
@ -227,6 +232,9 @@ private:
void draw_enemies_reach(unsigned int num, int xloc, int yloc);
// event raised when the map is being scrolled
mutable events::generic_event _scroll_event;
public:
//function to draw a footstep for the given location, on screen at
//pixel co-ordinates (xloc,yloc). A footstep will only be drawn if