The Battle for Wesnoth  1.19.0-dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
display Class Referenceabstract

Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data. More...

#include <display.hpp>

Inheritance diagram for display:

Classes

struct  announce_options
 Holds options for calls to function 'announce' (announce). More...
 
struct  draw_helper
 Helper for rendering the map by ordering draw operations. More...
 
struct  rect_of_hexes
 Rectangular area of hexes, allowing to decide how the top and bottom edges handles the vertical shift for each parity of the x coordinate. More...
 

Public Types

enum  SCROLL_TYPE { SCROLL , WARP , ONSCREEN , ONSCREEN_WARP }
 
enum  drawing_layer {
  LAYER_TERRAIN_BG , LAYER_GRID_TOP , LAYER_MOUSEOVER_OVERLAY , LAYER_FOOTSTEPS ,
  LAYER_MOUSEOVER_TOP , LAYER_UNIT_FIRST , LAYER_UNIT_BG = LAYER_UNIT_FIRST+10 , LAYER_UNIT_DEFAULT =LAYER_UNIT_FIRST+40 ,
  LAYER_TERRAIN_FG = LAYER_UNIT_FIRST+50 , LAYER_GRID_BOTTOM , LAYER_UNIT_MOVE_DEFAULT =LAYER_UNIT_FIRST+60 , LAYER_UNIT_FG = LAYER_UNIT_FIRST+80 ,
  LAYER_UNIT_MISSILE_DEFAULT = LAYER_UNIT_FIRST+90 , LAYER_UNIT_LAST =LAYER_UNIT_FIRST+100 , LAYER_REACHMAP , LAYER_MOUSEOVER_BOTTOM ,
  LAYER_FOG_SHROUD , LAYER_ARROWS , LAYER_ACTIONS_NUMBERING , LAYER_SELECTED_HEX ,
  LAYER_ATTACK_INDICATOR , LAYER_UNIT_BAR , LAYER_MOVE_INFO , LAYER_LINGER_OVERLAY ,
  LAYER_BORDER
}
 The layers to render something on. More...
 
enum  DEBUG_FLAG {
  DEBUG_COORDINATES , DEBUG_TERRAIN_CODES , DEBUG_NUM_BITMAPS , DEBUG_FOREGROUND ,
  DEBUG_BENCHMARK , __NUM_DEBUG_FLAGS
}
 

Public Member Functions

 display (const display_context *dc, std::weak_ptr< wb::manager > wb, reports &reports_object, const std::string &theme_id, const config &level)
 
virtual ~display ()
 
bool show_everything () const
 
const gamemapget_map () const
 
const std::vector< team > & get_teams () const
 
std::size_t playing_team () const
 The playing team is the team whose turn it is. More...
 
bool team_valid () const
 
std::size_t viewing_team () const
 The viewing team is the team currently viewing the game. More...
 
int viewing_side () const
 The 1-based equivalent of the 0-based viewing_team() function. More...
 
void set_team (std::size_t team, bool observe=false)
 Sets the team controlled by the player using the computer. More...
 
void set_playing_team (std::size_t team)
 set_playing_team sets the team whose turn it currently is More...
 
void clear_exclusive_draws ()
 Cancels all the exclusive draw requests. More...
 
const unit_mapget_units () const
 
bool add_exclusive_draw (const map_location &loc, unit &unit)
 Allows a unit to request to be the only one drawn in its hex. More...
 
std::string remove_exclusive_draw (const map_location &loc)
 Cancels an exclusive draw request. More...
 
void add_overlay (const map_location &loc, const std::string &image, const std::string &halo="", const std::string &team_name="", const std::string &item_id="", bool visible_under_fog=true, float submerge=0.0f, float z_order=0)
 Functions to add and remove overlays from locations. More...
 
void remove_overlay (const map_location &loc)
 remove_overlay will remove all overlays on a tile. More...
 
void remove_single_overlay (const map_location &loc, const std::string &toDelete)
 remove_single_overlay will remove a single overlay from a tile More...
 
void reload_map ()
 Updates internals that cache map size. More...
 
void change_display_context (const display_context *dc)
 
const display_contextget_disp_context () const
 
halo::managerget_halo_manager ()
 
void update_tod (const time_of_day *tod_override=nullptr)
 Applies r,g,b coloring to the map. More...
 
void adjust_color_overlay (int r, int g, int b)
 Add r,g,b to the colors for all images displayed on the map. More...
 
tod_color get_color_overlay () const
 
virtual bool in_game () const
 
virtual bool in_editor () const
 
virtual const map_locationdisplayed_unit_hex () const
 Virtual functions shadowed in game_display. More...
 
virtual int playing_side () const
 
virtual const std::set< std::string > & observers () const
 
const rectminimap_area () const
 mapx is the width of the portion of the display which shows the game area. More...
 
const rectpalette_area () const
 
const rectunit_image_area () const
 
rect max_map_area () const
 Returns the maximum area used for the map regardless to resolution and view size. More...
 
rect map_area () const
 Returns the area used for the map. More...
 
rect map_outside_area () const
 Returns the available area for a map, this may differ from the above. More...
 
const map_location hex_clicked_on (int x, int y) const
 given x,y co-ordinates of an onscreen pixel, will return the location of the hex that this pixel corresponds to. More...
 
const map_location pixel_position_to_hex (int x, int y) const
 given x,y co-ordinates of a pixel on the map, will return the location of the hex that this pixel corresponds to. More...
 
map_location minimap_location_on (int x, int y)
 given x,y co-ordinates of the mouse, will return the location of the hex in the minimap that the mouse is currently over, or an invalid location if the mouse isn't over the minimap. More...
 
const map_locationselected_hex () const
 
const map_locationmouseover_hex () const
 
virtual void select_hex (map_location hex)
 
virtual void highlight_hex (map_location hex)
 
void invalidate_game_status ()
 Function to invalidate the game status displayed on the sidebar. More...
 
int get_location_x (const map_location &loc) const
 Functions to get the on-screen positions of hexes. More...
 
int get_location_y (const map_location &loc) const
 
point get_location (const map_location &loc) const
 
const rect_of_hexes hexes_under_rect (const SDL_Rect &r) const
 Return the rectangular area of hexes overlapped by r (r is in screen coordinates) More...
 
const rect_of_hexes get_visible_hexes () const
 Returns the rectangular area of visible hexes. More...
 
bool shrouded (const map_location &loc) const
 Returns true if location (x,y) is covered in shroud. More...
 
bool fogged (const map_location &loc) const
 Returns true if location (x,y) is covered in fog. More...
 
surface screenshot (bool map_screenshot=false)
 Capture a (map-)screenshot into a surface. More...
 
void queue_rerender ()
 Marks everything for rendering including all tiles and sidebar. More...
 
void queue_repaint ()
 Queues repainting to the screen, but doesn't rerender. More...
 
void add_redraw_observer (std::function< void(display &)> f)
 Adds a redraw observer, a function object to be called when a full rerender is queued. More...
 
void clear_redraw_observers ()
 Clear the redraw observers. More...
 
themeget_theme ()
 
void set_theme (const std::string &new_theme)
 
std::shared_ptr< gui::buttonfind_action_button (const std::string &id)
 Retrieves a pointer to a theme UI button. More...
 
std::shared_ptr< gui::buttonfind_menu_button (const std::string &id)
 
void create_buttons ()
 
void layout_buttons ()
 
void draw_buttons ()
 
void hide_buttons ()
 Hide theme buttons so they don't draw. More...
 
void unhide_buttons ()
 Unhide theme buttons so they draw again. More...
 
void refresh_report (const std::string &report_name, const config *new_cfg=nullptr)
 Update the given report. More...
 
void draw_report (const std::string &report_name, bool test_run=false)
 Draw the specified report. More...
 
bool draw_reports (const rect &region)
 Draw all reports in the given region. More...
 
void draw_minimap_units ()
 
void invalidate_all ()
 Function to invalidate all tiles. More...
 
bool invalidate (const map_location &loc)
 Function to invalidate a specific tile for redrawing. More...
 
bool invalidate (const std::set< map_location > &locs)
 
bool propagate_invalidation (const std::set< map_location > &locs)
 If this set is partially invalidated, invalidate all its hexes. More...
 
bool invalidate_locations_in_rect (const SDL_Rect &rect)
 invalidate all hexes under the rectangle rect (in screen coordinates) More...
 
bool invalidate_visible_locations_in_rect (const SDL_Rect &rect)
 
void invalidate_animations ()
 Function to invalidate animated terrains and units which may have changed. More...
 
void invalidate_animations_location (const map_location &loc)
 Per-location invalidation called by invalidate_animations() Extra game per-location invalidation (village ownership) More...
 
void reset_standing_animations ()
 
terrain_builderget_builder ()
 
void update_fps_label ()
 
void clear_fps_label ()
 
void update_fps_count ()
 
void rebuild_all ()
 Rebuild all dynamic terrain. More...
 
const theme::actionaction_pressed ()
 
const theme::menumenu_pressed ()
 
void set_diagnostic (const std::string &msg)
 
double turbo_speed () const
 
void bounds_check_position ()
 
void bounds_check_position (int &xpos, int &ypos) const
 
bool scroll (int xmov, int ymov, bool force=false)
 Scrolls the display by xmov,ymov pixels. More...
 
bool set_zoom (bool increase)
 Zooms the display in (true) or out (false). More...
 
bool set_zoom (unsigned int amount, const bool validate_value_and_set_index=true)
 Sets the display zoom to the specified amount. More...
 
void toggle_default_zoom ()
 Sets the zoom amount to the default. More...
 
bool view_locked () const
 
void set_view_locked (bool value)
 Sets whether the map view is locked (e.g. More...
 
void scroll_to_tile (const map_location &loc, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool force=true)
 Scroll such that location loc is on-screen. More...
 
void scroll_to_tiles (map_location loc1, map_location loc2, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, double add_spacing=0.0, bool force=true)
 Scroll such that location loc1 is on-screen. More...
 
void scroll_to_tiles (const std::vector< map_location >::const_iterator &begin, const std::vector< map_location >::const_iterator &end, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool only_if_possible=false, double add_spacing=0.0, bool force=true)
 Scroll to fit as many locations on-screen as possible, starting with the first. More...
 
void scroll_to_tiles (const std::vector< map_location > &locs, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool only_if_possible=false, double add_spacing=0.0, bool force=true)
 Scroll to fit as many locations on-screen as possible, starting with the first. More...
 
events::generic_eventscroll_event () const
 Expose the event, so observers can be notified about map scrolling. More...
 
bool tile_fully_on_screen (const map_location &loc) const
 Check if a tile is fully visible on screen. More...
 
bool tile_nearly_on_screen (const map_location &loc) const
 Checks if location loc or one of the adjacent tiles is visible on screen. More...
 
void set_prevent_draw (bool pd=true)
 Prevent the game display from drawing. More...
 
bool get_prevent_draw ()
 
void fade_tod_mask (const std::string &old, const std::string &new_)
 ToD mask smooth fade. More...
 
void fade_to (const color_t &color, int duration)
 Screen fade. More...
 
void set_fade (const color_t &color)
 
virtual void update () override
 Update animations and internal state. More...
 
virtual void layout () override
 Finalize screen layout. More...
 
virtual void render () override
 Update offscreen render buffers. More...
 
virtual bool expose (const rect &region) override
 Paint the indicated region to the screen. More...
 
virtual rect screen_location () override
 Return the current draw location of the display, on the screen. More...
 
map_labelslabels ()
 
const map_labelslabels () const
 
void announce (const std::string &msg, const color_t &color=font::GOOD_COLOR, const announce_options &options=announce_options())
 Announce a message prominently. More...
 
void recalculate_minimap ()
 Schedule the minimap for recalculation. More...
 
void redraw_minimap ()
 Schedule the minimap to be redrawn. More...
 
virtual const time_of_dayget_time_of_day (const map_location &loc=map_location::null_location()) const
 
virtual bool has_time_area () const
 
void blindfold (bool flag)
 
bool is_blindfolded () const
 
void write (config &cfg) const
 
void init_flags ()
 Init the flag list and the team colors used by ~TC. More...
 
void reinit_flags_for_team (const team &)
 Rebuild the flag list (not team colors) for a single side. More...
 
void reset_reports (reports &reports_object)
 
void draw_text_in_hex (const map_location &loc, const drawing_layer layer, const std::string &text, std::size_t font_size, color_t color, double x_in_hex=0.5, double y_in_hex=0.5)
 Draw text on a hex. More...
 
void drawing_buffer_add (const drawing_layer layer, const map_location &loc, decltype(draw_helper::do_draw) draw_func)
 Add an item to the drawing buffer. More...
 
void add_arrow (arrow &)
 
void remove_arrow (arrow &)
 
void update_arrow (arrow &a)
 Called by arrow objects when they change. More...
 
bool debug_flag_set (DEBUG_FLAG flag) const
 
void set_debug_flag (DEBUG_FLAG flag, bool value)
 
void toggle_debug_flag (DEBUG_FLAG flag)
 

Static Public Member Functions

static displayget_singleton ()
 Returns the display object if a display object exists. More...
 
static bool outside_area (const SDL_Rect &area, const int x, const int y)
 Check if the bbox of the hex at x,y has pixels outside the area rectangle. More...
 
static int hex_width ()
 Function which returns the width of a hex in pixels, up to where the next hex starts. More...
 
static int hex_size ()
 Function which returns the size of a hex in pixels (from top tip to bottom tip or left edge to right edge). More...
 
static double get_zoom_factor ()
 Returns the current zoom factor. More...
 
static rect scaled_to_zoom (const SDL_Rect &r)
 Scale the width and height of a rect by the current zoom factor. More...
 
static point scaled_to_zoom (const point &p)
 
static bool zoom_at_max ()
 
static bool zoom_at_min ()
 
static void add_submerge_ipf_mod (std::string &image_path, int image_height, double submersion_amount, int shift=0)
 

Protected Types

enum  TERRAIN_TYPE { BACKGROUND , FOREGROUND }
 
typedef std::map< map_location, std::string > exclusive_unit_draw_requests_t
 
typedef std::map< map_location, unsigned int > reach_map
 
typedef std::map< map_location, std::vector< overlay > > overlay_map
 

Protected Member Functions

map_location get_middle_location () const
 
virtual rect get_clip_rect () const
 Get the clipping rectangle for drawing. More...
 
virtual void draw_invalidated ()
 Only called when there's actual redrawing to do. More...
 
virtual void draw_hex (const map_location &loc)
 Redraws a single gamemap location. More...
 
void get_terrain_images (const map_location &loc, const std::string &timeid, TERRAIN_TYPE terrain_type)
 
std::vector< textureget_fog_shroud_images (const map_location &loc, image::TYPE image_type)
 
void scroll_to_xy (int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force=true)
 
void drawing_buffer_commit ()
 Draws the drawing_buffer_ and clears it. More...
 
bool draw_all_panels (const rect &region)
 Redraws all panels intersecting the given region. More...
 
void process_reachmap_changes ()
 
virtual overlay_mapget_overlays ()=0
 
- Protected Member Functions inherited from gui2::top_level_drawable
 top_level_drawable ()
 
virtual ~top_level_drawable ()
 
 top_level_drawable (const top_level_drawable &)
 
top_level_drawableoperator= (const top_level_drawable &)
 
 top_level_drawable (top_level_drawable &&)
 
top_level_drawableoperator= (top_level_drawable &&)
 

Static Protected Member Functions

static void fill_images_list (const std::string &prefix, std::vector< std::string > &images)
 
static const std::string & get_variant (const std::vector< std::string > &variants, const map_location &loc)
 

Protected Attributes

const display_contextdc_
 
halo::manager halo_man_
 
std::weak_ptr< wb::managerwb_
 
exclusive_unit_draw_requests_t exclusive_unit_draw_requests_
 map of hexes where only one unit should be drawn, the one identified by the associated id string More...
 
std::size_t currentTeam_
 
bool dont_show_all_
 
int xpos_
 Position of the top-left corner of the viewport, in pixels. More...
 
int ypos_
 
bool view_locked_
 
theme theme_
 
int zoom_index_
 
const std::unique_ptr< fake_unit_managerfake_unit_man_
 
const std::unique_ptr< terrain_builderbuilder_
 
std::function< rect(rect)> minimap_renderer_
 
SDL_Rect minimap_location_
 
bool redraw_background_
 
bool invalidateAll_
 
int diagnostic_label_
 
bool invalidateGameStatus_
 
const std::unique_ptr< map_labelsmap_labels_
 
reportsreports_object_
 
events::generic_event scroll_event_
 Event raised when the map is being scrolled. More...
 
boost::circular_buffer< unsigned > frametimes_
 
int current_frame_sample_ = 0
 
unsigned int fps_counter_
 
std::chrono::seconds fps_start_
 
unsigned int fps_actual_
 
uint32_t last_frame_finished_ = 0u
 
std::map< std::string, rectreportLocations_
 
std::map< std::string, texturereportSurfaces_
 
std::map< std::string, configreports_
 
std::vector< std::shared_ptr< gui::button > > menu_buttons_
 
std::vector< std::shared_ptr< gui::button > > action_buttons_
 
std::set< map_locationinvalidated_
 
texture tod_hex_mask1 = {}
 
texture tod_hex_mask2 = {}
 
uint8_t tod_hex_alpha1 = 0
 
uint8_t tod_hex_alpha2 = 0
 
std::vector< std::string > fog_images_
 
std::vector< std::string > shroud_images_
 
map_location selectedHex_
 
map_location mouseoverHex_
 
CKey keys_
 
bool animate_map_
 Local cache for preferences::animate_map, since it is constantly queried. More...
 
bool animate_water_
 Local version of preferences::animate_water, used to detect when it's changed. More...
 
std::size_t activeTeam_
 
std::list< draw_helperdrawing_buffer_
 
bool map_screenshot_
 Used to indicate to drawing functions that we are doing a map screenshot. More...
 
reach_map reach_map_
 
reach_map reach_map_old_
 
bool reach_map_changed_
 

Static Protected Attributes

static unsigned int zoom_ = DefaultZoom
 The current zoom, in pixels (on screen) per 72 pixels (in the graphic assets), i.e., 72 means 100%. More...
 
static unsigned int last_zoom_ = SmallZoom
 The previous value of zoom_. More...
 
static displaysingleton_ = nullptr
 

Private Types

typedef std::list< arrow * > arrows_list_t
 
typedef std::map< map_location, arrows_list_tarrows_map_t
 

Private Member Functions

void update_render_textures ()
 Ensure render textures are valid and correct. More...
 
void render_map_outside_area ()
 Draw/redraw the off-map background area. More...
 
void draw ()
 Perform rendering of invalidated items. More...
 
void draw_minimap ()
 Actually draw the minimap. More...
 
void read (const config &cfg)
 
void init_flags_for_side_internal (std::size_t side, const std::string &side_color)
 
texture get_flag (const map_location &loc)
 
void draw_panel (const theme::panel &panel)
 
void draw_label (const theme::label &label)
 

Private Attributes

bool prevent_draw_ = false
 
color_t fade_color_ = {0,0,0,0}
 
texture front_ = {}
 Render textures, for intermediate rendering. More...
 
texture back_ = {}
 
int blindfold_ctr_
 
std::vector< animated< image::locator > > flags_
 Animated flags for each team. More...
 
std::vector< textureterrain_image_vector_
 
int fps_handle_
 Handle for the label which displays frames per second. More...
 
int invalidated_hexes_
 Count work done for the debug info displayed under fps. More...
 
int drawn_hexes_
 
std::vector< std::function< void(display &)> > redraw_observers_
 
std::bitset< __NUM_DEBUG_FLAGSdebug_flags_
 Currently set debug flags. More...
 
arrows_map_t arrows_map_
 Maps the list of arrows for each location. More...
 
tod_color color_adjust_
 
std::vector< std::tuple< int, int, int > > fps_history_
 

Detailed Description

Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.

Definition at line 80 of file display.hpp.

Member Typedef Documentation

◆ arrows_list_t

typedef std::list<arrow*> display::arrows_list_t
private

Definition at line 999 of file display.hpp.

◆ arrows_map_t

typedef std::map<map_location, arrows_list_t > display::arrows_map_t
private

Definition at line 1000 of file display.hpp.

◆ exclusive_unit_draw_requests_t

typedef std::map<map_location, std::string> display::exclusive_unit_draw_requests_t
protected

Definition at line 680 of file display.hpp.

◆ overlay_map

typedef std::map<map_location, std::vector<overlay> > display::overlay_map
protected

Definition at line 946 of file display.hpp.

◆ reach_map

typedef std::map<map_location,unsigned int> display::reach_map
protected

Definition at line 940 of file display.hpp.

Member Enumeration Documentation

◆ DEBUG_FLAG

Enumerator
DEBUG_COORDINATES 

Overlays x,y coords on tiles.

DEBUG_TERRAIN_CODES 

Overlays terrain codes on tiles.

DEBUG_NUM_BITMAPS 

Overlays number of bitmaps on tiles.

DEBUG_FOREGROUND 

Separates background and foreground terrain layers.

DEBUG_BENCHMARK 

Toggle to continuously redraw the whole map.

__NUM_DEBUG_FLAGS 

Dummy entry to size the bitmask.

Keep this last!

Definition at line 960 of file display.hpp.

◆ drawing_layer

The layers to render something on.

This value should never be stored it's the internal drawing order and adding removing and reordering the layers should be safe. If needed in WML use the name and map that to the enum value.

Enumerator
LAYER_TERRAIN_BG 

Layer for the terrain drawn behind the unit.

LAYER_GRID_TOP 

Top half part of grid image.

LAYER_MOUSEOVER_OVERLAY 

Mouseover overlay used by editor.

LAYER_FOOTSTEPS 

Footsteps showing path from unit to mouse.

LAYER_MOUSEOVER_TOP 

Top half of image following the mouse.

LAYER_UNIT_FIRST 

Reserve layers to be selected for WML.

LAYER_UNIT_BG 

Used for the ellipse behind the unit.

LAYER_UNIT_DEFAULT 

default layer for drawing units

LAYER_TERRAIN_FG 

Layer for the terrain drawn in front of the unit.

LAYER_GRID_BOTTOM 

Used for the bottom half part of grid image.

Should be under moving units, to avoid masking south move.

LAYER_UNIT_MOVE_DEFAULT 

default layer for drawing moving units

LAYER_UNIT_FG 

Used for the ellipse in front of the unit.

LAYER_UNIT_MISSILE_DEFAULT 

default layer for missile frames

LAYER_UNIT_LAST 
LAYER_REACHMAP 

"black stripes" on unreachable hexes.

LAYER_MOUSEOVER_BOTTOM 

Bottom half of image following the mouse.

LAYER_FOG_SHROUD 

Fog and shroud.

LAYER_ARROWS 

Arrows from the arrows framework.

Used for planned moves display.

LAYER_ACTIONS_NUMBERING 

Move numbering for the whiteboard.

LAYER_SELECTED_HEX 

Image on the selected unit.

LAYER_ATTACK_INDICATOR 

Layer which holds the attack indicator.

LAYER_UNIT_BAR 

Unit bars and overlays are drawn on this layer (for testing here).

LAYER_MOVE_INFO 

Movement info (defense%, etc...).

LAYER_LINGER_OVERLAY 

The overlay used for the linger mode.

LAYER_BORDER 

The border of the map.

Definition at line 802 of file display.hpp.

◆ SCROLL_TYPE

Enumerator
SCROLL 
WARP 
ONSCREEN 
ONSCREEN_WARP 

Definition at line 499 of file display.hpp.

◆ TERRAIN_TYPE

enum display::TERRAIN_TYPE
protected
Enumerator
BACKGROUND 
FOREGROUND 

Definition at line 705 of file display.hpp.

Constructor & Destructor Documentation

◆ display()

display::display ( const display_context dc,
std::weak_ptr< wb::manager wb,
reports reports_object,
const std::string &  theme_id,
const config level 
)

◆ ~display()

display::~display ( )
virtual

Definition at line 238 of file display.cpp.

References resources::fake_units, and singleton_.

Member Function Documentation

◆ action_pressed()

const theme::action * display::action_pressed ( )

Definition at line 1604 of file display.cpp.

References action_buttons_, theme::actions(), i, utf8::index(), and theme_.

Referenced by controller_base::play_slice().

◆ add_arrow()

void display::add_arrow ( arrow arrow)

Definition at line 3261 of file display.cpp.

References arrows_map_, and arrow::get_path().

◆ add_exclusive_draw()

bool display::add_exclusive_draw ( const map_location loc,
unit unit 
)

Allows a unit to request to be the only one drawn in its hex.

Useful for situations where multiple units (one real, multiple temporary) can end up stacked, such as with the whiteboard.

Parameters
locThe location of the unit requesting exclusivity.
unitThe unit requesting exclusivity.
Returns
false if there's already an exclusive draw request for this location.

Definition at line 377 of file display.cpp.

References exclusive_unit_draw_requests_, unit::id(), and map_location::valid().

Referenced by wb::highlighter::highlight(), wb::highlighter::highlight_main_visitor::visit(), wb::highlighter::highlight_secondary_visitor::visit(), and wb::highlighter::unhighlight_visitor::visit().

◆ add_overlay()

void display::add_overlay ( const map_location loc,
const std::string &  image,
const std::string &  halo = "",
const std::string &  team_name = "",
const std::string &  item_id = "",
bool  visible_under_fog = true,
float  submerge = 0.0f,
float  z_order = 0 
)

Functions to add and remove overlays from locations.

An overlay is an image that is displayed on top of the tile. One tile may have multiple overlays.

Definition at line 114 of file display.cpp.

References halo::manager::add(), get_location_x(), get_location_y(), get_overlays(), halo_man_, and hex_size().

Referenced by editor::mouse_action_item::click_left(), and game_lua_kernel::intf_add_tile_overlay().

◆ add_redraw_observer()

void display::add_redraw_observer ( std::function< void(display &)>  f)

Adds a redraw observer, a function object to be called when a full rerender is queued.

Definition at line 2379 of file display.cpp.

References f, and redraw_observers_.

◆ add_submerge_ipf_mod()

void display::add_submerge_ipf_mod ( std::string &  image_path,
int  image_height,
double  submersion_amount,
int  shift = 0 
)
static

Definition at line 1504 of file display.cpp.

Referenced by draw_hex().

◆ adjust_color_overlay()

void display::adjust_color_overlay ( int  r,
int  g,
int  b 
)

Add r,g,b to the colors for all images displayed on the map.

Used for special effects like flashes.

Definition at line 418 of file display.cpp.

References b, color_adjust_, g, and update_tod().

Referenced by game_lua_kernel::intf_color_adjust().

◆ announce()

void display::announce ( const std::string &  msg,
const color_t color = font::GOOD_COLOR,
const announce_options options = announce_options() 
)

◆ blindfold()

void display::blindfold ( bool  flag)

Definition at line 469 of file display.cpp.

References blindfold_ctr_.

Referenced by blindfold::blindfold(), and blindfold::unblind().

◆ bounds_check_position() [1/2]

void display::bounds_check_position ( )

Definition at line 2212 of file display.cpp.

References MaxZoom, MinZoom, xpos_, ypos_, and zoom_.

Referenced by queue_rerender(), scroll(), scroll_to_xy(), and set_zoom().

◆ bounds_check_position() [2/2]

void display::bounds_check_position ( int &  xpos,
int &  ypos 
) const

◆ change_display_context()

void display::change_display_context ( const display_context dc)

Definition at line 463 of file display.cpp.

References builder_, dc_, and display_context::map().

Referenced by editor::context_manager::refresh_on_context_change().

◆ clear_exclusive_draws()

void display::clear_exclusive_draws ( )
inline

Cancels all the exclusive draw requests.

Definition at line 141 of file display.hpp.

References exclusive_unit_draw_requests_.

Referenced by wb::manager::on_gamestate_change().

◆ clear_fps_label()

void display::clear_fps_label ( )

Definition at line 1392 of file display.cpp.

References drawn_hexes_, fps_handle_, invalidated_hexes_, and font::remove_floating_label().

Referenced by draw().

◆ clear_redraw_observers()

void display::clear_redraw_observers ( )

Clear the redraw observers.

Definition at line 2384 of file display.cpp.

References redraw_observers_.

◆ create_buttons()

void display::create_buttons ( )

◆ debug_flag_set()

bool display::debug_flag_set ( DEBUG_FLAG  flag) const
inline

◆ displayed_unit_hex()

virtual const map_location& display::displayed_unit_hex ( ) const
inlinevirtual

Virtual functions shadowed in game_display.

These are needed to generate reports easily, without dynamic casting. Hope to factor out eventually.

Reimplemented in game_display.

Definition at line 212 of file display.hpp.

References map_location::null_location().

Referenced by get_visible_unit(), unit_hp(), and unit_status().

◆ draw()

void display::draw ( )
private

◆ draw_all_panels()

bool display::draw_all_panels ( const rect region)
protected

Redraws all panels intersecting the given region.

Returns true if something was drawn, false otherwise.

Definition at line 1454 of file display.cpp.

References draw_label(), draw_panel(), video::game_canvas(), label, theme::labels(), rect::overlaps(), theme::panels(), and theme_.

Referenced by expose().

◆ draw_buttons()

void display::draw_buttons ( )

Definition at line 940 of file display.cpp.

◆ draw_hex()

void display::draw_hex ( const map_location loc)
protectedvirtual

Redraws a single gamemap location.

Reimplemented in game_display, and editor::editor_display.

Definition at line 2671 of file display.cpp.

References __NUM_DEBUG_FLAGS, a, add_submerge_ipf_mod(), arrows_map_, tod_color::b, BACKGROUND, draw::blit(), time_of_day::color, color_adjust_, game_config::debug, DEBUG_COORDINATES, debug_flag_set(), debug_flags_, DEBUG_FOREGROUND, DEBUG_NUM_BITMAPS, DEBUG_TERRAIN_CODES, dont_show_all_, drawing_buffer_add(), display::rect_of_hexes::end(), draw::fill(), fog_images_, fogged(), FOREGROUND, tod_color::g, get_flag(), get_fog_shroud_images(), image::get_light_string(), image::get_lighted_texture(), get_map(), get_overlays(), image::get_size(), get_teams(), gamemap_base::get_terrain(), get_terrain_images(), gamemap::get_terrain_info(), font::get_text_renderer(), image::get_texture(), get_time_of_day(), get_variant(), preferences::grid(), game_config::images::grid_bottom, game_config::images::grid_top, image::HEXED, time_of_day::id, time_of_day::image_mask, is_shrouded(), LAYER_FOG_SHROUD, LAYER_GRID_BOTTOM, LAYER_GRID_TOP, LAYER_TERRAIN_BG, LAYER_TERRAIN_FG, LAYER_UNIT_DEFAULT, font::NORMAL_COLOR, gamemap_base::on_board(), output(), tod_color::r, renderer(), texture::set_alpha_mod(), shroud_images_, shrouded(), font::SIZE_TINY, utils::split(), t, terrain_image_vector_, image::TOD_COLORED, tod_hex_alpha1, tod_hex_alpha2, tod_hex_mask1, tod_hex_mask2, utils::trim(), terrain_type::unit_submerge(), and viewing_team().

Referenced by editor::editor_display::draw_hex(), game_display::draw_hex(), and draw_invalidated().

◆ draw_invalidated()

void display::draw_invalidated ( )
protectedvirtual

Only called when there's actual redrawing to do.

Loops through invalidated locations and redraws them. Derived classes can override this, possibly to insert pre- or post-processing around a call to the base class's function.

Reimplemented in game_display.

Definition at line 2630 of file display.cpp.

References DBG_DP, dc_, draw_hex(), drawn_hexes_, unit_map::end(), exclusive_unit_draw_requests_, unit_map::find(), get_clip_rect(), get_location_x(), get_location_y(), rect::intersect(), draw_manager::invalidate_region(), invalidated_, invalidated_hexes_, rect::overlaps(), draw::reduce_clip(), display_context::teams(), display_context::units(), and zoom_.

Referenced by draw(), and game_display::draw_invalidated().

◆ draw_label()

void display::draw_label ( const theme::label label)
private

◆ draw_minimap()

void display::draw_minimap ( )
private

◆ draw_minimap_units()

void display::draw_minimap_units ( )

◆ draw_panel()

void display::draw_panel ( const theme::panel panel)
private

◆ draw_report()

void display::draw_report ( const std::string &  report_name,
bool  test_run = false 
)

◆ draw_reports()

bool display::draw_reports ( const rect region)

Draw all reports in the given region.

Returns true if something was drawn, false otherwise.

Definition at line 3116 of file display.cpp.

References draw_report(), rect::overlaps(), reportLocations_, and reports_.

Referenced by expose().

◆ draw_text_in_hex()

void display::draw_text_in_hex ( const map_location loc,
const drawing_layer  layer,
const std::string &  text,
std::size_t  font_size,
color_t  color,
double  x_in_hex = 0.5,
double  y_in_hex = 0.5 
)

Draw text on a hex.

(0.5, 0.5) is the center. The font size is adjusted to the zoom factor.

Definition at line 1476 of file display.cpp.

References drawing_buffer_add(), font::get_text_renderer(), get_zoom_factor(), and renderer().

Referenced by wb::move::draw_hex(), wb::recall::draw_hex(), wb::recruit::draw_hex(), game_display::draw_hex(), game_display::draw_movement_info(), and wb::draw_numbers().

◆ drawing_buffer_add()

void display::drawing_buffer_add ( const drawing_layer  layer,
const map_location loc,
decltype(draw_helper::do_draw draw_func 
)

Add an item to the drawing buffer.

Parameters
layerThe layer to draw on.
locThe hex the image belongs to, needed for the drawing order.
draw_funcThe draw operation to be run.

Definition at line 1287 of file display.cpp.

References drawing_buffer_, get_location_x(), get_location_y(), and zoom_.

Referenced by arrow::draw_hex(), wb::attack::draw_hex(), wb::suppose_dead::draw_hex(), draw_hex(), editor::editor_display::draw_hex(), game_display::draw_hex(), game_display::draw_movement_info(), draw_text_in_hex(), and unit_drawer::redraw_unit().

◆ drawing_buffer_commit()

void display::drawing_buffer_commit ( )
protected

Draws the drawing_buffer_ and clears it.

Definition at line 1305 of file display.cpp.

References DBG_DP, drawing_buffer_, map_area(), and draw::reduce_clip().

Referenced by draw().

◆ expose()

bool display::expose ( const rect region)
overridevirtual

◆ fade_to()

void display::fade_to ( const color_t color,
int  duration 
)

◆ fade_tod_mask()

void display::fade_tod_mask ( const std::string &  old,
const std::string &  new_ 
)

◆ fill_images_list()

void display::fill_images_list ( const std::string &  prefix,
std::vector< std::string > &  images 
)
staticprotected

Definition at line 424 of file display.cpp.

References image::exists(), i, and s.

Referenced by display().

◆ find_action_button()

std::shared_ptr< gui::button > display::find_action_button ( const std::string &  id)

Retrieves a pointer to a theme UI button.

Note
The returned pointer may either be nullptr, meaning the button isn't defined by the current theme, or point to a valid gui::button object. However, the objects retrieved will be destroyed and recreated by draw() method calls. Do NOT store these pointers for longer than strictly necessary to accomplish a specific task before the next screen refresh.

Definition at line 805 of file display.cpp.

References action_buttons_, and b.

Referenced by create_buttons(), replay_controller::handle_generic_event(), editor::empty_palette::hide(), editor::location_palette::layout(), editor::palette_manager::layout(), layout_buttons(), hotkey::command_executor_default::set_button_state(), and play_controller::toggle_skipping_replay().

◆ find_menu_button()

std::shared_ptr< gui::button > display::find_menu_button ( const std::string &  id)

◆ fogged()

bool display::fogged ( const map_location loc) const

◆ get_builder()

terrain_builder& display::get_builder ( )
inline

Definition at line 456 of file display.hpp.

References builder_.

◆ get_clip_rect()

rect display::get_clip_rect ( ) const
protectedvirtual

Get the clipping rectangle for drawing.

Virtual since the editor might use a slightly different approach.

Reimplemented in editor::editor_display.

Definition at line 2625 of file display.cpp.

References map_area().

Referenced by draw_invalidated().

◆ get_color_overlay()

tod_color display::get_color_overlay ( ) const
inline

Definition at line 206 of file display.hpp.

References color_adjust_.

Referenced by game_lua_kernel::intf_get_color_adjust().

◆ get_disp_context()

const display_context& display::get_disp_context ( ) const
inline

◆ get_flag()

texture display::get_flag ( const map_location loc)
private

◆ get_fog_shroud_images()

std::vector< texture > display::get_fog_shroud_images ( const map_location loc,
image::TYPE  image_type 
)
protected

◆ get_halo_manager()

halo::manager& display::get_halo_manager ( )
inline

Definition at line 188 of file display.hpp.

References halo_man_.

◆ get_location()

point display::get_location ( const map_location loc) const

Definition at line 717 of file display.cpp.

References get_location_x(), and get_location_y().

◆ get_location_x()

int display::get_location_x ( const map_location loc) const

◆ get_location_y()

int display::get_location_y ( const map_location loc) const

◆ get_map()

const gamemap& display::get_map ( ) const
inline

◆ get_middle_location()

map_location display::get_middle_location ( ) const
protected

Definition at line 3286 of file display.cpp.

References map_area(), pixel_position_to_hex(), xpos_, and ypos_.

Referenced by write().

◆ get_overlays()

virtual overlay_map& display::get_overlays ( )
protectedpure virtual

◆ get_prevent_draw()

bool display::get_prevent_draw ( )

Definition at line 2253 of file display.cpp.

References prevent_draw_.

Referenced by gui2::dialogs::story_viewer::pre_show().

◆ get_singleton()

static display* display::get_singleton ( )
inlinestatic

Returns the display object if a display object exists.

Otherwise it returns nullptr. the display object represents the game gui which handles themewml and drawing the map. A display object only exists during a game or while the mapeditor is running.

Definition at line 95 of file display.hpp.

References singleton_.

Referenced by gui2::dialogs::preferences_dialog::apply_pixel_scale(), wb::recall::apply_temp_modifier(), wb::recruit::apply_temp_modifier(), wb::move::calculate_moves_left(), actions::shroud_clearer::clear_loc(), wb::manager::create_temp_move(), quit_confirmation::default_prompt(), ai::readonly_context_impl::diagnostic(), do_replay(), do_replay_handle(), arrow::draw_hex(), wb::attack::draw_hex(), wb::move::draw_hex(), wb::recall::draw_hex(), wb::recruit::draw_hex(), wb::suppose_dead::draw_hex(), wb::draw_numbers(), wb::side_actions::execute_net_cmd(), unit_filter_impl::unit_filter_compound::fill(), unit_frame::get_overlaped_hex(), terrain_label::get_rect(), actions::get_village(), wb::ghost_owner_unit(), gui2::dialogs::preferences_dialog::handle_theme_select(), terrain_label::hidden(), arrow::hide(), wb::highlighter::highlight(), wb::attack::init(), wb::suppose_dead::init(), intf_get_viewing_side(), wb::attack::invalidate(), unit_animation::invalidate(), actions::shroud_clearer::invalidate_after_clear(), arrow::invalidate_arrow_path(), unit::is_visible_to_team(), gui2::dialogs::label_settings::label_settings(), help::load_terrain_types_data(), pathfind::mark_route(), unit_animation::matches(), unit_map::move(), arrow::notify_arrow_changed(), wb::manager::on_gamestate_change(), actions::place_recruit(), unit_creator::post_create(), gui2::dialogs::story_viewer::post_show(), gui2::dialogs::story_viewer::pre_show(), image::prep_minimap_for_rendering(), turn_info::process_network_data(), terrain_label::recalculate(), actions::recalculate_fog(), actions::recall_unit(), actions::recruit_unit(), wb::attack::redraw(), wb::move::redraw(), wb::recall::redraw(), wb::recruit::redraw(), wb::suppose_dead::redraw(), unit_frame::redraw(), unit_animation_component::refresh(), REPORT_GENERATOR(), unit_display::reset_helpers(), wb::manager::save_recall(), wb::manager::save_recruit(), wb::manager::save_temp_attack(), preferences::set_show_standing_animations(), arrow::show(), ai::default_recruitment::recruitment::show_important_hexes(), preferences::show_theme_dialog(), hotkey::command_executor::surrender_game(), SYNCED_COMMAND_HANDLER_FUNCTION(), tod_stats_at(), wb::unghost_owner_unit(), wb::highlighter::unhighlight(), unit_display::unit_die(), unit_display::unit_draw_weapon(), unit_display::unit_sheath_weapon(), unit_animation::update_last_draw_time(), gui2::settings::update_screen_size_variables(), gui2::dialogs::custom_tod::update_tod_display(), wb::viewer_actions(), wb::viewer_side(), wb::viewer_team(), wb::highlighter::highlight_main_visitor::visit(), wb::highlighter::highlight_secondary_visitor::visit(), wb::highlighter::unhighlight_visitor::visit(), unit_animator::wait_until(), game_events::WML_HANDLER_FUNCTION(), and wb::suppose_dead::~suppose_dead().

◆ get_teams()

const std::vector<team>& display::get_teams ( ) const
inline

Definition at line 101 of file display.hpp.

References dc_, and display_context::teams().

Referenced by draw_hex().

◆ get_terrain_images()

void display::get_terrain_images ( const map_location loc,
const std::string &  timeid,
TERRAIN_TYPE  terrain_type 
)
protected

◆ get_theme()

theme& display::get_theme ( )
inline

◆ get_time_of_day()

const time_of_day & display::get_time_of_day ( const map_location loc = map_location::null_location()) const
virtual

Reimplemented in editor::editor_display, and game_display.

Definition at line 399 of file display.cpp.

Referenced by draw_hex(), get_terrain_images(), and update_tod().

◆ get_units()

const unit_map& display::get_units ( ) const
inline

◆ get_variant()

const std::string & display::get_variant ( const std::vector< std::string > &  variants,
const map_location loc 
)
staticprotected

Definition at line 446 of file display.cpp.

References map_location::x, and map_location::y.

Referenced by draw_hex().

◆ get_visible_hexes()

const rect_of_hexes display::get_visible_hexes ( ) const
inline

Returns the rectangular area of visible hexes.

Definition at line 355 of file display.hpp.

References hexes_under_rect(), and map_area().

Referenced by invalidate_animations(), editor::editor_display::layout(), and process_reachmap_changes().

◆ get_zoom_factor()

static double display::get_zoom_factor ( )
inlinestatic

◆ has_time_area()

virtual bool display::has_time_area ( ) const
inlinevirtual

Reimplemented in game_display.

Definition at line 648 of file display.hpp.

◆ hex_clicked_on()

const map_location display::hex_clicked_on ( int  x,
int  y 
) const

given x,y co-ordinates of an onscreen pixel, will return the location of the hex that this pixel corresponds to.

Returns an invalid location if the mouse isn't over any valid location.

Definition at line 557 of file display.cpp.

References rect::contains(), map_area(), pixel_position_to_hex(), xpos_, and ypos_.

Referenced by soundsource::positional_source::calculate_volume(), editor::brush_drag_mouse_action::click_left(), editor::mouse_action_paint::click_left(), editor::mouse_action_paste::click_left(), editor::mouse_action_fill::click_left(), editor::mouse_action_item::click_left(), editor::mouse_action_map_label::click_left(), editor::mouse_action_unit::click_left(), editor::brush_drag_mouse_action::click_right(), editor::mouse_action_paint::click_right(), editor::mouse_action_fill::click_right(), editor::mouse_action_item::drag_end_left(), editor::mouse_action_map_label::drag_end_left(), editor::mouse_action_unit::drag_end_left(), editor::brush_drag_mouse_action::drag_generic(), editor::mouse_action_item::drag_left(), editor::mouse_action_map_label::drag_left(), editor::mouse_action_unit::drag_left(), events::mouse_handler::hovered_hex(), events::mouse_handler_base::init_dragging(), editor::editor_controller::left_click(), editor::editor_controller::mouse_motion(), events::mouse_handler::mouse_motion(), events::mouse_handler_base::mouse_press(), editor::editor_controller::right_click(), events::mouse_handler::touch_motion(), editor::mouse_action_starting_position::up_left(), editor::mouse_action_item::up_left(), editor::mouse_action_map_label::up_left(), editor::mouse_action_unit::up_left(), editor::mouse_action_village::up_left(), editor::mouse_action_starting_position::up_right(), editor::mouse_action_map_label::up_right(), editor::mouse_action_village::up_right(), and editor::editor_toolkit::update_mouse_action_highlights().

◆ hex_size()

static int display::hex_size ( )
inlinestatic

Function which returns the size of a hex in pixels (from top tip to bottom tip or left edge to right edge).

Definition at line 258 of file display.hpp.

References zoom_.

Referenced by add_overlay(), draw_minimap(), unit_frame::get_overlaped_hex(), terrain_label::get_rect(), hexes_under_rect(), max_map_area(), minimap_location_on(), editor::mouse_action_unit::move(), outside_area(), pixel_position_to_hex(), unit_frame::redraw(), scroll_to_tiles(), and tile_nearly_on_screen().

◆ hex_width()

static int display::hex_width ( )
inlinestatic

Function which returns the width of a hex in pixels, up to where the next hex starts.

(i.e. not entirely from tip to tip – use hex_size() to get the distance from tip to tip)

Definition at line 252 of file display.hpp.

References zoom_.

Referenced by bounds_check_position(), draw_minimap(), get_location_x(), hexes_under_rect(), max_map_area(), minimap_location_on(), pixel_position_to_hex(), and tile_nearly_on_screen().

◆ hexes_under_rect()

const display::rect_of_hexes display::hexes_under_rect ( const SDL_Rect &  r) const

◆ hide_buttons()

void display::hide_buttons ( )

Hide theme buttons so they don't draw.

Definition at line 962 of file display.cpp.

References action_buttons_, and menu_buttons_.

Referenced by create_buttons().

◆ highlight_hex()

void display::highlight_hex ( map_location  hex)
virtual

◆ in_editor()

virtual bool display::in_editor ( ) const
inlinevirtual

Reimplemented in editor::editor_display.

Definition at line 209 of file display.hpp.

Referenced by terrain_label::viewable().

◆ in_game()

virtual bool display::in_game ( ) const
inlinevirtual

Reimplemented in game_display.

Definition at line 208 of file display.hpp.

◆ init_flags()

void display::init_flags ( )

Init the flag list and the team colors used by ~TC.

Definition at line 259 of file display.cpp.

References dc_, flags_, init_flags_for_side_internal(), t, and display_context::teams().

Referenced by display(), and editor::context_manager::refresh_on_context_change().

◆ init_flags_for_side_internal()

void display::init_flags_for_side_internal ( std::size_t  side,
const std::string &  side_color 
)
private

◆ invalidate() [1/2]

bool display::invalidate ( const map_location loc)

◆ invalidate() [2/2]

bool display::invalidate ( const std::set< map_location > &  locs)

Definition at line 3147 of file display.cpp.

References invalidateAll_, invalidated_, and map_screenshot_.

◆ invalidate_all()

void display::invalidate_all ( )

◆ invalidate_animations()

void display::invalidate_animations ( )

Function to invalidate animated terrains and units which may have changed.

Definition at line 3216 of file display.cpp.

References preferences::animate_map(), animate_map_, builder_, dc_, fake_unit_man_, get_visible_hexes(), halo_man_, invalidate(), invalidate_animations_location(), new_animation_frame(), shrouded(), display_context::units(), and halo::manager::update().

Referenced by layout().

◆ invalidate_animations_location()

void display::invalidate_animations_location ( const map_location loc)

Per-location invalidation called by invalidate_animations() Extra game per-location invalidation (village ownership)

Definition at line 3205 of file display.cpp.

References currentTeam_, dc_, flags_, fogged(), get_map(), invalidate(), display_context::teams(), and display_context::village_owner().

Referenced by invalidate_animations().

◆ invalidate_game_status()

void display::invalidate_game_status ( )
inline

◆ invalidate_locations_in_rect()

bool display::invalidate_locations_in_rect ( const SDL_Rect &  rect)

invalidate all hexes under the rectangle rect (in screen coordinates)

Definition at line 3190 of file display.cpp.

References DBG_DP, hexes_under_rect(), invalidate(), invalidateAll_, map_screenshot_, and draw::rect().

Referenced by invalidate_visible_locations_in_rect(), layout(), screenshot(), and scroll().

◆ invalidate_visible_locations_in_rect()

bool display::invalidate_visible_locations_in_rect ( const SDL_Rect &  rect)

Definition at line 3185 of file display.cpp.

References invalidate_locations_in_rect(), and map_area().

◆ is_blindfolded()

bool display::is_blindfolded ( ) const

◆ labels() [1/2]

map_labels & display::labels ( )

◆ labels() [2/2]

const map_labels & display::labels ( ) const

Definition at line 2620 of file display.cpp.

References map_labels_.

◆ layout()

void display::layout ( )
overridevirtual

◆ layout_buttons()

void display::layout_buttons ( )

◆ map_area()

rect display::map_area ( ) const

◆ map_outside_area()

rect display::map_outside_area ( ) const

◆ max_map_area()

rect display::max_map_area ( ) const

Returns the maximum area used for the map regardless to resolution and view size.

Definition at line 497 of file display.cpp.

References theme::border(), get_map(), gamemap_base::h(), hex_size(), hex_width(), theme::border_t::size, theme_, and gamemap_base::w().

Referenced by map_area(), map_outside_area(), and screenshot().

◆ menu_pressed()

const theme::menu * display::menu_pressed ( )

◆ minimap_area()

const rect & display::minimap_area ( ) const

mapx is the width of the portion of the display which shows the game area.

Between mapx and x is the sidebar region.

Definition at line 482 of file display.cpp.

References video::game_canvas(), theme::mini_map_location(), and theme_.

Referenced by draw_minimap(), expose(), minimap_location_on(), recalculate_minimap(), redraw_minimap(), and render().

◆ minimap_location_on()

map_location display::minimap_location_on ( int  x,
int  y 
)

given x,y co-ordinates of the mouse, will return the location of the hex in the minimap that the mouse is currently over, or an invalid location if the mouse isn't over the minimap.

Definition at line 725 of file display.cpp.

References utils::contains(), get_map(), gamemap_base::h(), h, hex_size(), hex_width(), minimap_area(), minimap_location_, pixel_position_to_hex(), w, gamemap_base::w(), map_location::x, and map_location::y.

Referenced by events::mouse_handler_base::left_click(), events::mouse_handler_base::mouse_motion_default(), events::mouse_handler_base::mouse_press(), and events::mouse_handler::touch_motion().

◆ mouseover_hex()

const map_location& display::mouseover_hex ( ) const
inline

◆ observers()

virtual const std::set<std::string>& display::observers ( ) const
inlinevirtual

Reimplemented in game_display.

Definition at line 214 of file display.hpp.

◆ outside_area()

bool display::outside_area ( const SDL_Rect &  area,
const int  x,
const int  y 
)
static

Check if the bbox of the hex at x,y has pixels outside the area rectangle.

Definition at line 549 of file display.cpp.

References hex_size().

Referenced by scroll_to_tiles(), set_zoom(), and tile_fully_on_screen().

◆ palette_area()

const rect & display::palette_area ( ) const

◆ pixel_position_to_hex()

const map_location display::pixel_position_to_hex ( int  x,
int  y 
) const

given x,y co-ordinates of a pixel on the map, will return the location of the hex that this pixel corresponds to.

Returns an invalid location if the mouse isn't over any valid location.

Definition at line 571 of file display.cpp.

References theme::border(), hex_size(), hex_width(), s, theme::border_t::size, and theme_.

Referenced by get_middle_location(), hex_clicked_on(), and minimap_location_on().

◆ playing_side()

virtual int display::playing_side ( ) const
inlinevirtual

Reimplemented in game_display.

Definition at line 213 of file display.hpp.

Referenced by attack_info(), gray_inactive(), and unit_moves().

◆ playing_team()

std::size_t display::playing_team ( ) const
inline

The playing team is the team whose turn it is.

Definition at line 104 of file display.hpp.

References activeTeam_.

Referenced by editor::mouse_action_village::up_left().

◆ process_reachmap_changes()

void display::process_reachmap_changes ( )
protected

◆ propagate_invalidation()

bool display::propagate_invalidation ( const std::set< map_location > &  locs)

If this set is partially invalidated, invalidate all its hexes.

Returns if any new invalidation was needed

Definition at line 3158 of file display.cpp.

References i, invalidateAll_, and invalidated_.

Referenced by unit_animation::invalidate().

◆ queue_repaint()

void display::queue_repaint ( )

Queues repainting to the screen, but doesn't rerender.

Definition at line 2372 of file display.cpp.

References draw_manager::invalidate_all().

◆ queue_rerender()

void display::queue_rerender ( )

◆ read()

void display::read ( const config cfg)
private

Definition at line 3301 of file display.cpp.

References tod_color::b, color_adjust_, tod_color::g, tod_color::r, and view_locked_.

Referenced by display().

◆ rebuild_all()

void display::rebuild_all ( )

Rebuild all dynamic terrain.

Definition at line 452 of file display.cpp.

References builder_.

Referenced by game_display::maybe_rebuild(), editor::context_manager::refresh_all(), and set_theme().

◆ recalculate_minimap()

void display::recalculate_minimap ( )

◆ redraw_minimap()

void display::redraw_minimap ( )

Schedule the minimap to be redrawn.

Useful if units have moved about on the map.

Definition at line 1673 of file display.cpp.

References draw_manager::invalidate_region(), and minimap_area().

Referenced by layout(), actions::place_recruit(), recalculate_minimap(), scroll(), scroll_to_xy(), and SYNCED_COMMAND_HANDLER_FUNCTION().

◆ refresh_report()

void display::refresh_report ( const std::string &  report_name,
const config new_cfg = nullptr 
)

◆ reinit_flags_for_team()

void display::reinit_flags_for_team ( const team t)

Rebuild the flag list (not team colors) for a single side.

Definition at line 275 of file display.cpp.

References init_flags_for_side_internal(), and t.

Referenced by game_lua_kernel::intf_set_side_id().

◆ reload_map()

void display::reload_map ( )

Updates internals that cache map size.

This should be called when the map size has changed.

Definition at line 457 of file display.cpp.

References builder_, and redraw_background_.

Referenced by editor::context_manager::reload_map(), and game_events::WML_HANDLER_FUNCTION().

◆ remove_arrow()

void display::remove_arrow ( arrow arrow)

Definition at line 3268 of file display.cpp.

References arrows_map_, and arrow::get_path().

◆ remove_exclusive_draw()

std::string display::remove_exclusive_draw ( const map_location loc)

Cancels an exclusive draw request.

Returns
The id of the unit whose exclusive draw request was canceled, or else the empty string if there was no exclusive draw request for this location.

Definition at line 387 of file display.cpp.

References exclusive_unit_draw_requests_, id, and map_location::valid().

Referenced by wb::highlighter::unhighlight().

◆ remove_overlay()

void display::remove_overlay ( const map_location loc)

remove_overlay will remove all overlays on a tile.

Definition at line 127 of file display.cpp.

References get_overlays().

Referenced by game_lua_kernel::intf_remove_tile_overlay().

◆ remove_single_overlay()

void display::remove_single_overlay ( const map_location loc,
const std::string &  toDelete 
)

remove_single_overlay will remove a single overlay from a tile

Definition at line 132 of file display.cpp.

References get_overlays().

Referenced by game_lua_kernel::intf_remove_tile_overlay().

◆ render()

void display::render ( )
overridevirtual

Update offscreen render buffers.

Reimplemented from gui2::top_level_drawable.

Reimplemented in game_display.

Definition at line 2473 of file display.cpp.

References DBG_DP, draw(), rect::empty(), ERR_DP, front_, minimap_area(), minimap_renderer_, prevent_draw_, recalculate_minimap(), and draw::set_render_target().

Referenced by game_display::render().

◆ render_map_outside_area()

void display::render_map_outside_area ( )
private

Draw/redraw the off-map background area.

This updates both render textures.

Definition at line 2599 of file display.cpp.

References back_, theme::border_t::background_image, theme::border(), draw::fill(), front_, image::get_texture(), i, map_outside_area(), draw::set_render_target(), theme_, and draw::tiled().

Referenced by draw(), and update_render_textures().

◆ reset_reports()

void display::reset_reports ( reports reports_object)
inline

Definition at line 664 of file display.hpp.

References reports_object_.

◆ reset_standing_animations()

void display::reset_standing_animations ( )

Definition at line 3254 of file display.cpp.

References dc_, and display_context::units().

◆ scaled_to_zoom() [1/2]

static point display::scaled_to_zoom ( const point p)
inlinestatic

Definition at line 273 of file display.hpp.

References get_zoom_factor(), and p.

◆ scaled_to_zoom() [2/2]

static rect display::scaled_to_zoom ( const SDL_Rect &  r)
inlinestatic

Scale the width and height of a rect by the current zoom factor.

Definition at line 267 of file display.hpp.

References get_zoom_factor().

◆ screen_location()

rect display::screen_location ( )
overridevirtual

Return the current draw location of the display, on the screen.

Implements gui2::top_level_drawable.

Definition at line 2546 of file display.cpp.

References video::game_canvas(), and map_screenshot_.

◆ screenshot()

surface display::screenshot ( bool  map_screenshot = false)

◆ scroll()

bool display::scroll ( int  xmov,
int  ymov,
bool  force = false 
)

◆ scroll_event()

events::generic_event& display::scroll_event ( ) const
inline

Expose the event, so observers can be notified about map scrolling.

Definition at line 537 of file display.hpp.

References scroll_event_.

Referenced by soundsource::manager::manager().

◆ scroll_to_tile()

void display::scroll_to_tile ( const map_location loc,
SCROLL_TYPE  scroll_type = ONSCREEN,
bool  check_fogged = true,
bool  force = true 
)

◆ scroll_to_tiles() [1/3]

void display::scroll_to_tiles ( const std::vector< map_location > &  locs,
SCROLL_TYPE  scroll_type = ONSCREEN,
bool  check_fogged = true,
bool  only_if_possible = false,
double  add_spacing = 0.0,
bool  force = true 
)
inline

Scroll to fit as many locations on-screen as possible, starting with the first.

Definition at line 527 of file display.hpp.

References scroll_to_tiles().

◆ scroll_to_tiles() [2/3]

void display::scroll_to_tiles ( const std::vector< map_location >::const_iterator &  begin,
const std::vector< map_location >::const_iterator &  end,
SCROLL_TYPE  scroll_type = ONSCREEN,
bool  check_fogged = true,
bool  only_if_possible = false,
double  add_spacing = 0.0,
bool  force = true 
)

Scroll to fit as many locations on-screen as possible, starting with the first.

Definition at line 2089 of file display.cpp.

References display::rect_of_hexes::begin(), display::rect_of_hexes::end(), ERR_DP, fogged(), get_location_x(), get_location_y(), get_map(), h, hex_size(), map_area(), ONSCREEN, ONSCREEN_WARP, outside_area(), scroll_to_xy(), and w.

◆ scroll_to_tiles() [3/3]

void display::scroll_to_tiles ( map_location  loc1,
map_location  loc2,
SCROLL_TYPE  scroll_type = ONSCREEN,
bool  check_fogged = true,
double  add_spacing = 0.0,
bool  force = true 
)

Scroll such that location loc1 is on-screen.

It will also try to make it such that loc2 is on-screen, but this is not guaranteed. For ONSCREEN scrolls add_spacing sets the desired minimum distance from the border in hexes.

Definition at line 2079 of file display.cpp.

Referenced by unit_display::unit_mover::proceed_to(), scroll_to_tile(), scroll_to_tiles(), unit_display::unit_mover::start(), unit_display::unit_attack(), and unit_display::unit_recruited().

◆ scroll_to_xy()

void display::scroll_to_xy ( int  screenxpos,
int  screenypos,
SCROLL_TYPE  scroll_type,
bool  force = true 
)
protected

◆ select_hex()

void display::select_hex ( map_location  hex)
virtual

Reimplemented in game_display.

Definition at line 1546 of file display.cpp.

References invalidate(), recalculate_minimap(), and selectedHex_.

Referenced by game_display::select_hex(), and unit_display::unit_attack().

◆ selected_hex()

const map_location& display::selected_hex ( ) const
inline

◆ set_debug_flag()

void display::set_debug_flag ( DEBUG_FLAG  flag,
bool  value 
)
inline

Definition at line 985 of file display.hpp.

References debug_flags_, and game_config::images::flag.

Referenced by editor::editor_controller::init_gui().

◆ set_diagnostic()

void display::set_diagnostic ( const std::string &  msg)

◆ set_fade()

void display::set_fade ( const color_t color)

Definition at line 2315 of file display.cpp.

References c, and fade_color_.

◆ set_playing_team()

void display::set_playing_team ( std::size_t  team)

set_playing_team sets the team whose turn it currently is

Definition at line 370 of file display.cpp.

References activeTeam_, invalidate_game_status(), and utf8::size().

Referenced by editor::context_manager::refresh_on_context_change().

◆ set_prevent_draw()

void display::set_prevent_draw ( bool  pd = true)

Prevent the game display from drawing.

Used while story screen is showing to prevent flicker.

Definition at line 2244 of file display.cpp.

References prevent_draw_, and unhide_buttons().

Referenced by gui2::dialogs::story_viewer::post_show(), and gui2::dialogs::story_viewer::pre_show().

◆ set_team()

void display::set_team ( std::size_t  team,
bool  observe = false 
)

Sets the team controlled by the player using the computer.

Data from this team will be displayed in the game status.

Definition at line 353 of file display.cpp.

References currentTeam_, dc_, dont_show_all_, labels(), map_labels::recalculate_labels(), map_labels::set_team(), show_everything(), utf8::size(), display_context::teams(), w, and wb_.

Referenced by turn_info::process_network_data(), and editor::context_manager::refresh_on_context_change().

◆ set_theme()

void display::set_theme ( const std::string &  new_theme)

◆ set_view_locked()

void display::set_view_locked ( bool  value)
inline

Sets whether the map view is locked (e.g.

so the user can't scroll away)

Definition at line 497 of file display.hpp.

References view_locked_.

Referenced by game_lua_kernel::intf_lock_view().

◆ set_zoom() [1/2]

bool display::set_zoom ( bool  increase)

◆ set_zoom() [2/2]

bool display::set_zoom ( unsigned int  amount,
const bool  validate_value_and_set_index = true 
)

◆ show_everything()

bool display::show_everything ( ) const
inline

◆ shrouded()

bool display::shrouded ( const map_location loc) const

◆ team_valid()

bool display::team_valid ( ) const

◆ tile_fully_on_screen()

bool display::tile_fully_on_screen ( const map_location loc) const

Check if a tile is fully visible on screen.

Definition at line 1968 of file display.cpp.

References get_location_x(), get_location_y(), map_area(), and outside_area().

Referenced by unit_display::unit_mover::proceed_to().

◆ tile_nearly_on_screen()

bool display::tile_nearly_on_screen ( const map_location loc) const

Checks if location loc or one of the adjacent tiles is visible on screen.

Definition at line 1975 of file display.cpp.

References get_location_x(), get_location_y(), hex_size(), hex_width(), and map_area().

Referenced by unit_animation::invalidate(), and unit_animation_component::refresh().

◆ toggle_debug_flag()

void display::toggle_debug_flag ( DEBUG_FLAG  flag)
inline

Definition at line 990 of file display.hpp.

References debug_flags_, and game_config::images::flag.

Referenced by editor::editor_controller::do_execute_command().

◆ toggle_default_zoom()

void display::toggle_default_zoom ( )

Sets the zoom amount to the default.

Definition at line 1956 of file display.cpp.

References DefaultZoom, last_zoom_, set_zoom(), and zoom_.

Referenced by hotkey::command_executor_default::zoom_default().

◆ turbo_speed()

double display::turbo_speed ( ) const

◆ unhide_buttons()

void display::unhide_buttons ( )

Unhide theme buttons so they draw again.

Definition at line 972 of file display.cpp.

References action_buttons_, and menu_buttons_.

Referenced by set_prevent_draw().

◆ unit_image_area()

const rect & display::unit_image_area ( ) const

Definition at line 492 of file display.cpp.

References video::game_canvas(), theme_, and theme::unit_image_location().

◆ update()

void display::update ( )
overridevirtual

Update animations and internal state.

Reimplemented from gui2::top_level_drawable.

Reimplemented in game_display.

Definition at line 2425 of file display.cpp.

References preferences::animate_water(), animate_water_, builder_, DEBUG_BENCHMARK, debug_flag_set(), invalidate_all(), and update_render_textures().

Referenced by game_display::update().

◆ update_arrow()

void display::update_arrow ( arrow a)

Called by arrow objects when they change.

You should not need to call this directly.

Definition at line 3275 of file display.cpp.

References arrows_map_, arrow::get_path(), and arrow::get_previous_path().

◆ update_fps_count()

void display::update_fps_count ( )

◆ update_fps_label()

void display::update_fps_label ( )

◆ update_render_textures()

void display::update_render_textures ( )
private

◆ update_tod()

void display::update_tod ( const time_of_day tod_override = nullptr)

Applies r,g,b coloring to the map.

The color is usually taken from get_time_of_day unless tod_override is given, in which case that color is used.

Parameters
tod_overrideThe ToD to apply to the map instead of that of the current ToD's.

Definition at line 405 of file display.cpp.

References tod_color::b, time_of_day::color, color_adjust_, tod_color::g, get_time_of_day(), invalidate_all(), tod_color::r, and image::set_color_adjustment().

Referenced by adjust_color_overlay(), game_display::new_turn(), and gui2::dialogs::custom_tod::update_tod_display().

◆ view_locked()

bool display::view_locked ( ) const
inline

Definition at line 494 of file display.hpp.

References view_locked_.

Referenced by game_lua_kernel::intf_view_locked().

◆ viewing_side()

int display::viewing_side ( ) const
inline

◆ viewing_team()

std::size_t display::viewing_team ( ) const
inline

The viewing team is the team currently viewing the game.

It's the team whose gold and income is shown in the top bar of the default theme.

For players, it will be their side (or one of them, if they control multiple sides).

The value returned is a 0-based index into the vector returned by get_teams().

Definition at line 116 of file display.hpp.

References currentTeam_.

Referenced by attack_info(), quit_confirmation::default_prompt(), game_display::display_unit_hex(), draw_hex(), game_display::draw_hex(), get_selected_unit(), get_selected_unit_ptr(), get_visible_time_of_day_at(), get_visible_unit(), events::menu_handler::has_friends(), game_display::highlight_hex(), game_lua_kernel::intf_get_displayed_unit(), pathfind::mark_route(), turn_info::process_network_data(), events::menu_handler::status_table(), hotkey::command_executor::surrender_game(), wb::viewer_actions(), wb::viewer_team(), and events::mouse_handler::viewing_team().

◆ write()

void display::write ( config cfg) const

◆ zoom_at_max()

bool display::zoom_at_max ( )
static

Definition at line 1877 of file display.cpp.

References MaxZoom, and zoom_.

◆ zoom_at_min()

bool display::zoom_at_min ( )
static

Definition at line 1882 of file display.cpp.

References MinZoom, and zoom_.

Member Data Documentation

◆ action_buttons_

std::vector<std::shared_ptr<gui::button> > display::action_buttons_
protected

◆ activeTeam_

std::size_t display::activeTeam_
protected

Definition at line 858 of file display.hpp.

Referenced by game_display::playing_side(), playing_team(), and set_playing_team().

◆ animate_map_

bool display::animate_map_
protected

Local cache for preferences::animate_map, since it is constantly queried.

Definition at line 779 of file display.hpp.

Referenced by get_flag(), get_terrain_images(), and invalidate_animations().

◆ animate_water_

bool display::animate_water_
protected

Local version of preferences::animate_water, used to detect when it's changed.

Definition at line 782 of file display.hpp.

Referenced by update().

◆ arrows_map_

arrows_map_t display::arrows_map_
private

Maps the list of arrows for each location.

Definition at line 1002 of file display.hpp.

Referenced by add_arrow(), draw_hex(), remove_arrow(), and update_arrow().

◆ back_

texture display::back_ = {}
private

Definition at line 587 of file display.hpp.

Referenced by render_map_outside_area(), scroll(), and update_render_textures().

◆ blindfold_ctr_

int display::blindfold_ctr_
private

Definition at line 672 of file display.hpp.

Referenced by blindfold(), display(), and is_blindfolded().

◆ builder_

const std::unique_ptr<terrain_builder> display::builder_
protected

◆ color_adjust_

tod_color display::color_adjust_
private

◆ current_frame_sample_

int display::current_frame_sample_ = 0
protected

Definition at line 753 of file display.hpp.

Referenced by update_fps_label().

◆ currentTeam_

std::size_t display::currentTeam_
protected

◆ dc_

const display_context* display::dc_
protected

◆ debug_flags_

std::bitset<__NUM_DEBUG_FLAGS> display::debug_flags_
private

Currently set debug flags.

Definition at line 997 of file display.hpp.

Referenced by debug_flag_set(), draw_hex(), set_debug_flag(), and toggle_debug_flag().

◆ diagnostic_label_

int display::diagnostic_label_
protected

Definition at line 744 of file display.hpp.

Referenced by set_diagnostic().

◆ dont_show_all_

bool display::dont_show_all_
protected

◆ drawing_buffer_

std::list<draw_helper> display::drawing_buffer_
protected

Definition at line 899 of file display.hpp.

Referenced by drawing_buffer_add(), and drawing_buffer_commit().

◆ drawn_hexes_

int display::drawn_hexes_
private

Definition at line 955 of file display.hpp.

Referenced by clear_fps_label(), draw_invalidated(), and update_fps_label().

◆ exclusive_unit_draw_requests_

exclusive_unit_draw_requests_t display::exclusive_unit_draw_requests_
protected

map of hexes where only one unit should be drawn, the one identified by the associated id string

Definition at line 682 of file display.hpp.

Referenced by add_exclusive_draw(), clear_exclusive_draws(), draw_invalidated(), game_display::draw_invalidated(), and remove_exclusive_draw().

◆ fade_color_

color_t display::fade_color_ = {0,0,0,0}
private

Definition at line 562 of file display.hpp.

Referenced by expose(), fade_to(), and set_fade().

◆ fake_unit_man_

const std::unique_ptr<fake_unit_manager> display::fake_unit_man_
protected

Definition at line 738 of file display.hpp.

Referenced by display(), game_display::draw_invalidated(), and invalidate_animations().

◆ flags_

std::vector<animated<image::locator> > display::flags_
private

Animated flags for each team.

Definition at line 789 of file display.hpp.

Referenced by get_flag(), init_flags(), init_flags_for_side_internal(), and invalidate_animations_location().

◆ fog_images_

std::vector<std::string> display::fog_images_
protected

Definition at line 771 of file display.hpp.

Referenced by display(), and draw_hex().

◆ fps_actual_

unsigned int display::fps_actual_
protected

Definition at line 756 of file display.hpp.

Referenced by update_fps_count(), and update_fps_label().

◆ fps_counter_

unsigned int display::fps_counter_
protected

Definition at line 754 of file display.hpp.

Referenced by update_fps_count().

◆ fps_handle_

int display::fps_handle_
private

Handle for the label which displays frames per second.

Definition at line 952 of file display.hpp.

Referenced by clear_fps_label(), draw(), and update_fps_label().

◆ fps_history_

std::vector<std::tuple<int, int, int> > display::fps_history_
private

Definition at line 1006 of file display.hpp.

Referenced by update_fps_label().

◆ fps_start_

std::chrono::seconds display::fps_start_
protected

Definition at line 755 of file display.hpp.

Referenced by update_fps_count().

◆ frametimes_

boost::circular_buffer<unsigned> display::frametimes_
protected

Definition at line 752 of file display.hpp.

Referenced by update_fps_count(), and update_fps_label().

◆ front_

texture display::front_ = {}
private

Render textures, for intermediate rendering.

Definition at line 586 of file display.hpp.

Referenced by expose(), render(), render_map_outside_area(), scroll(), and update_render_textures().

◆ halo_man_

halo::manager display::halo_man_
protected

Definition at line 677 of file display.hpp.

Referenced by add_overlay(), expose(), get_halo_manager(), and invalidate_animations().

◆ invalidateAll_

bool display::invalidateAll_
protected

◆ invalidated_

std::set<map_location> display::invalidated_
protected

◆ invalidated_hexes_

int display::invalidated_hexes_
private

Count work done for the debug info displayed under fps.

Definition at line 954 of file display.hpp.

Referenced by clear_fps_label(), draw_invalidated(), and update_fps_label().

◆ invalidateGameStatus_

bool display::invalidateGameStatus_
protected

◆ keys_

CKey display::keys_
protected

Definition at line 776 of file display.hpp.

Referenced by turbo_speed().

◆ last_frame_finished_

uint32_t display::last_frame_finished_ = 0u
protected

Definition at line 757 of file display.hpp.

Referenced by update_fps_count().

◆ last_zoom_

unsigned int display::last_zoom_ = SmallZoom
staticprotected

The previous value of zoom_.

Definition at line 737 of file display.hpp.

Referenced by set_zoom(), and toggle_default_zoom().

◆ map_labels_

const std::unique_ptr<map_labels> display::map_labels_
protected

Definition at line 746 of file display.hpp.

Referenced by labels().

◆ map_screenshot_

bool display::map_screenshot_
protected

Used to indicate to drawing functions that we are doing a map screenshot.

Definition at line 926 of file display.hpp.

Referenced by draw(), editor::editor_display::draw_hex(), game_display::draw_hex(), invalidate(), invalidate_locations_in_rect(), map_area(), map_outside_area(), screen_location(), and screenshot().

◆ menu_buttons_

std::vector<std::shared_ptr<gui::button> > display::menu_buttons_
protected

◆ minimap_location_

SDL_Rect display::minimap_location_
protected

Definition at line 741 of file display.hpp.

Referenced by draw_minimap(), draw_minimap_units(), and minimap_location_on().

◆ minimap_renderer_

std::function<rect(rect)> display::minimap_renderer_
protected

Definition at line 740 of file display.hpp.

Referenced by draw_minimap(), recalculate_minimap(), and render().

◆ mouseoverHex_

map_location display::mouseoverHex_
protected

◆ prevent_draw_

bool display::prevent_draw_ = false
private

Definition at line 551 of file display.hpp.

Referenced by create_buttons(), expose(), get_prevent_draw(), render(), and set_prevent_draw().

◆ reach_map_

reach_map display::reach_map_
protected

◆ reach_map_changed_

bool display::reach_map_changed_
protected

◆ reach_map_old_

reach_map display::reach_map_old_
protected

Definition at line 942 of file display.hpp.

Referenced by process_reachmap_changes().

◆ redraw_background_

bool display::redraw_background_
protected

Definition at line 742 of file display.hpp.

Referenced by draw(), layout(), queue_rerender(), reload_map(), and set_zoom().

◆ redraw_observers_

std::vector<std::function<void(display&)> > display::redraw_observers_
private

Definition at line 957 of file display.hpp.

Referenced by add_redraw_observer(), clear_redraw_observers(), and queue_rerender().

◆ reportLocations_

std::map<std::string, rect> display::reportLocations_
protected

Definition at line 760 of file display.hpp.

Referenced by draw_report(), draw_reports(), queue_rerender(), and refresh_report().

◆ reports_

std::map<std::string, config> display::reports_
protected

Definition at line 762 of file display.hpp.

Referenced by draw_report(), draw_reports(), queue_rerender(), and refresh_report().

◆ reports_object_

reports* display::reports_object_
protected

Definition at line 747 of file display.hpp.

Referenced by game_display::layout(), refresh_report(), and reset_reports().

◆ reportSurfaces_

std::map<std::string, texture> display::reportSurfaces_
protected

Definition at line 761 of file display.hpp.

Referenced by queue_rerender().

◆ scroll_event_

events::generic_event display::scroll_event_
mutableprotected

Event raised when the map is being scrolled.

Definition at line 750 of file display.hpp.

Referenced by scroll(), and scroll_event().

◆ selectedHex_

map_location display::selectedHex_
protected

◆ shroud_images_

std::vector<std::string> display::shroud_images_
protected

Definition at line 772 of file display.hpp.

Referenced by display(), and draw_hex().

◆ singleton_

display * display::singleton_ = nullptr
staticprotected

Definition at line 1009 of file display.hpp.

Referenced by display(), get_singleton(), game_display::get_singleton(), and ~display().

◆ terrain_image_vector_

std::vector<texture> display::terrain_image_vector_
private

Definition at line 793 of file display.hpp.

Referenced by draw_hex(), and get_terrain_images().

◆ theme_

theme display::theme_
protected

◆ tod_hex_alpha1

uint8_t display::tod_hex_alpha1 = 0
protected

Definition at line 769 of file display.hpp.

Referenced by draw_hex(), and fade_tod_mask().

◆ tod_hex_alpha2

uint8_t display::tod_hex_alpha2 = 0
protected

Definition at line 770 of file display.hpp.

Referenced by draw_hex(), and fade_tod_mask().

◆ tod_hex_mask1

texture display::tod_hex_mask1 = {}
protected

Definition at line 767 of file display.hpp.

Referenced by draw_hex(), and fade_tod_mask().

◆ tod_hex_mask2

texture display::tod_hex_mask2 = {}
protected

Definition at line 768 of file display.hpp.

Referenced by draw_hex(), and fade_tod_mask().

◆ view_locked_

bool display::view_locked_
protected

Definition at line 728 of file display.hpp.

Referenced by read(), scroll(), scroll_to_xy(), set_view_locked(), view_locked(), and write().

◆ wb_

std::weak_ptr<wb::manager> display::wb_
protected

◆ xpos_

int display::xpos_
protected

Position of the top-left corner of the viewport, in pixels.

Dependent on zoom_.. For example, ypos_==72 only means we're one hex below the top of the map when zoom_ == 72 (the default value).

Definition at line 727 of file display.hpp.

Referenced by bounds_check_position(), draw_minimap(), get_location_x(), get_middle_location(), hex_clicked_on(), hexes_under_rect(), screenshot(), scroll(), scroll_to_xy(), and set_zoom().

◆ ypos_

int display::ypos_
protected

◆ zoom_

unsigned int display::zoom_ = DefaultZoom
staticprotected

The current zoom, in pixels (on screen) per 72 pixels (in the graphic assets), i.e., 72 means 100%.

Definition at line 734 of file display.hpp.

Referenced by bounds_check_position(), display(), draw_invalidated(), drawing_buffer_add(), game_display::float_label(), get_location_y(), get_zoom_factor(), hex_size(), hex_width(), set_zoom(), toggle_default_zoom(), zoom_at_max(), and zoom_at_min().

◆ zoom_index_

int display::zoom_index_
protected

Definition at line 735 of file display.hpp.

Referenced by display(), and set_zoom().


The documentation for this class was generated from the following files: