The Battle for Wesnoth  1.15.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

#include <display.hpp>

Inheritance diagram for display:
Inheritance graph

Classes

struct  announce_options
 Holds options for calls to function 'announce' (announce). More...
 

Public Types

enum  SCROLL_TYPE { SCROLL, WARP, ONSCREEN, ONSCREEN_WARP }
 

Public Member Functions

 display (const display_context *dc, std::weak_ptr< wb::manager > wb, const config &theme_cfg, const config &level, bool auto_join=true)
 
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
 
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)
 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_contextcurrent_display_context () const
 
void reset_halo_manager ()
 
void reset_halo_manager (halo::manager &hm)
 
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...
 
CVideovideo ()
 Gets the underlying screen object. More...
 
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
 In this case give an obviously wrong answer to fail fast, since this could actually cause a big bug. More...
 
virtual const std::set< std::string > & observers () const
 
const SDL_Rect & minimap_area () const
 mapx is the width of the portion of the display which shows the game area. More...
 
const SDL_Rect & palette_area () const
 
const SDL_Rect & unit_image_area () const
 
const SDL_Rect & max_map_area () const
 Returns the maximum area used for the map regardless to resolution and view size. More...
 
const SDL_Rect & map_area () const
 Returns the area used for the map. More...
 
const SDL_Rect map_outside_area () const
 Returns the available area for a map, this may differ from the above. More...
 
double get_zoom_factor () const
 Returns the current zoom factor. 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)
 
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
 
SDL_Point get_loc_drawing_origin (const map_location &loc) const
 Wrapper to return the drawing origin for the specified location in screen coordinates. More...
 
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...
 
void set_grid (const bool grid)
 Determines whether a grid should be overlayed on the game board. More...
 
bool get_draw_coordinates () const
 Getter for the x,y debug overlay on tiles. More...
 
void set_draw_coordinates (bool value)
 Setter for the x,y debug overlay on tiles. More...
 
bool get_draw_terrain_codes () const
 Getter for the terrain code debug overlay on tiles. More...
 
void set_draw_terrain_codes (bool value)
 Setter for the terrain code debug overlay on tiles. More...
 
bool get_draw_num_of_bitmaps () const
 Getter for the number of bitmaps debug overlay on tiles. More...
 
void set_draw_num_of_bitmaps (bool value)
 Setter for the terrain code debug overlay on tiles. More...
 
surface screenshot (bool map_screenshot=false)
 Capture a (map-)screenshot into a surface. More...
 
themeget_theme ()
 
void set_theme (config theme_cfg)
 
void invalidate_animations ()
 Function to invalidate animated terrains and units which may have changed. More...
 
void reset_standing_animations ()
 
void set_mouseover_hex_overlay (const surface &image)
 mouseover_hex_overlay_ require a prerendered surface and is drawn underneath the mouse's location More...
 
void clear_mouseover_hex_overlay ()
 
terrain_builderget_builder ()
 
void rebuild_all ()
 Rebuild all dynamic terrain. More...
 
void set_diagnostic (const std::string &msg)
 
void set_turbo (const bool turbo)
 Set/Get whether 'turbo' mode is on. More...
 
double turbo_speed () const
 
void set_turbo_speed (const double speed)
 
void set_idle_anim (bool ison)
 control unit idle animations and their frequency More...
 
bool idle_anim () const
 
void set_idle_anim_rate (int rate)
 
double idle_anim_rate () 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 set_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...
 
events::generic_eventcomplete_redraw_event ()
 
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...
 
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
 
virtual void handle_event (const SDL_Event &) override
 
virtual void handle_window_event (const SDL_Event &event) override
 
void init_flags ()
 Initialize the flag list for all sides. More...
 
void init_flags (std::size_t side_index)
 Initialize the flag list for a single side. More...
 
void draw_debugging_aids ()
 
template<typename... T>
void render_scaled_to_zoom (const texture &tex, const int x_pos, const int y_pos, T &&... extra_args) const
 Renders a texture directly to the screen (or current rendering target) scaled to the current zoom factor. More...
 
template<typename... T>
void render_scaled_to_zoom (const texture &tex, const map_location &loc, T &&... extra_args) const
 Renders a texture directly to the screen (or current rendering target) scaled to the current zoom factor. More...
 
map_location get_middle_location () const
 
int draw_text_in_hex (const map_location &loc, const std::string &text, std::size_t font_size, color_t color, int fl_label_id=0, double x_in_hex=0.5, double y_in_hex=0.5)
 Adds a floating label with the specified text at the given location. More...
 
void add_arrow (arrow &)
 
void remove_arrow (arrow &)
 
void update_arrow (arrow &a)
 Called by arrow objects when they change. More...
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual void volatile_draw ()
 
virtual void volatile_undraw ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void process_help_string (int, int)
 
virtual void process_tooltip_string (int, int)
 
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 
virtual bool has_joined ()
 
virtual bool has_joined_global ()
 

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 void toggle_benchmark ()
 Toggle to continuously redraw the screen. More...
 
static void toggle_debug_foreground ()
 Toggle to debug foreground terrain. More...
 
static bool zoom_at_max ()
 
static bool zoom_at_min ()
 

Protected Types

using exclusive_unit_draw_requests_t = std::map< map_location, std::string >
 
typedef std::map< map_location, unsigned int > reach_map
 
typedef std::multimap< map_location, overlayoverlay_map
 

Protected Member Functions

virtual void draw () override final
 Main drawing function. More...
 
virtual void pre_draw ()
 Called at the beginning of each draw cycle. More...
 
virtual void post_draw ()
 Called at the end of each draw cycle. More...
 
virtual void draw_hex_cursor (const map_location &)
 Draws the map's hex cursor. More...
 
virtual void draw_hex_overlays ()
 Draws various map overlays such as game reachmap. More...
 
virtual image::TYPE get_image_type (const map_location &loc)
 
virtual const SDL_Rect get_clip_rect ()
 Get the clipping rectangle for drawing. More...
 
void draw_fog_shroud_transition_images (const map_location &loc, image::TYPE image_type)
 Draw the appropriate fog or shroud transition images for a specific hex. More...
 
void scroll_to_xy (int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force=true)
 
const std::string & get_variant (const std::vector< std::string > &variants, const map_location &loc) const
 
virtual overlay_mapget_overlays ()=0
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 
virtual std::vector< sdl_handler * > handler_members ()
 

Static Protected Member Functions

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

Protected Attributes

const display_contextdc_
 
std::unique_ptr< halo::managerhalo_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...
 
CVideovideo_
 
std::size_t currentTeam_
 
bool dont_show_all_
 
int xpos_
 
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_
 
SDL_Rect minimap_location_
 
bool redrawMinimap_
 
bool grid_
 
int diagnostic_label_
 
double turbo_speed_
 
bool turbo_
 
const std::unique_ptr< map_labelsmap_labels_
 
events::generic_event scroll_event_
 Event raised when the map is being scrolled. More...
 
events::generic_event complete_redraw_event_
 notify observers that the screen has been redrawn completely atm this is used for replay_controller to add replay controls to the standard theme More...
 
boost::circular_buffer< unsigned > frametimes_
 
unsigned int fps_counter_
 
std::chrono::seconds fps_start_
 
unsigned int fps_actual_
 
uint32_t last_frame_finished_ = 0u
 
surface mouseover_hex_overlay_
 
surface tod_hex_mask1
 
surface tod_hex_mask2
 
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_
 
bool map_screenshot_
 Used to indicate to drawing functions that we are doing a map screenshot. More...
 
reach_map reach_map_
 

Static Protected Attributes

static unsigned int zoom_ = DefaultZoom
 
static unsigned int last_zoom_ = SmallZoom
 
static displaysingleton_ = nullptr
 

Private Types

enum  TERRAIN_TYPE { FOREGROUND, BACKGROUND }
 
typedef std::list< arrow * > arrows_list_t
 
typedef std::map< map_location, arrows_list_tarrows_map_t
 

Private Member Functions

void read (const config &cfg)
 
void draw_background ()
 Draws the background behind the gamemap. More...
 
void draw_visible_hexes (const rect_of_hexes &visible_hexes, TERRAIN_TYPE layer)
 Draws the visible map hex terrains. More...
 
void draw_gamemap ()
 Draws the gamemap itself and its various components, such as units, items, fog/shroud, etc. More...
 

Private Attributes

int blindfold_ctr_
 
std::vector< animated< image::locator > > flags_
 Animated flags for each team. More...
 
int fps_handle_
 Handle for the label which displays frames per second. More...
 
int drawn_hexes_
 Count work done for the debug info displayed under fps. More...
 
bool idle_anim_
 
double idle_anim_rate_
 
bool draw_coordinates_
 Debug flag - overlay x,y coords on tiles. More...
 
bool draw_terrain_codes_
 Debug flag - overlay terrain codes on tiles. More...
 
bool draw_num_of_bitmaps_
 Debug flag - overlay number of bitmaps on tiles. More...
 
arrows_map_t arrows_map_
 Maps the list of arrows for each location. More...
 
tod_color color_adjust_
 

Detailed Description

Definition at line 83 of file display.hpp.

Member Typedef Documentation

◆ arrows_list_t

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

Definition at line 956 of file display.hpp.

◆ arrows_map_t

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

Definition at line 957 of file display.hpp.

◆ exclusive_unit_draw_requests_t

using display::exclusive_unit_draw_requests_t = std::map<map_location, std::string>
protected

Definition at line 851 of file display.hpp.

◆ overlay_map

typedef std::multimap<map_location, overlay> display::overlay_map
protected

Definition at line 934 of file display.hpp.

◆ reach_map

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

Definition at line 931 of file display.hpp.

Member Enumeration Documentation

◆ SCROLL_TYPE

Enumerator
SCROLL 
WARP 
ONSCREEN 
ONSCREEN_WARP 

Definition at line 553 of file display.hpp.

◆ TERRAIN_TYPE

enum display::TERRAIN_TYPE
private
Enumerator
FOREGROUND 
BACKGROUND 

Definition at line 732 of file display.hpp.

Constructor & Destructor Documentation

◆ display()

display::display ( const display_context dc,
std::weak_ptr< wb::manager wb,
const config theme_cfg,
const config level,
bool  auto_join = true 
)

◆ ~display()

display::~display ( )
virtual

Definition at line 167 of file display.cpp.

References resources::fake_units, and singleton_.

Member Function Documentation

◆ add_arrow()

void display::add_arrow ( arrow arrow)

Definition at line 1458 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 315 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 
)

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 277 of file display.cpp.

References get_location_x(), get_location_y(), get_overlays(), halo_man_, and hex_size().

Referenced by editor::mouse_action_item::click_left().

◆ 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 354 of file display.cpp.

References color_adjust_, and update_tod().

◆ 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 421 of file display.cpp.

References blindfold_ctr_.

◆ bounds_check_position() [1/2]

void display::bounds_check_position ( )

Definition at line 1362 of file display.cpp.

References utils::clamp(), MaxZoom, MinZoom, image::set_zoom(), xpos_, ypos_, and zoom_.

Referenced by 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 405 of file display.cpp.

References builder_, dc_, and get_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 152 of file display.hpp.

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

◆ clear_mouseover_hex_overlay()

void display::clear_mouseover_hex_overlay ( )
inline

Definition at line 462 of file display.hpp.

Referenced by editor::editor_toolkit::clear_mouseover_overlay().

◆ complete_redraw_event()

events::generic_event& display::complete_redraw_event ( )
inline

Definition at line 604 of file display.hpp.

◆ current_display_context()

const display_context& display::current_display_context ( ) 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 254 of file display.hpp.

References map_location::null_location().

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

◆ draw()

void display::draw ( )
finaloverrideprotectedvirtual

Main drawing function.

This handles drawing everything in this class and is called each draw cycle. It also calls the various protected virtual functions declared below to allow specialized behavior in derived classes.

Inherited from events::sdl_handler.

Reimplemented from events::sdl_handler.

Definition at line 1927 of file display.cpp.

Referenced by screenshot().

◆ draw_background()

void display::draw_background ( )
private

◆ draw_debugging_aids()

void display::draw_debugging_aids ( )

◆ draw_fog_shroud_transition_images()

void display::draw_fog_shroud_transition_images ( const map_location loc,
image::TYPE  image_type 
)
protected

Draw the appropriate fog or shroud transition images for a specific hex.

Definition at line 717 of file display.cpp.

References image::exists(), game_config::fog_prefix, fogged(), get_adjacent_tiles(), get_direction(), image::get_texture(), i, names, render_scaled_to_zoom(), game_config::shroud_prefix, shrouded(), and editor::start().

◆ draw_gamemap()

void display::draw_gamemap ( )
private

Draws the gamemap itself and its various components, such as units, items, fog/shroud, etc.

Definition at line 1677 of file display.cpp.

◆ draw_hex_cursor()

virtual void display::draw_hex_cursor ( const map_location )
inlineprotectedvirtual

Draws the map's hex cursor.

No action here by default.

Reimplemented in game_display, and editor::editor_display.

Definition at line 745 of file display.hpp.

◆ draw_hex_overlays()

void display::draw_hex_overlays ( )
protectedvirtual

Draws various map overlays such as game reachmap.

Reimplemented in game_display, and editor::editor_display.

Definition at line 1511 of file display.cpp.

◆ draw_text_in_hex()

int display::draw_text_in_hex ( const map_location loc,
const std::string &  text,
std::size_t  font_size,
color_t  color,
int  fl_label_id = 0,
double  x_in_hex = 0.5,
double  y_in_hex = 0.5 
)

Adds a floating label with the specified text at the given location.

Parameters
locThe map location to draw the label.
textThe label's text.
font_sizeThe label's font size. Will be adjusted by the zoom factor.
colorThe label's color.
fl_label_idThe label's existing id. If not 0 the given label will be moved as the label with that id will be moved to loc.
x_in_hexThe relative x location within the hex to draw the label.
y_in_hexThe relative y location within the hex to draw the label. Note that (0.5, 0.5) indicates the center of the hex.
Returns
The new floating label's id.

Definition at line 878 of file display.cpp.

References font::add_floating_label(), font::ANCHOR_LABEL_MAP, font::CENTER_ALIGN, get_location_x(), get_location_y(), get_zoom_factor(), hex_size(), font::remove_floating_label(), font::floating_label::set_alignment(), font::floating_label::set_color(), font::floating_label::set_font_size(), font::floating_label::set_position(), and font::floating_label::set_scroll_mode().

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

◆ draw_visible_hexes()

void display::draw_visible_hexes ( const rect_of_hexes visible_hexes,
TERRAIN_TYPE  layer 
)
private

◆ fill_images_list()

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

Definition at line 360 of file display.cpp.

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

Referenced by display().

◆ fogged()

bool display::fogged ( const map_location loc) const

◆ get_builder()

terrain_builder& display::get_builder ( )
inline

Definition at line 477 of file display.hpp.

References wfl::msg().

◆ get_clip_rect()

const SDL_Rect display::get_clip_rect ( )
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 1417 of file display.cpp.

References map_area().

◆ get_draw_coordinates()

bool display::get_draw_coordinates ( ) const
inline

Getter for the x,y debug overlay on tiles.

Definition at line 401 of file display.hpp.

◆ get_draw_num_of_bitmaps()

bool display::get_draw_num_of_bitmaps ( ) const
inline

Getter for the number of bitmaps debug overlay on tiles.

Definition at line 425 of file display.hpp.

◆ get_draw_terrain_codes()

bool display::get_draw_terrain_codes ( ) const
inline

Getter for the terrain code debug overlay on tiles.

Definition at line 413 of file display.hpp.

Referenced by editor::terrain_palette::draw_item().

◆ get_halo_manager()

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

Definition at line 214 of file display.hpp.

References b, and g.

◆ get_image_type()

image::TYPE display::get_image_type ( const map_location loc)
protectedvirtual
Returns
the image type to be used for the passed hex

Reimplemented in editor::editor_display.

Definition at line 1422 of file display.cpp.

References image::TOD_COLORED.

◆ get_loc_drawing_origin()

SDL_Point display::get_loc_drawing_origin ( const map_location loc) const

Wrapper to return the drawing origin for the specified location in screen coordinates.

Combines get_location_x and get_location_y.

Parameters
locThe map location to look up.

Definition at line 631 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

Definition at line 1483 of file display.cpp.

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

Referenced by write().

◆ get_overlays()

virtual overlay_map& display::get_overlays ( )
protectedpure virtual

◆ get_singleton()

static display* display::get_singleton ( )
inlinestatic

Returns the display object if a display object exists.

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

Definition at line 99 of file display.hpp.

Referenced by unit::ability_active(), unit_animator::add_animation(), calculate_healing(), wb::move::calculate_moves_left(), battle_context::choose_defender_weapon(), wb::manager::create_temp_move(), quit_confirmation::default_prompt(), ai::readonly_context_impl::diagnostic(), do_replay(), do_replay_handle(), terrain_label::draw(), wb::recall::draw_hex(), wb::recruit::draw_hex(), arrow::draw_hex(), wb::move::draw_hex(), wb::draw_numbers(), unit::get_abilities(), unit::get_ability_bool(), unit_frame::get_overlaped_hex(), terrain_label::get_rect(), unit::has_ability_type(), terrain_label::hidden(), arrow::hide(), wb::highlighter::highlight(), intf_get_viewing_side(), actions::shroud_clearer::invalidate_after_clear(), unit::is_visible_to_team(), gui2::dialogs::label_settings::label_settings(), help::load_terrain_types_data(), pathfind::mark_route(), arrow::notify_arrow_changed(), wb::manager::on_gamestate_change(), actions::place_recruit(), unit_creator::post_create(), turn_info::process_network_data(), unit_frame::redraw(), unit_animation_component::refresh(), wb::attack::remove_temp_modifier(), image::render_minimap(), unit_animator::replace_anim_if_invalid(), REPORT_GENERATOR(), unit_display::reset_helpers(), wb::manager::save_recall(), wb::manager::save_recruit(), unit_animation_component::set_disabled_ghosted(), unit_animation_component::set_ghosted(), preferences::set_grid(), preferences::set_idle_anim(), preferences::set_idle_anim_rate(), unit_animation_component::set_idling(), unit_animation_component::set_selecting(), preferences::set_show_standing_animations(), unit_animation_component::set_standing(), preferences::set_turbo(), preferences::set_turbo_speed(), arrow::show(), ai::default_recruitment::recruitment::show_important_hexes(), preferences::show_theme_dialog(), attack_type::special_active(), unit_animation_component::start_animation(), hotkey::command_executor::surrender_game(), SYNCED_COMMAND_HANDLER_FUNCTION(), 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(), pathfind::vision_path::vision_path(), 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::manager::~manager().

◆ get_teams()

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

Definition at line 114 of file display.hpp.

Referenced by fogged(), init_flags(), set_playing_team(), set_team(), shrouded(), and team_valid().

◆ 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 game_display, and editor::editor_display.

Definition at line 337 of file display.cpp.

Referenced by draw_visible_hexes(), 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 
) const
protected

Definition at line 389 of file display.cpp.

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

◆ get_visible_hexes()

const rect_of_hexes display::get_visible_hexes ( ) const

Returns the rectangular area of visible hexes.

Definition at line 601 of file display.cpp.

References hexes_under_rect(), and map_area().

Referenced by game_display::draw_hex_overlays(), and invalidate_animations().

◆ get_zoom_factor()

double display::get_zoom_factor ( ) const
inline

◆ handle_event()

void display::handle_event ( const SDL_Event &  )
overridevirtual

Implements events::sdl_handler.

Definition at line 1973 of file display.cpp.

References gui2::dialogs::loading_screen::displaying(), and singleton_.

◆ handle_window_event()

void display::handle_window_event ( const SDL_Event &  event)
overridevirtual

Implements events::sdl_handler.

Definition at line 1960 of file display.cpp.

◆ has_time_area()

virtual bool display::has_time_area ( ) const
inlinevirtual

Reimplemented in game_display.

Definition at line 663 of file display.hpp.

References game_config::images::flag, read(), and write().

◆ 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 490 of file display.cpp.

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

Referenced by soundsource::positional_source::calculate_volume(), editor::mouse_action_map_label::click_left(), editor::mouse_action_unit::click_left(), editor::mouse_action_item::click_left(), 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::brush_drag_mouse_action::click_right(), editor::mouse_action_paint::click_right(), editor::mouse_action_fill::click_right(), editor::mouse_action_unit::drag_end_left(), editor::mouse_action_item::drag_end_left(), editor::brush_drag_mouse_action::drag_generic(), editor::mouse_action_map_label::drag_left(), editor::mouse_action_unit::drag_left(), editor::mouse_action_item::drag_left(), events::mouse_handler::hovered_hex(), events::mouse_handler_base::init_dragging(), editor::editor_controller::left_click(), events::mouse_handler::mouse_motion(), editor::editor_controller::mouse_motion(), events::mouse_handler_base::mouse_press(), editor::editor_controller::right_click(), editor::mouse_action_village::up_left(), editor::mouse_action_map_label::up_left(), editor::mouse_action_item::up_left(), editor::mouse_action_unit::up_left(), editor::mouse_action_starting_position::up_left(), editor::mouse_action_map_label::up_right(), editor::mouse_action_village::up_right(), editor::mouse_action_starting_position::up_right(), and editor::editor_toolkit::update_mouse_action_highlights().

◆ hex_size()

static int display::hex_size ( )
inlinestatic

◆ 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 312 of file display.hpp.

Referenced by bounds_check_position(), 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 rect_of_hexes display::hexes_under_rect ( const SDL_Rect &  r) const

Return the rectangular area of hexes overlapped by r (r is in screen coordinates)

Definition at line 557 of file display.cpp.

References theme::border(), rect_of_hexes::bottom, hex_size(), hex_width(), rect_of_hexes::left, map_area(), rect_of_hexes::right, theme::border_t::size, theme_, game_config::tile_size, rect_of_hexes::top, xpos_, and ypos_.

Referenced by unit_frame::get_overlaped_hex(), and get_visible_hexes().

◆ highlight_hex()

void display::highlight_hex ( map_location  hex)
virtual

Reimplemented in game_display.

Definition at line 916 of file display.cpp.

References mouseoverHex_.

Referenced by game_display::highlight_hex(), and editor::editor_controller::mouse_motion().

◆ idle_anim()

bool display::idle_anim ( ) const
inline

◆ idle_anim_rate()

double display::idle_anim_rate ( ) const
inline

◆ in_editor()

virtual bool display::in_editor ( ) const
inlinevirtual

Reimplemented in editor::editor_display.

Definition at line 247 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 242 of file display.hpp.

◆ init_flags() [1/2]

void display::init_flags ( )

Initialize the flag list for all sides.

Definition at line 178 of file display.cpp.

References dc_, flags_, get_teams(), i, and utf8::size().

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

◆ init_flags() [2/2]

void display::init_flags ( std::size_t  side_index)

◆ invalidate_animations()

void display::invalidate_animations ( )

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

Definition at line 1427 of file display.cpp.

References preferences::animate_map(), animate_map_, builder_, fake_unit_man_, get_units(), get_visible_hexes(), new_animation_frame(), and shrouded().

◆ is_blindfolded()

bool display::is_blindfolded ( ) const

Definition at line 430 of file display.cpp.

References blindfold_ctr_.

Referenced by fogged(), image::render_minimap(), and shrouded().

◆ labels() [1/2]

map_labels & display::labels ( )

◆ labels() [2/2]

const map_labels & display::labels ( ) const

Definition at line 1412 of file display.cpp.

References map_labels_.

◆ map_area()

const SDL_Rect & display::map_area ( ) const

◆ map_outside_area()

const SDL_Rect display::map_outside_area ( ) const

◆ max_map_area()

const SDL_Rect & display::max_map_area ( ) const

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

Definition at line 435 of file display.cpp.

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

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

◆ minimap_area()

const SDL_Rect& display::minimap_area ( ) const
inline

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 276 of file display.hpp.

Referenced by minimap_location_on().

◆ 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 639 of file display.cpp.

References utils::clamp(), get_map(), gamemap::h(), h, hex_size(), hex_width(), minimap_area(), minimap_location_, pixel_position_to_hex(), sdl::point_in_rect(), gamemap::w(), w, map_location::x, and map_location::y.

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

◆ 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 265 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 482 of file display.cpp.

References hex_size().

Referenced by scroll_to_tiles(), and tile_fully_on_screen().

◆ palette_area()

const SDL_Rect& display::palette_area ( ) const
inline

◆ 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 504 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

In this case give an obviously wrong answer to fail fast, since this could actually cause a big bug.

Reimplemented in game_display.

Definition at line 260 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 120 of file display.hpp.

Referenced by editor::mouse_action_village::up_left(), and play_controller::hotkey_handler::viewing_team_is_playing().

◆ post_draw()

virtual void display::post_draw ( )
inlineprotectedvirtual

Called at the end of each draw cycle.

Derived classes can use this to add extra actions after all drawing takes place. No action here by default.

Reimplemented in game_display.

Definition at line 727 of file display.hpp.

◆ pre_draw()

virtual void display::pre_draw ( )
inlineprotectedvirtual

Called at the beginning of each draw cycle.

Derived classes can use this to add extra actions before any drawing takes place. No action here by default.

Reimplemented in game_display, and editor::editor_display.

Definition at line 718 of file display.hpp.

◆ read()

void display::read ( const config cfg)
private

Definition at line 1499 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 395 of file display.cpp.

References builder_.

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

◆ recalculate_minimap()

void display::recalculate_minimap ( )
inline

◆ redraw_minimap()

void display::redraw_minimap ( )
inline

Schedule the minimap to be redrawn.

Useful if units have moved about on the map.

Definition at line 656 of file display.hpp.

References map_location::null_location().

Referenced by battle_context::choose_defender_weapon(), actions::place_recruit(), actions::undo_list::redo(), SYNCED_COMMAND_HANDLER_FUNCTION(), actions::undo_list::undo(), and replay_controller::update_gui().

◆ 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 400 of file display.cpp.

References builder_.

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

◆ remove_arrow()

void display::remove_arrow ( arrow arrow)

Definition at line 1465 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 325 of file display.cpp.

References exclusive_unit_draw_requests_, 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 294 of file display.cpp.

References get_overlays().

◆ 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 299 of file display.cpp.

References get_overlays(), overlay::halo, overlay::id, and overlay::image.

◆ render_scaled_to_zoom() [1/2]

template<typename... T>
void display::render_scaled_to_zoom ( const texture tex,
const int  x_pos,
const int  y_pos,
T &&...  extra_args 
) const
inline

Renders a texture directly to the screen (or current rendering target) scaled to the current zoom factor.

Parameters
texThe texture to render.
x_posThe x coordinate to render at.
y_posThe y coordinate to render at.
extra_argsAny additional arguments to pass to CVideo::render_copy. This should not contain the texture or source/destination rects.

Definition at line 766 of file display.hpp.

References texture::get_info(), texture::info::h, lg::info(), texture::null(), and texture::info::w.

Referenced by draw_fog_shroud_transition_images(), game_display::draw_footstep_images(), arrow::draw_hex(), editor::editor_display::draw_hex_cursor(), game_display::draw_hex_cursor(), editor::editor_display::draw_hex_overlays(), game_display::draw_hex_overlays(), game_display::draw_movement_info(), unit_frame::redraw(), unit_drawer::redraw_unit(), and halo::halo_impl::effect::render().

◆ render_scaled_to_zoom() [2/2]

template<typename... T>
void display::render_scaled_to_zoom ( const texture tex,
const map_location loc,
T &&...  extra_args 
) const
inline

Renders a texture directly to the screen (or current rendering target) scaled to the current zoom factor.

Parameters
texThe texture to render.
locThe map location to render at.
extra_argsAny additional arguments to pass to CVideo::render_copy. This should not contain the texture or source/destination rects.

Definition at line 797 of file display.hpp.

References texture::null().

◆ reset_halo_manager() [1/2]

void display::reset_halo_manager ( )

Definition at line 411 of file display.cpp.

References halo_man_.

◆ reset_halo_manager() [2/2]

void display::reset_halo_manager ( halo::manager hm)

Definition at line 416 of file display.cpp.

References halo_man_.

◆ reset_standing_animations()

void display::reset_standing_animations ( )

Definition at line 1451 of file display.cpp.

References get_units().

◆ screenshot()

surface display::screenshot ( bool  map_screenshot = false)

Capture a (map-)screenshot into a surface.

Definition at line 662 of file display.cpp.

References create_neutral_surface(), DBG_DP, draw(), ERR_DP, get_map(), CVideo::get_renderer(), map_screenshot_, max_map_area(), video_, xpos_, and ypos_.

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

◆ scroll()

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

Scrolls the display by xmov,ymov pixels.

Invalidation and redrawing will be scheduled.

Returns
true if the map actually moved.

Definition at line 955 of file display.cpp.

References bounds_check_position(), labels(), events::generic_event::notify_observers(), map_labels::recalculate_shroud(), redrawMinimap_, scroll_event_, font::scroll_floating_labels(), view_locked_, xpos_, and ypos_.

Referenced by controller_base::handle_scroll(), events::mouse_handler_base::mouse_wheel(), and scroll_to_xy().

◆ scroll_event()

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

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

Definition at line 599 of file display.hpp.

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 ( 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 1210 of file display.cpp.

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

◆ 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 1223 of file display.cpp.

References utils::clamp(), 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 ( 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 588 of file display.hpp.

◆ 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

◆ selected_hex()

const map_location& display::selected_hex ( ) const
inline

Definition at line 353 of file display.hpp.

Referenced by get_selected_unit().

◆ set_default_zoom()

void display::set_default_zoom ( )

Sets the zoom amount to the default.

Definition at line 1079 of file display.cpp.

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

◆ set_diagnostic()

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

◆ set_draw_coordinates()

void display::set_draw_coordinates ( bool  value)
inline

Setter for the x,y debug overlay on tiles.

Definition at line 407 of file display.hpp.

Referenced by editor::editor_controller::do_execute_command(), and editor::editor_controller::init_gui().

◆ set_draw_num_of_bitmaps()

void display::set_draw_num_of_bitmaps ( bool  value)
inline

Setter for the terrain code debug overlay on tiles.

Definition at line 431 of file display.hpp.

Referenced by editor::editor_controller::do_execute_command(), and editor::editor_controller::init_gui().

◆ set_draw_terrain_codes()

void display::set_draw_terrain_codes ( bool  value)
inline

Setter for the terrain code debug overlay on tiles.

Definition at line 419 of file display.hpp.

Referenced by editor::editor_controller::do_execute_command(), and editor::editor_controller::init_gui().

◆ set_grid()

void display::set_grid ( const bool  grid)
inline

Determines whether a grid should be overlayed on the game board.

(to more clearly show where hexes are)

Definition at line 395 of file display.hpp.

References preferences::grid().

Referenced by preferences::set_grid().

◆ set_idle_anim()

void display::set_idle_anim ( bool  ison)
inline

control unit idle animations and their frequency

Definition at line 504 of file display.hpp.

Referenced by preferences::set_idle_anim().

◆ set_idle_anim_rate()

void display::set_idle_anim_rate ( int  rate)

Definition at line 1402 of file display.cpp.

References idle_anim_rate_.

Referenced by display(), and preferences::set_idle_anim_rate().

◆ set_mouseover_hex_overlay()

void display::set_mouseover_hex_overlay ( const surface image)
inline

◆ 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 271 of file display.cpp.

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

◆ 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 251 of file display.cpp.

References currentTeam_, dont_show_all_, get_teams(), labels(), map_labels::recalculate_labels(), map_labels::set_team(), utf8::size(), w, and wb_.

Referenced by turn_info::process_network_data().

◆ set_theme()

void display::set_theme ( config  theme_cfg)

Definition at line 173 of file display.cpp.

References CVideo::screen_area(), preferences::theme(), theme_, and video_.

Referenced by preferences::show_theme_dialog().

◆ set_turbo()

void display::set_turbo ( const bool  turbo)
inline

Set/Get whether 'turbo' mode is on.

When turbo mode is on, everything moves much faster.

Definition at line 491 of file display.hpp.

References preferences::turbo(), and preferences::turbo_speed().

Referenced by preferences::set_turbo().

◆ set_turbo_speed()

void display::set_turbo_speed ( const double  speed)
inline

Definition at line 498 of file display.hpp.

Referenced by preferences::set_turbo_speed().

◆ 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 548 of file display.hpp.

◆ set_zoom() [1/2]

bool display::set_zoom ( bool  increase)

Zooms the display in (true) or out (false).

Definition at line 1013 of file display.cpp.

References utils::clamp(), final_zoom_index, zoom_index_, and zoom_levels.

Referenced by set_default_zoom().

◆ 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

Definition at line 104 of file display.hpp.

Referenced by get_selected_unit(), and get_visible_unit().

◆ 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 1091 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 1098 of file display.cpp.

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

Referenced by unit_animation_component::refresh().

◆ toggle_benchmark()

void display::toggle_benchmark ( )
static

Toggle to continuously redraw the screen.

Definition at line 799 of file display.cpp.

◆ toggle_debug_foreground()

void display::toggle_debug_foreground ( )
static

Toggle to debug foreground terrain.

Separate background and foreground layer to better spot any error there.

Definition at line 804 of file display.cpp.

◆ turbo_speed()

double display::turbo_speed ( ) const

◆ unit_image_area()

const SDL_Rect& display::unit_image_area ( ) const
inline

Definition at line 286 of file display.hpp.

◆ 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 1472 of file display.cpp.

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

◆ 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 343 of file display.cpp.

References tod_color::b, time_of_day::color, color_adjust_, tod_color::g, get_time_of_day(), 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().

◆ video()

CVideo& display::video ( )
inline

◆ view_locked()

bool display::view_locked ( ) const
inline

Definition at line 542 of file display.hpp.

◆ viewing_side()

int display::viewing_side ( ) const
inline

◆ viewing_team()

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

◆ write()

void display::write ( config cfg) const

◆ zoom_at_max()

bool display::zoom_at_max ( )
static

Definition at line 1003 of file display.cpp.

References MaxZoom, and zoom_.

◆ zoom_at_min()

bool display::zoom_at_min ( )
static

Definition at line 1008 of file display.cpp.

References MinZoom, and zoom_.

Member Data Documentation

◆ activeTeam_

std::size_t display::activeTeam_
protected

Definition at line 916 of file display.hpp.

Referenced by set_playing_team().

◆ animate_map_

bool display::animate_map_
protected

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

Definition at line 905 of file display.hpp.

Referenced by 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 908 of file display.hpp.

◆ arrows_map_

arrows_map_t display::arrows_map_
private

Maps the list of arrows for each location.

Definition at line 959 of file display.hpp.

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

◆ blindfold_ctr_

int display::blindfold_ctr_
private

Definition at line 688 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

Definition at line 961 of file display.hpp.

Referenced by adjust_color_overlay(), read(), update_tod(), and write().

◆ complete_redraw_event_

events::generic_event display::complete_redraw_event_
protected

notify observers that the screen has been redrawn completely atm this is used for replay_controller to add replay controls to the standard theme

Definition at line 884 of file display.hpp.

◆ currentTeam_

std::size_t display::currentTeam_
protected

◆ dc_

const display_context* display::dc_
protected

◆ diagnostic_label_

int display::diagnostic_label_
protected

Definition at line 872 of file display.hpp.

Referenced by set_diagnostic().

◆ dont_show_all_

bool display::dont_show_all_
protected

◆ draw_coordinates_

bool display::draw_coordinates_
private

Debug flag - overlay x,y coords on tiles.

Definition at line 948 of file display.hpp.

◆ draw_num_of_bitmaps_

bool display::draw_num_of_bitmaps_
private

Debug flag - overlay number of bitmaps on tiles.

Definition at line 954 of file display.hpp.

◆ draw_terrain_codes_

bool display::draw_terrain_codes_
private

Debug flag - overlay terrain codes on tiles.

Definition at line 951 of file display.hpp.

◆ drawn_hexes_

int display::drawn_hexes_
private

Count work done for the debug info displayed under fps.

Definition at line 942 of file display.hpp.

Referenced by draw_debugging_aids(), and draw_visible_hexes().

◆ 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 854 of file display.hpp.

Referenced by add_exclusive_draw(), and remove_exclusive_draw().

◆ fake_unit_man_

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

Definition at line 867 of file display.hpp.

Referenced by display(), and invalidate_animations().

◆ flags_

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

Animated flags for each team.

Definition at line 912 of file display.hpp.

Referenced by init_flags().

◆ fog_images_

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

Definition at line 897 of file display.hpp.

Referenced by display().

◆ fps_actual_

unsigned int display::fps_actual_
protected

Definition at line 889 of file display.hpp.

Referenced by draw_debugging_aids().

◆ fps_counter_

unsigned int display::fps_counter_
protected

Definition at line 887 of file display.hpp.

◆ fps_handle_

int display::fps_handle_
private

Handle for the label which displays frames per second.

Definition at line 940 of file display.hpp.

Referenced by draw_debugging_aids().

◆ fps_start_

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

Definition at line 888 of file display.hpp.

◆ frametimes_

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

Definition at line 886 of file display.hpp.

Referenced by draw_debugging_aids().

◆ grid_

bool display::grid_
protected

Definition at line 871 of file display.hpp.

◆ halo_man_

std::unique_ptr<halo::manager> display::halo_man_
protected

Definition at line 694 of file display.hpp.

Referenced by add_overlay(), game_display::draw_hex_overlays(), and reset_halo_manager().

◆ idle_anim_

bool display::idle_anim_
private

Definition at line 944 of file display.hpp.

◆ idle_anim_rate_

double display::idle_anim_rate_
private

Definition at line 945 of file display.hpp.

Referenced by set_idle_anim_rate().

◆ keys_

CKey display::keys_
protected

Definition at line 902 of file display.hpp.

Referenced by turbo_speed().

◆ last_frame_finished_

uint32_t display::last_frame_finished_ = 0u
protected

Definition at line 890 of file display.hpp.

◆ last_zoom_

unsigned int display::last_zoom_ = SmallZoom
staticprotected

Definition at line 866 of file display.hpp.

Referenced by set_default_zoom(), and set_zoom().

◆ map_labels_

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

Definition at line 875 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 919 of file display.hpp.

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

◆ minimap_location_

SDL_Rect display::minimap_location_
protected

Definition at line 869 of file display.hpp.

Referenced by minimap_location_on().

◆ mouseover_hex_overlay_

surface display::mouseover_hex_overlay_
protected

Definition at line 893 of file display.hpp.

◆ mouseoverHex_

map_location display::mouseoverHex_
protected

◆ reach_map_

reach_map display::reach_map_
protected

◆ redrawMinimap_

bool display::redrawMinimap_
protected

Definition at line 870 of file display.hpp.

Referenced by scroll().

◆ scroll_event_

events::generic_event display::scroll_event_
mutableprotected

Event raised when the map is being scrolled.

Definition at line 878 of file display.hpp.

Referenced by scroll().

◆ selectedHex_

map_location display::selectedHex_
protected

◆ shroud_images_

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

Definition at line 898 of file display.hpp.

Referenced by display().

◆ singleton_

display * display::singleton_ = nullptr
staticprotected

Definition at line 964 of file display.hpp.

Referenced by display(), handle_event(), and ~display().

◆ theme_

theme display::theme_
protected

◆ tod_hex_mask1

surface display::tod_hex_mask1
protected

Definition at line 896 of file display.hpp.

Referenced by game_display::new_turn().

◆ tod_hex_mask2

surface display::tod_hex_mask2
protected

Definition at line 896 of file display.hpp.

Referenced by game_display::new_turn().

◆ turbo_

bool display::turbo_
protected

Definition at line 874 of file display.hpp.

Referenced by turbo_speed().

◆ turbo_speed_

double display::turbo_speed_
protected

Definition at line 873 of file display.hpp.

Referenced by turbo_speed().

◆ video_

CVideo& display::video_
protected

◆ view_locked_

bool display::view_locked_
protected

Definition at line 862 of file display.hpp.

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

◆ wb_

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

◆ xpos_

int display::xpos_
protected

◆ ypos_

int display::ypos_
protected

◆ zoom_

unsigned int display::zoom_ = DefaultZoom
staticprotected

◆ zoom_index_

int display::zoom_index_
protected

Definition at line 865 of file display.hpp.

Referenced by display(), and set_zoom().


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