Author: esr
Date: Fri Jun 22 13:36:30 2007
New Revision: 18373
URL: http://svn.gna.org/viewcvs/wesnoth?rev=18373&view=rev
Log:
Move screen up to the map_display class.
Modified:
trunk/src/display.cpp
trunk/src/display.hpp
Modified: trunk/src/display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=18373&r1=18372&r2=18373&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Fri Jun 22 13:36:30 2007
@@ -63,8 +63,13 @@
size_t sunset_timer = 0;
}
-map_display::map_display(const gamemap& map, const config& theme_cfg) :
map_(map), theme_(theme_cfg,screen_area()), zoom_(DefaultZoom)
-{
+map_display::map_display(CVideo& video, const gamemap& map, const config&
theme_cfg) : screen_(video), map_(map), theme_(theme_cfg,screen_area()),
zoom_(DefaultZoom)
+{
+ if(non_interactive()) {
+ screen_.lock_updates(true);
+ }
+
+ image::set_zoom(zoom_);
}
map_display::~map_display()
@@ -114,9 +119,9 @@
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) :
- map_display(map, theme_cfg),
+ map_display(video, map, theme_cfg),
_scroll_event("scrolled"),
- screen_(video), xpos_(0), ypos_(0),
+ xpos_(0), ypos_(0),
units_(units),
temp_unit_(NULL),
minimap_(NULL), redrawMinimap_(false), redraw_background_(true),
@@ -132,13 +137,7 @@
diagnostic_label_(0), fps_handle_(0)
{
singleton_ = this;
- if(non_interactive()) {
- screen_.lock_updates(true);
- }
-
std::fill(reportRects_,reportRects_+reports::NUM_REPORTS,empty_rect);
-
- image::set_zoom(zoom_);
//inits the flag list
flags_.reserve(teams_.size());
Modified: trunk/src/display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=18373&r1=18372&r2=18373&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Fri Jun 22 13:36:30 2007
@@ -53,11 +53,25 @@
class map_display
{
public:
- map_display(const gamemap& map, const config& theme_cfg);
+ map_display(CVideo& video, const gamemap& map, const config& theme_cfg);
~map_display();
static Uint32 rgb(Uint8 red, Uint8 green, Uint8 blue)
{ return 0xFF000000 | (red << 16) | (green << 8) | blue; }
+
+ //the dimensions of the display. x and y are
+ //width/height. mapx is the width of the portion of the
+ //display which shows the game area. Between mapx and x is the
+ //sidebar region.
+ int w() const { return screen_.getx(); }
+ int h() const { return screen_.gety(); }
+ const SDL_Rect& minimap_area() const
+ { return theme_.mini_map_location(screen_area()); }
+ const SDL_Rect& unit_image_area() const
+ { return theme_.unit_image_location(screen_area()); }
+
+ SDL_Rect screen_area() const
+ { const SDL_Rect res = {0,0,w(),h()}; return res; }
/**
* Returns the area used for the map
@@ -82,6 +96,7 @@
int hex_size() const { return zoom_; }
protected:
+ CVideo& screen_;
const gamemap& map_;
theme theme_;
int zoom_;
@@ -152,21 +167,6 @@
//display to the frame buffer. If force is true, will not skip frames,
//even if running behind.
void draw(bool update=true,bool force=false);
-
- //the dimensions of the display. x and y are width/height. mapx is the
- //width of the portion of the display which shows the game area. Between
- //mapx and x is the sidebar region.
- int w() const { return screen_.getx(); }
- int h() const { return screen_.gety(); }
-
- const SDL_Rect& minimap_area() const
- { return theme_.mini_map_location(screen_area()); }
- const SDL_Rect& unit_image_area() const
- { return theme_.unit_image_location(screen_area()); }
-
- SDL_Rect screen_area() const
- { const SDL_Rect res = {0,0,w(),h()}; return res; }
-
//check if pixel x,y is outside specified area
bool outside_area(const SDL_Rect& area, const int x, const int y) const;
@@ -474,7 +474,6 @@
//this surface must be freed by the caller
surface get_minimap(int w, int h);
- CVideo& screen_;
CKey keys_;
int xpos_, ypos_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits