display.hpp

Go to the documentation of this file.
00001 /* $Id: display.hpp 26082 2008-04-25 00:22:51Z alink $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 //! @file display.hpp
00016 //!
00017 
00018 #ifndef DISPLAY_H_INCLUDED
00019 #define DISPLAY_H_INCLUDED
00020 
00021 class config;
00022 class gamestatus;
00023 class team;
00024 class unit;
00025 class unit_map;
00026 
00027 #include "builder.hpp"
00028 #include "generic_event.hpp"
00029 #include "image.hpp"
00030 #include "key.hpp"
00031 #include "map.hpp"
00032 #include "map_label.hpp"
00033 #include "reports.hpp"
00034 #include "theme.hpp"
00035 #include "video.hpp"
00036 #include "widgets/button.hpp"
00037 
00038 #include "SDL.h"
00039 
00040 #include <map>
00041 #include <set>
00042 #include <string>
00043 
00044 // map_display and display: classes which take care of
00045 // displaying the map and game-data on the screen.
00046 //
00047 // The display is divided into two main sections:
00048 // - the game area, which displays the tiles of the game board, and units on them,
00049 // - and the side bar, which appears on the right hand side.
00050 // The side bar display is divided into three sections:
00051 // - the minimap, which is displayed at the top right
00052 // - the game status, which includes the day/night image,
00053 //   the turn number, information about the current side,
00054 //   and information about the hex currently moused over (highlighted)
00055 // - the unit status, which displays an image and stats
00056 //   for the current unit.
00057 
00058 class display
00059 {
00060 public:
00061     display(CVideo& video, const gamemap& map, const config& theme_cfg,
00062             const config& cfg, const config& level);
00063     virtual ~display();
00064 
00065     static Uint32 rgb(Uint8 red, Uint8 green, Uint8 blue)
00066         { return 0xFF000000 | (red << 16) | (green << 8) | blue; }
00067 
00068     // Gets the underlying screen object.
00069     CVideo& video() { return screen_; }
00070 
00071     // return the screen surface or the surface used for map_screenshot
00072     surface get_screen_surface() { return map_screenshot_ ? map_screenshot_surf_ : screen_.getSurface();}
00073 
00074     virtual bool in_game() const { return false; }
00075     virtual bool in_editor() const { return false; }
00076 
00077     // the dimensions of the display. x and y are width/height.
00078     // mapx is the width of the portion of the display which shows the game area.
00079     // Between mapx and x is the sidebar region.
00080     int w() const { return screen_.getx(); }    //!< width
00081     int h() const { return screen_.gety(); }    //!< height
00082     const SDL_Rect& minimap_area() const
00083         { return theme_.mini_map_location(screen_area()); }
00084     const SDL_Rect& unit_image_area() const
00085         { return theme_.unit_image_location(screen_area()); }
00086 
00087     SDL_Rect screen_area() const
00088         { const SDL_Rect res = {0,0,w(),h()}; return res; }
00089 
00090     /**
00091      * Returns the maximum area used for the map
00092      * regardless to resolution and view size
00093      */
00094     const SDL_Rect& max_map_area() const;
00095 
00096     /**
00097      * Returns the area used for the map
00098      */
00099     const SDL_Rect& map_area() const;
00100 
00101     /**
00102      * Returns the available area for a map, this may differ
00103      * from the above. This area will get the background area
00104      * applied to it.
00105      */
00106     const SDL_Rect& map_outside_area() const { return map_screenshot_ ?
00107         max_map_area() : theme_.main_map_location(screen_area()); }
00108 
00109     //! Check if the bbox of the hex at x,y has pixels outside the area rectangle.
00110     bool outside_area(const SDL_Rect& area, const int x,const int y) const;
00111 
00112     //! Function which returns the width of a hex in pixels,
00113     //! up to where the next hex starts.
00114     //! (i.e. not entirely from tip to tip -- use hex_size()
00115     //! to get the distance from tip to tip)
00116     int hex_width() const { return (zoom_*3)/4; }
00117 
00118     //! Function which returns the size of a hex in pixels
00119     //! (from top tip to bottom tip or left edge to right edge).
00120     int hex_size() const { return zoom_; }
00121 
00122     //! Returns the current zoom factor.
00123     double get_zoom_factor() { return double(zoom_)/double(image::tile_size); }
00124 
00125     // given x,y co-ordinates of an onscreen pixel, will return the
00126     // location of the hex that this pixel corresponds to.
00127     // Returns an invalid location if the mouse isn't over any valid location.
00128     const gamemap::location hex_clicked_on(int x, int y,
00129         gamemap::location::DIRECTION* nearest_hex=NULL,
00130         gamemap::location::DIRECTION* second_nearest_hex=NULL) const;
00131 
00132     // given x,y co-ordinates of a pixel on the map, will return the
00133     // location of the hex that this pixel corresponds to.
00134     // Returns an invalid location if the mouse isn't over any valid location.
00135     const gamemap::location pixel_position_to_hex(int x, int y,
00136         gamemap::location::DIRECTION* nearest_hex=NULL,
00137         gamemap::location::DIRECTION* second_nearest_hex=NULL) const;
00138 
00139     // given x,y co-ordinates of the mouse, will return the location of the
00140     // hex in the minimap that the mouse is currently over, or an invalid
00141     // location if the mouse isn't over the minimap.
00142     gamemap::location minimap_location_on(int x, int y);
00143 
00144     const gamemap::location& selected_hex() { return selectedHex_; }
00145     const gamemap::location& mouseover_hex() { return mouseoverHex_; }
00146 
00147     virtual void select_hex(gamemap::location hex);
00148     virtual void highlight_hex(gamemap::location hex);
00149 
00150     //! Function to invalidate the game status displayed on the sidebar.
00151     void invalidate_game_status() { invalidateGameStatus_ = true; }
00152 
00153     void get_rect_hex_bounds(SDL_Rect rect, gamemap::location &topleft, gamemap::location &bottomright) const;
00154 
00155     //! Functions to get the on-screen positions of hexes.
00156     int get_location_x(const gamemap::location& loc) const;
00157     int get_location_y(const gamemap::location& loc) const;
00158 
00159     //! Returns true if location (x,y) is covered in shroud.
00160     bool shrouded(const gamemap::location& loc) const
00161         {return viewpoint_ && viewpoint_->shrouded(loc);}
00162     //! Returns true if location (x,y) is covered in fog.
00163     bool fogged(const gamemap::location& loc) const
00164         {return viewpoint_ && viewpoint_->fogged(loc);}
00165 
00166     //! Determines whether a grid should be overlayed on the game board.
00167     //! (to more clearly show where hexes are)
00168     void set_grid(const bool grid) { grid_ = grid; }
00169 
00170     //! Returns the locations of 2 hexes
00171     //! that bind the visible area of the map.
00172     void get_visible_hex_bounds(gamemap::location &topleft, gamemap::location &bottomright) const;
00173 
00174     //! Save a (map-)screenshot and return the estimated file size
00175     int screenshot(std::string filename, bool map_screenshot = false);
00176 
00177     //! Invalidates entire screen, including all tiles and sidebar.
00178     void redraw_everything();
00179 
00180     theme& get_theme() { return theme_; }
00181     gui::button* find_button(const std::string& id);
00182     gui::button::TYPE string_to_button_type(std::string type);
00183     void create_buttons();
00184     void invalidate_theme() { panelsDrawn_ = false; }
00185 
00186     void refresh_report(reports::TYPE report_num, reports::report report,
00187               bool brightened = false);
00188 
00189     // Will be overridden in the display subclass
00190     virtual void invalidate(const gamemap::location& loc) {invalidated_.insert(loc);};
00191     virtual void invalidate_rectangle(const gamemap::location& first_corner, const gamemap::location& second_corner) ;
00192     virtual void invalidate_zone(const int x1,const int y1, const int x2, const int y2); 
00193     virtual void draw_minimap_units() {};
00194 
00195     const gamemap& get_map()const { return map_;}
00196 
00197     // The last action in drawing a tile is adding the overlays.
00198     // These overlays are drawn in the following order:
00199     // hex_overlay_         if the drawn location is in the map
00200     // selected_hex_overlay_    if the drawn location is selected
00201     // mouseover_hex_overlay_   if the drawn location is underneath the mouse
00202     //
00203     // These functions require a prerendered surface.
00204     // Since they are drawn at the top, they are not influenced by TOD, shroud etc.
00205     void set_hex_overlay(const gamemap::location& loc, surface image) { hex_overlay_[loc] = image; }
00206     void clear_hex_overlay(const gamemap::location& loc);
00207 
00208     void set_selected_hex_overlay(const surface& image) { selected_hex_overlay_ = image; }
00209     void clear_selected_hex_overlay() { selected_hex_overlay_ = NULL; }
00210 
00211     void set_mouseover_hex_overlay(const surface& image) { mouseover_hex_overlay_ = image; }
00212     void clear_mouseover_hex_overlay() { mouseover_hex_overlay_ = NULL; }
00213 
00214     //! Debug function to toggle the "sunset" mode.
00215     //! The map area become progressively darker,
00216     //! except where hexes are refreshed.
00217     //! delay is the number of frames between each darkening
00218     //! (0 to toggle).
00219     void sunset(const size_t delay = 0);
00220 
00221     //! Toogle to continuously redraw the screen.
00222     void toggle_benchmark();
00223 
00224     void flip();
00225 
00226     //! Copy the backbuffer to the framebuffer.
00227     void update_display();
00228 
00229     //! Rebuild all dynamic terrain.
00230     void rebuild_all() { builder_.rebuild_all(); }
00231 
00232     //! Draw the image of a unit at a certain location.
00233     //! x,y: pixel location on screen to draw the unit
00234     //! image: the image of the unit
00235     //! reverse: if the unit should be flipped across the x axis
00236     //! greyscale: used when the unit is stoned
00237     //! alpha: the merging to use with the background
00238     //! blendto: blend to this colour using blend_ratio
00239     //! submerged: the amount of the unit out of 1.0 that is submerged
00240     //!            (presumably under water) and thus shouldn't be drawn
00241     void render_unit_image(int x, int y, const bool fake_unit,
00242             const int drawing_order, surface image,
00243             bool hreverse=false, bool greyscale=false,
00244             fixed_t alpha=ftofxp(1.0), Uint32 blendto=0,
00245             double blend_ratio=0, double submerged=0.0,bool vreverse =false);
00246 
00247     const theme::menu* menu_pressed();
00248 
00249     //! Finds the menu which has a given item in it,
00250     //! and enables or disables it.
00251     void enable_menu(const std::string& item, bool enable);
00252 
00253     void set_diagnostic(const std::string& msg);
00254 
00255     // Delay routines: use these not SDL_Delay (for --nogui).
00256     void delay(unsigned int milliseconds) const;
00257 
00258     //! Set/Get whether 'turbo' mode is on.
00259     //! When turbo mode is on, everything moves much faster.
00260     void set_turbo(const bool turbo) { turbo_ = turbo; }
00261 
00262     double turbo_speed() const;
00263 
00264     void set_turbo_speed(const double speed) { turbo_speed_ = speed; }
00265 
00266     // control unit idle animations and their frequency
00267     void set_idle_anim(bool ison) { idle_anim_ = ison; }
00268     bool idle_anim() const { return idle_anim_; }
00269     void set_idle_anim_rate(int rate);
00270     double idle_anim_rate() const { return idle_anim_rate_; }
00271 
00272     //! Add a location to highlight.
00273     //! Note that this has nothing to do with selecting hexes,
00274     //! it is pure highlighting. These hexes will be highlighted
00275     //! slightly darker than the currently selected hex.
00276     void add_highlighted_loc(const gamemap::location &hex);
00277 
00278     void clear_highlighted_locs();
00279 
00280     void remove_highlighted_loc(const gamemap::location &hex);
00281 
00282     void bounds_check_position();
00283     void bounds_check_position(int& xpos, int& ypos);
00284 
00285     //! Function to invalidate all tiles.
00286     void invalidate_all();
00287 
00288     //! Scrolls the display by xmov,ymov pixels.
00289     //! Invalidation and redrawing will be scheduled.
00290     void scroll(int xmov, int ymov);
00291 
00292     //! Zooms the display by the specified amount.
00293     //! Negative values zoom out.
00294     //! Note the amount should be a multiple of four,
00295     //! otherwise the images might start to look odd
00296     //! (hex_width() gets rounding errors).
00297     void set_zoom(int amount);
00298 
00299     //! Sets the zoom amount to the default.
00300     void set_default_zoom();
00301 
00302     enum SCROLL_TYPE { SCROLL, WARP, ONSCREEN };
00303 
00304     //! Scroll such that location loc is on-screen.
00305     //! WARP jumps to loc; SCROLL uses scroll speed;
00306     //! ONSCREEN only scrolls if x,y is offscreen
00307     void scroll_to_tile(const gamemap::location& loc, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true);
00308 
00309     //! Scroll such that location loc1 is on-screen.
00310     //! It will also try to make it such that loc2 is on-screen,
00311     //! but this is not guaranteed. For ONSCREEN scrolls add_spacing
00312     //! sets the desired minimum distance from the border in hexes.
00313     void scroll_to_tiles(gamemap::location loc1, gamemap::location loc2,
00314                          SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true,
00315                  double add_spacing=0.0);
00316 
00317     //! Scroll to fit as many locations on-screen as possible, starting with the first.
00318     void scroll_to_tiles(const std::vector<gamemap::location>& locs,
00319                          SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true,
00320                          bool only_if_possible=false,
00321                  double add_spacing=0.0);
00322 
00323     //! Expose the event, so observers can be notified about map scrolling.
00324     events::generic_event &scroll_event() const { return _scroll_event; }
00325 
00326     //! Check if a tile is fully on screen.
00327     bool tile_on_screen(const gamemap::location& loc);
00328 
00329     //! Draws invalidated items.
00330     //! If update is true, will also copy the display to the frame buffer.
00331     //! If force is true, will not skip frames, even if running behind.
00332     virtual void draw(bool update=true,bool force=false) = 0;
00333 
00334     map_labels& labels() { return map_labels_; }
00335     const map_labels& labels() const { return map_labels_; }
00336 
00337     //! Announce a message prominently.
00338     void announce(const std::string msg,
00339                const SDL_Color& colour = font::GOOD_COLOUR);
00340 
00341     //! Schedule the minimap for recalculation.
00342     //! Useful if any terrain in the map has changed.
00343     void recalculate_minimap() {minimap_ = NULL; redrawMinimap_ = true; };
00344 
00345     //! Schedule the minimap to be redrawn.
00346     //! Useful if units have moved about on the map.
00347     void redraw_minimap() { redrawMinimap_ = true; }
00348 
00349     //! Set what will be shown for the report with type which_report.
00350     //! Note that this only works for some reports,
00351     //! i.e. reports that can not be deducted
00352     //! from the supplied arguments to generate_report,
00353     //! currently: SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION
00354     void set_report_content(const reports::TYPE which_report, const std::string &content);
00355     std::map<reports::TYPE, std::string> get_report_contents() {return report_;};
00356 
00357 protected:
00358 
00359     /**
00360      * Draws the border tile overlay.
00361      * The routine determines by itself which border it is on
00362      * and draws an overlay accordingly. The definition of the
00363      * border is stored in the 'main_map_border' part of the theme.
00364      *
00365      * @param loc   the map location of the tile
00366      * @param xpos  the on-screen pixels x coordinate of the tile
00367      * @param ypos  the on-screen pixels y coordinate of the tile
00368      */
00369     virtual void draw_border(const gamemap::location& loc,
00370         const int xpos, const int ypos);
00371 
00372     void draw_minimap();
00373 
00374     enum ADJACENT_TERRAIN_TYPE { ADJACENT_BACKGROUND, ADJACENT_FOREGROUND, ADJACENT_FOGSHROUD };
00375 
00376     std::vector<surface> get_terrain_images(const gamemap::location &loc,
00377                     const std::string timeid,
00378                     image::TYPE type,
00379                     ADJACENT_TERRAIN_TYPE terrain_type);
00380 
00381     std::vector<std::string> get_fog_shroud_graphics(const gamemap::location& loc);
00382 
00383     void draw_image_for_report(surface& img, SDL_Rect& rect);
00384 
00385     void scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_type);
00386 
00387     CVideo& screen_;
00388     const gamemap& map_;
00389     const viewpoint *viewpoint_;
00390     int xpos_, ypos_;
00391     theme theme_;
00392     int zoom_;
00393     int last_zoom_;
00394     terrain_builder builder_;
00395     surface minimap_;
00396     SDL_Rect minimap_location_;
00397     bool redrawMinimap_;
00398     bool redraw_background_;
00399     bool invalidateAll_;
00400     bool grid_;
00401     int diagnostic_label_;
00402     bool panelsDrawn_;
00403     double turbo_speed_;
00404     bool turbo_;
00405     bool invalidateGameStatus_;
00406     map_labels map_labels_;
00407     //! Event raised when the map is being scrolled
00408     mutable events::generic_event _scroll_event;
00409     //! Holds the tick count for when the next drawing event is scheduled.
00410     //! Drawing shouldn't occur before this time.
00411     int nextDraw_;
00412 
00413     // Not set by the initializer:
00414     SDL_Rect reportRects_[reports::NUM_REPORTS];
00415     surface reportSurfaces_[reports::NUM_REPORTS];
00416     reports::report reports_[reports::NUM_REPORTS];
00417     std::map<reports::TYPE, std::string> report_;
00418     std::vector<gui::button> buttons_;
00419     std::set<gamemap::location> invalidated_;
00420     std::map<gamemap::location, surface> hex_overlay_;
00421     surface selected_hex_overlay_;
00422     surface mouseover_hex_overlay_;
00423     gamemap::location selectedHex_;
00424     gamemap::location mouseoverHex_;
00425     std::set<gamemap::location> highlighted_locations_;
00426     CKey keys_;
00427 
00428 public: 
00429     //! Helper structure for rendering the terrains.
00430     struct tblit{
00431         tblit(const int x, const int y) :
00432             x(x),
00433             y(y),
00434             surf(),
00435             clip()
00436             {}
00437 
00438         tblit(const int x, const int y, const surface& surf, 
00439                 const SDL_Rect& clip = SDL_Rect()) :
00440             x(x),
00441             y(y),
00442             surf(1, surf),
00443             clip(clip)
00444             {}
00445 
00446         tblit(const int x, const int y, const std::vector<surface>& surf, 
00447                 const SDL_Rect& clip = SDL_Rect()) :
00448             x(x),
00449             y(y),
00450             surf(surf),
00451             clip(clip)
00452             {}
00453 
00454 
00455         int x;                      //!< x screen coordinate to render at.
00456         int y;                      //!< y screen coordinate to render at.
00457         std::vector<surface> surf;  //!< surface(s) to render.
00458         SDL_Rect clip;              //!< The clipping area of the source if
00459                                     //!  ommitted the entire source is used.
00460     };
00461 
00462     //! The layers to render something on. This value should never be stored
00463     //! it's the internal drawing order and adding removing and reordering
00464     //! the layers should be save.
00465     //! If needed in WML use the name and map that to the enum value.
00466     enum tdrawing_layer{ 
00467         LAYER_TERRAIN_BG,          //!< Layer for the terrain drawn behind the 
00468                                    //!< unit.
00469         LAYER_TERRAIN_TMP_BG,      //!< Layer which holds stuff that needs to be
00470                                    //!< sorted out further, but under units
00471         LAYER_UNIT_BG,             //!< Used for the ellipse behind the unit.
00472         LAYER_UNIT_FIRST,          //!< Reserve layeres to be selected for WML.
00473         LAYER_UNIT_LAST=LAYER_UNIT_FIRST+100,
00474         LAYER_UNIT_FG,             //!< Used for the ellipse in front of the 
00475                                    //!< unit.
00476         LAYER_UNIT_FAKE,           //!< The fake unit is drawn on this layer.
00477         LAYER_TERRAIN_FG,          //!< Layer for the terrain drawn in front of
00478                                    //!< the unit.
00479         LAYER_TERRAIN_TMP_FG,      //!< Layer which holds stuff that needs to be
00480                                    //!< sorted out further, but on top of units
00481         LAYER_UNIT_BAR,            //!< Unit bars and overlays are drawn on
00482                                    //!< this layer (for testing here).
00483         LAYER_LINGER_OVERLAY,      //!< The overlay used for the linger mode.
00484         
00485         LAYER_LAST_LAYER           //!< Don't draw to this layer it's a dummy
00486                                    //! to size the vector.
00487         };
00488 
00489     //! Draw text on a hex. (0.5, 0.5) is the center.
00490     //! The font size is adjusted to the zoom factor
00491     //! and divided by 2 for tiny-gui.
00492     void draw_text_in_hex(const gamemap::location& loc, 
00493         const tdrawing_layer layer, const std::string& text, size_t font_size,
00494         SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5);
00495 
00496 protected:
00497 
00498     // Initially tdrawing_buffer was a vector but profiling showed that a map
00499     // was more efficient. Tested with the LAYER_UNIT_LAST for various values
00500     // and different types the results were. (Tested with oprofile.)
00501   
00502     // container    unit layers    counts
00503     // vector       100            3748
00504     // vector       10000          147338
00505     // map          10000          3362
00506 
00507     // Since a map with 10000 items was more efficient I didn't test the map
00508     // with 100 items. I want to retest once more is converted, since with 
00509     // a different usage it numbers might differ so the old code is disabled
00510     // with TDRAWING_BUFFER_USES_VECTOR 
00511     //     20080308 -- Mordante
00512 
00513     //! * Surfaces are rendered per level in a map.
00514     //! * Per level the items are rendered per location these locations are
00515     //!   stored in the drawing order required for units.
00516     //! * every location has a vector with surfaces, each with its own screen
00517     //!   coordinate to render at.
00518     //! * every vector element has a vector with surfaces to render.
00519 #if TDRAWING_BUFFER_USES_VECTOR
00520     typedef std::vector<std::map<int /*drawing_order*/, std::vector<tblit> > > tdrawing_buffer;
00521 #else   
00522     typedef std::map<tdrawing_layer, std::map<int /*drawing_order*/, std::vector<tblit> > > tdrawing_buffer;
00523 #endif  
00524     tdrawing_buffer drawing_buffer_;
00525 
00526 public:
00527 
00528     //! Add an item to the drawing buffer.
00529     //!
00530     //! @param layer              The layer to draw on.
00531     //! @param drawing_order      The order in which to draw, needed for units.
00532     //! @param blit               The structure to blit.
00533     void drawing_buffer_add(const tdrawing_layer layer, const int drawing_order, const tblit& blit)
00534         { drawing_buffer_[layer][drawing_order].push_back(blit); }
00535 
00536 protected:
00537 
00538     //! Draws the drawing_buffer_ and clears it.
00539     void drawing_buffer_commit();
00540 
00541     //! Clears the drawing buffer.
00542     void drawing_buffer_clear();
00543 
00544     //! redraw all panels associated with the map display
00545     void draw_all_panels();
00546 
00547     void invalidate_locations_in_rect(SDL_Rect r);
00548 
00549     //! Strict weak ordering to sort a STL-set of hexes
00550     //! for drawing using the z-order.
00551     //! (1000 are just to weight the y compare to x)
00552     struct ordered_draw : public std::binary_function<gamemap::location, gamemap::location, bool> {
00553         bool operator()(gamemap::location a, gamemap::location b) {
00554             return (a.y*2 + a.x%2) * 1024 + a.x < (b.y*2 + b.x%2) * 1024 + b.x;
00555         }
00556     };
00557 
00558     //! Invalidate controls and panels when changed
00559     //! after they have been drawn initially.
00560     //! Useful for dynamic theme modification.
00561     bool draw_init();
00562     void draw_wrap(bool update,bool force,bool changed);
00563 
00564     //! Used to indicate to drawing funtions that we are doing a map screenshot
00565     bool map_screenshot_;
00566 
00567 private:
00568     //! Handle for the label which displays frames per second.
00569     int fps_handle_;
00570 
00571     bool idle_anim_;
00572     double idle_anim_rate_;
00573 
00574     surface map_screenshot_surf_;
00575 };
00576 
00577 //! Simplified display class for the editor.
00578 //! It only needs to draw terrain, no units, no fog, etc.
00579 class editor_display : public display
00580 {
00581 public:
00582     editor_display(CVideo& video, const gamemap& map, const config& theme_cfg,
00583             const config& cfg, const config& level);
00584 
00585     bool in_editor() const { return true; }
00586 
00587     //! draw() for the editor display.
00588     //! It only has to know about terrain.
00589     void draw(bool update=true,bool force=false);
00590 
00591     //! Rebuild the dynamic terrain at the given location.
00592     void rebuild_terrain(const gamemap::location &loc)
00593         { builder_.rebuild_terrain(loc); }
00594 
00595     //! Updates editor light levels from preferences
00596     void update_light_levels();
00597 private:
00598     int lr_, lg_, lb_;
00599 };
00600 
00601 #endif
00602 

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs