Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data. More...
#include <display.hpp>
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 | 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 |
std::size_t | playing_team_index () const |
The playing team is the team whose turn it is. More... | |
std::size_t | viewing_team_index () const |
The viewing team is the team currently viewing the game. More... | |
const team & | playing_team () const |
const team & | viewing_team () const |
bool | viewing_team_is_playing () const |
void | set_viewing_team_index (std::size_t team, bool observe=false) |
Sets the team controlled by the player using the computer. More... | |
void | set_playing_team_index (std::size_t team) |
sets the team whose turn it currently is More... | |
void | clear_exclusive_draws () |
Cancels all the exclusive draw requests. More... | |
bool | add_exclusive_draw (const map_location &loc, const 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... | |
bool | unit_can_draw_here (const map_location &loc, const unit &unit) const |
Returns true if there is no exclusive draw request for loc, or if there is, that it's for unit. More... | |
void | add_overlay (const map_location &loc, overlay &&ov) |
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_context & | context () const |
halo::manager & | get_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_location & | displayed_unit_hex () const |
Virtual functions shadowed in game_display. More... | |
virtual const std::set< std::string > & | observers () const |
const rect & | minimap_area () const |
mapx is the width of the portion of the display which shows the game area. More... | |
const rect & | palette_area () const |
const rect & | unit_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... | |
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... | |
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_location & | selected_hex () const |
const map_location & | mouseover_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... | |
point | get_location (const map_location &loc) const |
Functions to get the on-screen positions of hexes. More... | |
rect | get_location_rect (const map_location &loc) const |
Returns the on-screen rect corresponding to a loc. More... | |
const rect_of_hexes | hexes_under_rect (const 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 (const 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... | |
theme & | get_theme () |
void | set_theme (const std::string &new_theme) |
std::shared_ptr< gui::button > | find_action_button (const std::string &id) |
Retrieves a pointer to a theme UI button. More... | |
std::shared_ptr< gui::button > | find_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 ®ion) |
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_builder & | get_builder () |
void | update_fps_label () |
void | clear_fps_label () |
void | update_fps_count () |
void | rebuild_all () |
Rebuild all dynamic terrain. More... | |
const theme::action * | action_pressed () |
const theme::menu * | menu_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 (const point &amount, bool force=false) |
Scrolls the display by amount 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 > &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_event & | scroll_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, const std::chrono::milliseconds &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 ®ion) 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_labels & | labels () |
const map_labels & | labels () 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_day & | get_time_of_day (const map_location &loc=map_location::null_location()) const =0 |
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 display * | get_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 submerge_data | get_submerge_data (const rect &dest, double submerge, const point &size, uint8_t alpha, bool hreverse, bool vreverse) |
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 | draw_overlays_at (const map_location &loc) |
void | get_terrain_images (const map_location &loc, const std::string &timeid, TERRAIN_TYPE terrain_type) |
std::vector< texture > | get_fog_shroud_images (const map_location &loc, image::TYPE image_type) |
void | scroll_to_xy (const point &screen_coordinates, 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 ®ion) |
Redraws all panels intersecting the given region. More... | |
void | process_reachmap_changes () |
virtual overlay_map & | get_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_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
Static Protected Member Functions | |
static void | fill_images_list (const std::string &prefix, std::vector< std::string > &images) |
Protected Attributes | |
const display_context * | dc_ |
halo::manager | halo_man_ |
std::weak_ptr< wb::manager > | wb_ |
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 | viewing_team_index_ |
bool | dont_show_all_ |
point | viewport_origin_ |
Position of the top-left corner of the viewport, in pixels. More... | |
bool | view_locked_ |
theme | theme_ |
int | zoom_index_ |
const std::unique_ptr< fake_unit_manager > | fake_unit_man_ |
const std::unique_ptr< terrain_builder > | builder_ |
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_labels > | map_labels_ |
reports * | reports_object_ |
events::generic_event | scroll_event_ |
Event raised when the map is being scrolled. More... | |
boost::circular_buffer< std::chrono::milliseconds > | frametimes_ |
int | current_frame_sample_ = 0 |
unsigned int | fps_counter_ |
std::chrono::steady_clock::time_point | fps_start_ |
unsigned int | fps_actual_ |
utils::optional< std::chrono::steady_clock::time_point > | last_frame_finished_ = {} |
std::map< std::string, rect > | reportLocations_ |
std::map< std::string, texture > | reportSurfaces_ |
std::map< std::string, config > | reports_ |
std::vector< std::shared_ptr< gui::button > > | menu_buttons_ |
std::vector< std::shared_ptr< gui::button > > | action_buttons_ |
std::set< map_location > | invalidated_ |
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 prefs::get().animate_map, since it is constantly queried. More... | |
bool | animate_water_ |
Local version of prefs::get().animate_water, used to detect when it's changed. More... | |
std::size_t | playing_team_index_ |
std::list< draw_helper > | drawing_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 display * | singleton_ = nullptr |
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) |
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< texture > | terrain_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_FLAGS > | debug_flags_ |
Currently set debug flags. More... | |
std::map< map_location, std::list< arrow * > > | arrows_map_ |
Maps the list of arrows for each location. More... | |
tod_color | color_adjust_ |
std::vector< std::tuple< int, int, int > > | fps_history_ |
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition at line 96 of file display.hpp.
|
protected |
Definition at line 688 of file display.hpp.
|
protected |
Definition at line 903 of file display.hpp.
|
protected |
Definition at line 897 of file display.hpp.
enum display::DEBUG_FLAG |
Definition at line 917 of file display.hpp.
enum display::SCROLL_TYPE |
Enumerator | |
---|---|
SCROLL | |
WARP | |
ONSCREEN | |
ONSCREEN_WARP |
Definition at line 509 of file display.hpp.
|
protected |
Enumerator | |
---|---|
BACKGROUND | |
FOREGROUND |
Definition at line 715 of file display.hpp.
display::display | ( | const display_context * | dc, |
std::weak_ptr< wb::manager > | wb, | ||
reports & | reports_object, | ||
const std::string & | theme_id, | ||
const config & | level | ||
) |
Definition at line 145 of file display.cpp.
References action_buttons_, blindfold_ctr_, create_buttons(), DefaultZoom, fake_unit_man_, resources::fake_units, fill_images_list(), fog_images_, game_config::fog_prefix, prefs::get(), get_zoom_levels_index(), init_flags(), game_config::images::level, MaxZoom, menu_buttons_, read(), shroud_images_, game_config::shroud_prefix, singleton_, game_config::tile_size, zoom_, zoom_index_, and zoom_levels.
|
virtual |
Definition at line 238 of file display.cpp.
References resources::fake_units, and singleton_.
const theme::action * display::action_pressed | ( | ) |
Definition at line 1528 of file display.cpp.
References action_buttons_, theme::actions(), i, utf8::index(), and theme_.
Referenced by controller_base::play_slice().
void display::add_arrow | ( | arrow & | arrow | ) |
Definition at line 3211 of file display.cpp.
References arrows_map_, arrow::get_path(), and loc.
bool display::add_exclusive_draw | ( | const map_location & | loc, |
const 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.
loc | The location of the unit requesting exclusivity. |
unit | The unit requesting exclusivity. |
Definition at line 371 of file display.cpp.
References exclusive_unit_draw_requests_, unit::id(), loc, 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().
void display::add_overlay | ( | const map_location & | loc, |
overlay && | ov | ||
) |
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 121 of file display.cpp.
References loc.
Referenced by editor::mouse_action_item::click_left(), and game_lua_kernel::intf_add_tile_overlay().
void display::add_redraw_observer | ( | const std::function< void(display &)> & | f | ) |
Adds a redraw observer, a function object to be called when a full rerender is queued.
Definition at line 2320 of file display.cpp.
References f, and redraw_observers_.
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 405 of file display.cpp.
References b, color_adjust_, g, and update_tod().
Referenced by game_lua_kernel::intf_color_adjust().
void display::announce | ( | const std::string & | msg, |
const color_t & | color = font::GOOD_COLOR , |
||
const announce_options & | options = announce_options() |
||
) |
Announce a message prominently.
Definition at line 1560 of file display.cpp.
References font::add_floating_label(), display::announce_options::discard_previous, h, display::announce_options::lifetime, map_outside_area(), font::remove_floating_label(), font::floating_label::set_clip_rect(), font::floating_label::set_color(), font::floating_label::set_font_size(), font::floating_label::set_lifetime(), font::floating_label::set_position(), font::SIZE_FLOAT_LABEL, and w.
void display::blindfold | ( | bool | flag | ) |
Definition at line 450 of file display.cpp.
References blindfold_ctr_.
Referenced by blindfold::blindfold(), and blindfold::unblind().
void display::bounds_check_position | ( | ) |
Definition at line 2107 of file display.cpp.
References MaxZoom, MinZoom, viewport_origin_, and zoom_.
Referenced by queue_rerender(), scroll(), scroll_to_xy(), and set_zoom().
void display::bounds_check_position | ( | int & | xpos, |
int & | ypos | ||
) | const |
Definition at line 2113 of file display.cpp.
References theme::border(), context(), gamemap_base::h(), h, hex_width(), display_context::map(), map_area(), theme::border_t::size, theme_, w, gamemap_base::w(), and zoom_.
void display::change_display_context | ( | const display_context * | dc | ) |
Definition at line 444 of file display.cpp.
References builder_, context(), and dc_.
Referenced by editor::context_manager::refresh_on_context_change().
|
inline |
Cancels all the exclusive draw requests.
Definition at line 150 of file display.hpp.
References exclusive_unit_draw_requests_.
Referenced by wb::manager::on_gamestate_change().
void display::clear_fps_label | ( | ) |
Definition at line 1368 of file display.cpp.
References drawn_hexes_, fps_handle_, invalidated_hexes_, last_frame_finished_, and font::remove_floating_label().
Referenced by draw().
void display::clear_redraw_observers | ( | ) |
Clear the redraw observers.
Definition at line 2325 of file display.cpp.
References redraw_observers_.
|
inline |
Definition at line 193 of file display.hpp.
References dc_.
Referenced by display_chat_manager::add_chat_message(), bounds_check_position(), change_display_context(), editor::mouse_action_unit::click_left(), game_display::display_unit_hex(), editor::mouse_action_unit::drag_end_left(), draw(), draw_hex(), game_display::draw_hex(), draw_invalidated(), draw_minimap(), draw_minimap_units(), game_display::draw_movement_info(), draw_overlays_at(), get_flag(), editor::editor_display::get_map(), terrain_label::hidden(), game_display::highlight_hex(), init_flags(), unit_animation_component::invalidate(), invalidate_animations(), invalidate_animations_location(), layout(), editor::editor_display::layout(), game_display::layout(), unit_animation::matches(), max_map_area(), minimap_location_on(), editor::mouse_action_unit::move(), playing_team(), image::prep_minimap_for_rendering(), recalculate_minimap(), unit_display::reset_helpers(), reset_standing_animations(), screenshot(), game_display::scroll_to_leader(), scroll_to_tile(), scroll_to_tiles(), set_playing_team_index(), set_viewing_team_index(), unit_display::unit_recruited(), terrain_label::viewable(), and viewing_team().
void display::create_buttons | ( | ) |
Definition at line 845 of file display.cpp.
References action_buttons_, theme::actions(), b, DBG_DP, gui::button::DEFAULT_SPACE, find_action_button(), find_menu_button(), video::headless(), hide_buttons(), layout_buttons(), menu_buttons_, theme::menus(), prevent_draw_, font::SIZE_BUTTON_SMALL, theme_, gui::button::TYPE_CHECK, and gui::button::TYPE_PRESS.
Referenced by game_display::begin_game(), display(), queue_rerender(), editor::context_manager::refresh_all(), and set_theme().
|
inline |
Definition at line 937 of file display.hpp.
References debug_flags_, and game_config::images::flag.
Referenced by draw(), draw_hex(), editor::terrain_palette::setup_item(), update(), and update_fps_label().
|
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 222 of file display.hpp.
References map_location::null_location().
Referenced by get_visible_unit(), unit_hp(), and unit_status().
|
private |
Perform rendering of invalidated items.
Definition at line 2330 of file display.cpp.
References clear_fps_label(), context(), DBG_DP, DEBUG_BENCHMARK, debug_flag_set(), draw_invalidated(), drawing_buffer_commit(), fps_handle_, prefs::get(), video::headless(), draw_manager::invalidate_region(), invalidated_, map_outside_area(), map_screenshot_, redraw_background_, render_map_outside_area(), update_fps_count(), and update_fps_label().
Referenced by render(), and screenshot().
|
protected |
Redraws all panels intersecting the given region.
Returns true if something was drawn, false otherwise.
Definition at line 1431 of file display.cpp.
References draw_label(), draw_panel(), video::game_canvas(), label, theme::labels(), rect::overlaps(), theme::panels(), and theme_.
Referenced by expose().
void display::draw_buttons | ( | ) |
Definition at line 910 of file display.cpp.
|
protectedvirtual |
Redraws a single gamemap location.
Reimplemented in game_display, and editor::editor_display.
Definition at line 2603 of file display.cpp.
References __NUM_DEBUG_FLAGS, arrows, arrows_map_, BACKGROUND, draw::blit(), context(), game_config::debug, DEBUG_COORDINATES, debug_flag_set(), debug_flags_, DEBUG_FOREGROUND, DEBUG_NUM_BITMAPS, DEBUG_TERRAIN_CODES, draw_overlays_at(), drawing_buffer_add(), draw::fill(), fog_images_, fog_shroud, fogged(), FOREGROUND, prefs::get(), get_flag(), get_fog_shroud_images(), arrow::get_image_for_loc(), gamemap_base::get_terrain(), get_terrain_images(), font::get_text_renderer(), image::get_texture(), get_time_of_day(), grid_bottom, game_config::images::grid_bottom, grid_top, game_config::images::grid_top, image::HEXED, time_of_day::id, time_of_day::image_mask, markup::img(), is_shrouded(), loc, display_context::map(), font::NORMAL_COLOR, gamemap_base::on_board(), output(), rect::padded_by(), renderer(), s, texture::set_alpha_mod(), shroud_images_, shrouded(), font::SIZE_TINY, t, terrain_bg, terrain_fg, terrain_image_vector_, image::TOD_COLORED, tod_hex_alpha1, tod_hex_alpha2, tod_hex_mask1, tod_hex_mask2, utils::trim(), unit_default, map_location::x, and map_location::y.
Referenced by editor::editor_display::draw_hex(), game_display::draw_hex(), and 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 2567 of file display.cpp.
References context(), DBG_DP, draw_hex(), drawn_hexes_, display::rect_of_hexes::end(), unit_map::find(), get_clip_rect(), get_location_rect(), rect::intersect(), draw_manager::invalidate_region(), invalidated_, invalidated_hexes_, loc, rect::overlaps(), draw::reduce_clip(), unit_can_draw_here(), and display_context::units().
Referenced by draw(), and game_display::draw_invalidated().
|
private |
Definition at line 1404 of file display.cpp.
References tooltips::add_tooltip(), draw::blit(), DBG_DP, video::game_canvas(), draw::get_clip(), image::get_texture(), label, loc, font::NORMAL_COLOR, font::pango_draw_text(), map_location::x, and map_location::y.
Referenced by draw_all_panels().
|
private |
Actually draw the minimap.
Definition at line 1602 of file display.cpp.
References border, theme::border(), context(), draw_minimap_units(), rect::empty(), draw::fill(), draw::get_clip(), gamemap_base::h(), hex_size(), hex_width(), display_context::map(), map_area(), map_outside_area(), minimap_area(), minimap_location_, minimap_renderer_, rect::overlaps(), draw::rect(), draw::reduce_clip(), theme::border_t::size, theme_, viewport_origin_, and gamemap_base::w().
Referenced by expose().
void display::draw_minimap_units | ( | ) |
Definition at line 1653 of file display.cpp.
References allied, game_config::color_info(), context(), enemy, draw::fill(), fogged(), prefs::get(), team::get_minimap_color(), orb_status_helper::get_orb_color(), gamemap_base::h(), is_blindfolded(), is_odd(), display_context::map(), minimap_location_, color_range::rep(), display_context::unit_orb_status(), viewing_team(), and gamemap_base::w().
Referenced by draw_minimap().
|
protected |
Definition at line 2763 of file display.cpp.
References tod_color::b, time_of_day::color, color_adjust_, context(), dont_show_all_, drawing_buffer_add(), display::rect_of_hexes::end(), fogged(), tod_color::g, image::get_light_string(), image::get_lighted_texture(), get_overlays(), gamemap::get_terrain_info(), image::get_texture(), get_time_of_day(), image::HEXED, loc, display_context::map(), tod_color::r, utils::split_view(), terrain_bg, terrain_type::unit_submerge(), and viewing_team().
Referenced by draw_hex().
|
private |
Definition at line 1379 of file display.cpp.
References DBG_DP, ERR_DP, video::game_canvas(), draw::get_clip(), theme::object::get_id(), image::get_texture(), theme::panel::image(), loc, theme::panel::location(), and draw::tiled().
Referenced by draw_all_panels().
void display::draw_report | ( | const std::string & | report_name, |
bool | test_run = false |
||
) |
Draw the specified report.
If test_run is true, it will simulate the draw without actually drawing anything. This will add any overflowing information to the report tooltip, and also registers the tooltip.
Definition at line 2906 of file display.cpp.
References tooltips::add_tooltip(), draw::blit(), config::child_range(), game_config::images::ellipsis, ERR_DP, theme::status_item::font_rgb(), theme::status_item::font_rgb_set(), font::FONT_SANS_SERIF, theme::status_item::font_size(), font::pango_text::get_size(), theme::get_status_item(), font::get_text_renderer(), image::get_texture(), markup::img(), loc, font::NORMAL_COLOR, font::pango_text::render_and_get_texture(), reportLocations_, reports_, font::pango_text::set_alignment(), font::pango_text::set_characters_per_line(), font::pango_text::set_ellipse_mode(), font::pango_text::set_family_class(), font::pango_text::set_font_size(), font::pango_text::set_font_style(), font::pango_text::set_foreground_color(), font::pango_text::set_link_aware(), font::pango_text::set_maximum_height(), font::pango_text::set_maximum_width(), font::pango_text::set_text(), font::pango_text::STYLE_NORMAL, t, theme_, map_location::x, and map_location::y.
Referenced by draw_reports(), and refresh_report().
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 3066 of file display.cpp.
References draw_report(), loc, reportLocations_, and reports_.
Referenced by expose().
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 1453 of file display.cpp.
References drawing_buffer_add(), font::get_text_renderer(), get_zoom_factor(), loc, and renderer().
Referenced by wb::move::draw_hex(), wb::recall::draw_hex(), wb::recruit::draw_hex(), game_display::draw_movement_info(), and wb::draw_numbers().
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.
layer | The layer to draw on. |
loc | The hex the image belongs to, needed for the drawing order. |
draw_func | The draw operation to be run. |
Definition at line 1258 of file display.cpp.
References drawing_buffer_, get_location_rect(), and loc.
Referenced by unit_drawer::draw_ellipses(), 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_overlays_at(), draw_text_in_hex(), and unit_drawer::redraw_unit().
|
protected |
Draws the drawing_buffer_ and clears it.
Definition at line 1263 of file display.cpp.
References DBG_DP, drawing_buffer_, map_area(), and draw::reduce_clip().
Referenced by draw().
|
overridevirtual |
Paint the indicated region to the screen.
Implements gui2::top_level_drawable.
Definition at line 2438 of file display.cpp.
References draw::blit(), texture::clear_src(), DBG_DP, draw_all_panels(), font::draw_floating_labels(), draw_minimap(), draw_reports(), fade_color_, draw::fill(), front_, draw::get_clip(), halo_man_, rect::intersect(), map_outside_area(), minimap_area(), rect::overlaps(), prevent_draw_, halo::manager::render(), and texture::set_src().
void display::fade_to | ( | const color_t & | color, |
const std::chrono::milliseconds & | duration | ||
) |
Screen fade.
Definition at line 2223 of file display.cpp.
References c, events::draw(), fade_color_, float_to_color(), draw_manager::invalidate_region(), map_outside_area(), p, events::pump_and_draw(), color_t::smooth_blend(), and editor::start().
Referenced by game_lua_kernel::intf_screen_fade().
void display::fade_tod_mask | ( | const std::string & | old, |
const std::string & | new_ | ||
) |
ToD mask smooth fade.
Definition at line 2200 of file display.cpp.
References float_to_color(), image::get_texture(), image::HEXED, draw_manager::invalidate_region(), map_outside_area(), p, events::pump_and_draw(), texture::reset(), editor::start(), tod_hex_alpha1, tod_hex_alpha2, tod_hex_mask1, tod_hex_mask2, and turbo_speed().
Referenced by game_display::new_turn().
|
staticprotected |
Definition at line 411 of file display.cpp.
References image::exists(), i, and s.
Referenced by display().
std::shared_ptr< gui::button > display::find_action_button | ( | const std::string & | id | ) |
Retrieves a pointer to a theme UI button.
Definition at line 770 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().
std::shared_ptr< gui::button > display::find_menu_button | ( | const std::string & | id | ) |
Definition at line 780 of file display.cpp.
References b, and menu_buttons_.
Referenced by create_buttons(), editor::location_palette::hide(), editor::empty_palette::hide(), editor::palette_manager::layout(), layout_buttons(), and hotkey::command_executor_default::set_button_state().
bool display::fogged | ( | const map_location & | loc | ) | const |
Returns true if location (x,y) is covered in fog.
Definition at line 674 of file display.cpp.
References dont_show_all_, team::fogged(), is_blindfolded(), loc, and viewing_team().
Referenced by soundsource::positional_source::calculate_volume(), draw_hex(), draw_minimap_units(), draw_overlays_at(), game_display::float_label(), get_flag(), get_fog_shroud_images(), invalidate_animations_location(), is_fogged(), unit_creator::post_create(), scroll_to_tiles(), events::mouse_handler::select_hex(), game_display::select_hex(), unit_display::unit_attack(), unit_display::unit_die(), unit_display::unit_draw_weapon(), unit_display::unit_healing(), unit_display::unit_recruited(), and unit_display::unit_sheath_weapon().
|
inline |
Definition at line 466 of file display.hpp.
References builder_.
|
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 2562 of file display.cpp.
References map_area().
Referenced by draw_invalidated().
|
inline |
Definition at line 216 of file display.hpp.
References color_adjust_.
Referenced by game_lua_kernel::intf_get_color_adjust().
|
private |
Definition at line 319 of file display.cpp.
References animate_map_, context(), game_config::images::flag, flags_, fogged(), image::get_texture(), loc, t, image::TOD_COLORED, and viewing_team().
Referenced by draw_hex().
|
protected |
Definition at line 952 of file display.cpp.
References image::exists(), game_config::fog_prefix, fogged(), get_adjacent_tiles(), display_direction::get_direction(), image::get_texture(), i, loc, names, game_config::shroud_prefix, shrouded(), and editor::start().
Referenced by draw_hex().
|
inline |
Definition at line 198 of file display.hpp.
References halo_man_.
point display::get_location | ( | const map_location & | loc | ) | const |
Functions to get the on-screen positions of hexes.
Definition at line 679 of file display.cpp.
References theme::border(), hex_width(), is_odd(), loc, map_area(), theme::border_t::size, theme_, viewport_origin_, map_location::x, map_location::y, and zoom_.
Referenced by get_location_rect(), unit_frame::get_overlaped_hex(), terrain_label::recalculate(), unit_frame::redraw(), unit_drawer::redraw_unit(), scroll_to_tiles(), and tile_nearly_on_screen().
rect display::get_location_rect | ( | const map_location & | loc | ) | const |
Returns the on-screen rect corresponding to a loc.
Definition at line 687 of file display.cpp.
References get_location(), hex_size(), and loc.
Referenced by draw_invalidated(), drawing_buffer_add(), game_display::float_label(), terrain_label::get_rect(), editor::mouse_action_unit::move(), unit_drawer::redraw_unit(), and tile_fully_on_screen().
|
protected |
Definition at line 3236 of file display.cpp.
References rect::center(), map_area(), pixel_position_to_hex(), and viewport_origin_.
Referenced by write().
|
protectedpure virtual |
Implemented in game_display, and editor::editor_display.
Referenced by draw_overlays_at().
bool display::get_prevent_draw | ( | ) |
Definition at line 2148 of file display.cpp.
References prevent_draw_.
Referenced by gui2::dialogs::story_viewer::pre_show().
|
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 111 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(), wb::move::check_validity(), actions::shroud_clearer::clear_loc(), wb::manager::create_temp_move(), quit_confirmation::default_prompt(), ai::readonly_context_impl::diagnostic(), do_replay(), do_replay_handle(), 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_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(), 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(), wb::mapbuilder::pre_build(), gui2::dialogs::story_viewer::pre_show(), image::prep_minimap_for_rendering(), 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(), prefs::set_show_standing_animations(), arrow::show(), ai::default_recruitment::recruitment::show_important_hexes(), prefs::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(), wb::manager::update_plan_hiding(), gui2::settings::update_screen_size_variables(), gui2::dialogs::custom_tod::update_tod_display(), wb::viewer_actions(), wb::viewer_side(), 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().
|
static |
dest | The original destination. |
submerge | How deep underwater it is. |
size | The size of its image. |
alpha | How transparent to make the submerged part. |
hreverse | Whether to flip the image horizontally. |
vreverse | Whether to flip the image vertically. |
Definition at line 2153 of file display.cpp.
References data, and utf8::size().
|
protected |
Definition at line 1039 of file display.cpp.
References animate_map_, tod_color::b, terrain_builder::BACKGROUND, theme::border(), builder_, time_of_day::color, color_adjust_, d, FOREGROUND, terrain_builder::FOREGROUND, tod_color::g, get_adjacent_tiles(), image::get_light_string(), image::get_lighted_texture(), image::get_texture(), get_time_of_day(), image::HEXED, tod_color::is_zero(), loc, tod_color::r, terrain_image_vector_, theme_, and theme::border_t::tile_image.
Referenced by draw_hex().
|
inline |
Definition at line 390 of file display.hpp.
References theme_.
Referenced by replay_controller::add_replay_theme(), hotkey::command_executor::get_menu_image(), hotkey::command_executor::get_menu_images(), controller_base::handle_event(), editor::editor_toolkit::init_mouse_actions(), controller_base::long_touch_callback(), replay_controller::replay_controller(), events::mouse_handler_base::right_mouse_up(), hotkey::command_executor_default::set_button_state(), and replay_controller::~replay_controller().
|
pure virtual |
Implemented in editor::editor_display, and game_display.
Referenced by draw_hex(), draw_overlays_at(), get_terrain_images(), and update_tod().
|
inline |
Returns the rectangular area of visible hexes.
Definition at line 365 of file display.hpp.
References hexes_under_rect(), and map_area().
Referenced by invalidate_animations(), editor::editor_display::layout(), and process_reachmap_changes().
|
inlinestatic |
Returns the current zoom factor.
Definition at line 270 of file display.hpp.
References game_config::tile_size, and zoom_.
Referenced by draw_text_in_hex(), halo::halo_impl::effect::effect(), game_display::float_label(), unit_frame::get_overlaped_hex(), game_lua_kernel::intf_zoom(), unit_animation_component::invalidate(), unit_frame::redraw(), unit_drawer::redraw_unit(), scale_to_map_zoom(), and scaled_to_zoom().
|
inlinevirtual |
Reimplemented in game_display.
Definition at line 658 of file display.hpp.
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 538 of file display.cpp.
References rect::contains(), map_area(), pixel_position_to_hex(), and viewport_origin_.
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::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().
|
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 267 of file display.hpp.
References zoom_.
Referenced by draw_minimap(), get_location_rect(), unit_frame::get_overlaped_hex(), terrain_label::get_rect(), hexes_under_rect(), max_map_area(), minimap_location_on(), outside_area(), pixel_position_to_hex(), unit_frame::redraw(), scroll_to_tiles(), and tile_nearly_on_screen().
|
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 261 of file display.hpp.
References zoom_.
Referenced by bounds_check_position(), draw_minimap(), get_location(), hexes_under_rect(), max_map_area(), minimap_location_on(), pixel_position_to_hex(), and tile_nearly_on_screen().
const display::rect_of_hexes display::hexes_under_rect | ( | const rect & | r | ) | const |
Return the rectangular area of hexes overlapped by r (r is in screen coordinates)
Definition at line 626 of file display.cpp.
References border, theme::border(), hex_size(), hex_width(), map_area(), rect::origin(), theme::border_t::size, theme_, game_config::tile_size, and viewport_origin_.
Referenced by unit_frame::get_overlaped_hex(), get_visible_hexes(), and invalidate_locations_in_rect().
void display::hide_buttons | ( | ) |
Hide theme buttons so they don't draw.
Definition at line 932 of file display.cpp.
References action_buttons_, and menu_buttons_.
Referenced by create_buttons().
|
virtual |
Reimplemented in game_display.
Definition at line 1484 of file display.cpp.
References invalidate(), and mouseoverHex_.
Referenced by game_display::highlight_hex(), editor::editor_controller::mouse_motion(), and events::mouse_handler_base::mouse_press().
|
inlinevirtual |
Reimplemented in editor::editor_display.
Definition at line 219 of file display.hpp.
Referenced by terrain_label::viewable().
|
inlinevirtual |
Reimplemented in game_display.
Definition at line 218 of file display.hpp.
void display::init_flags | ( | ) |
Init the flag list and the team colors used by ~TC.
Definition at line 259 of file display.cpp.
References context(), dc_, flags_, reinit_flags_for_team(), utf8::size(), and t.
Referenced by display(), and editor::context_manager::refresh_on_context_change().
bool display::invalidate | ( | const map_location & | loc | ) |
Function to invalidate a specific tile for redrawing.
Definition at line 3087 of file display.cpp.
References invalidateAll_, invalidated_, loc, and map_screenshot_.
Referenced by editor::editor_display::add_brush_loc(), editor::editor_display::clear_brush_locs(), actions::shroud_clearer::clear_loc(), wb::side_actions::execute_net_cmd(), unit_display::unit_mover::finish(), actions::get_village(), wb::ghost_owner_unit(), highlight_hex(), wb::attack::init(), wb::suppose_dead::init(), wb::attack::invalidate(), unit_animation::invalidate(), invalidate_animations(), invalidate_animations_location(), invalidate_locations_in_rect(), game_display::invalidate_route(), unit_map::move(), editor::mouse_action_item::move(), editor::mouse_action_unit::move(), actions::place_recruit(), fake_unit_manager::place_temporary_unit(), unit_creator::post_create(), unit_display::unit_mover::proceed_to(), process_reachmap_changes(), game_lua_kernel::put_unit_helper(), wb::attack::redraw(), wb::move::redraw(), wb::recall::redraw(), wb::recruit::redraw(), wb::suppose_dead::redraw(), editor::editor_display::remove_brush_loc(), fake_unit_manager::remove_temporary_unit(), wb::manager::save_temp_attack(), select_hex(), game_display::set_attack_indicator(), editor::editor_display::set_brush_locs(), unit_display::unit_mover::start(), SYNCED_COMMAND_HANDLER_FUNCTION(), wb::unghost_owner_unit(), unit_display::unit_mover::wait_for_anims(), and wb::suppose_dead::~suppose_dead().
bool display::invalidate | ( | const std::set< map_location > & | locs | ) |
Definition at line 3097 of file display.cpp.
References invalidateAll_, invalidated_, loc, and map_screenshot_.
void display::invalidate_all | ( | ) |
Function to invalidate all tiles.
Definition at line 3080 of file display.cpp.
References DBG_DP, invalidateAll_, and invalidated_.
Referenced by game_display::begin_game(), editor::editor_controller::do_execute_command(), game_lua_kernel::intf_color_adjust(), game_lua_kernel::intf_override_shroud(), game_lua_kernel::intf_redraw(), game_lua_kernel::intf_toggle_fog(), game_lua_kernel::intf_toggle_shroud(), game_display::maybe_rebuild(), queue_rerender(), actions::recalculate_fog(), editor::context_manager::refresh_all(), game_display::set_game_mode(), set_zoom(), events::mouse_handler::teleport_action(), update(), replay_controller::update_teams(), and update_tod().
void display::invalidate_animations | ( | ) |
Function to invalidate animated terrains and units which may have changed.
Definition at line 3166 of file display.cpp.
References animate_map_, builder_, context(), fake_unit_man_, prefs::get(), get_visible_hexes(), halo_man_, invalidate(), invalidate_animations_location(), loc, new_animation_frame(), shrouded(), and halo::manager::update().
Referenced by layout().
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 3155 of file display.cpp.
References context(), flags_, fogged(), invalidate(), loc, viewing_team(), and display_context::village_owner().
Referenced by invalidate_animations().
|
inline |
Function to invalidate the game status displayed on the sidebar.
Definition at line 316 of file display.hpp.
References invalidateGameStatus_.
Referenced by wb::recall::apply_temp_modifier(), wb::recruit::apply_temp_modifier(), game_display::highlight_hex(), editor::editor_toolkit::hotkey_set_mouse_action(), actions::shroud_clearer::invalidate_after_clear(), events::mouse_handler::move_unit_along_route(), actions::recall_unit(), actions::recruit_unit(), set_playing_team_index(), and events::mouse_handler::teleport_action().
bool display::invalidate_locations_in_rect | ( | const SDL_Rect & | rect | ) |
invalidate all hexes under the rectangle rect (in screen coordinates)
Definition at line 3140 of file display.cpp.
References DBG_DP, hexes_under_rect(), invalidate(), invalidateAll_, loc, map_screenshot_, and draw::rect().
Referenced by invalidate_visible_locations_in_rect(), layout(), screenshot(), and scroll().
bool display::invalidate_visible_locations_in_rect | ( | const SDL_Rect & | rect | ) |
Definition at line 3135 of file display.cpp.
References invalidate_locations_in_rect(), and map_area().
bool display::is_blindfolded | ( | ) | const |
Definition at line 458 of file display.cpp.
References blindfold_ctr_.
Referenced by draw_minimap_units(), fogged(), image::prep_minimap_for_rendering(), recalculate_minimap(), show_everything(), and shrouded().
map_labels & display::labels | ( | ) |
Definition at line 2552 of file display.cpp.
References map_labels_.
Referenced by editor::map_context::clear_starting_position_labels(), do_replay_handle(), game_lua_kernel::intf_add_label(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_get_label(), game_lua_kernel::intf_override_shroud(), game_lua_kernel::intf_remove_label(), game_lua_kernel::intf_toggle_shroud(), actions::shroud_clearer::invalidate_after_clear(), gui2::dialogs::label_settings::label_settings(), queue_rerender(), scroll(), editor::editor_map::set_starting_position_labels(), set_viewing_team_index(), set_zoom(), and ai::default_recruitment::recruitment::show_important_hexes().
const map_labels & display::labels | ( | ) | const |
Definition at line 2557 of file display.cpp.
References map_labels_.
|
overridevirtual |
Finalize screen layout.
Reimplemented from gui2::top_level_drawable.
Reimplemented in game_display, and editor::editor_display.
Definition at line 2383 of file display.cpp.
References context(), DBG_DP, invalidate_animations(), invalidate_locations_in_rect(), invalidateAll_, map_area(), redraw_background_, redraw_minimap(), and font::update_floating_labels().
Referenced by editor::editor_display::layout(), and game_display::layout().
void display::layout_buttons | ( | ) |
Definition at line 790 of file display.cpp.
References theme::actions(), b, DBG_DP, find_action_button(), find_menu_button(), video::game_canvas(), loc, theme::menus(), and theme_.
Referenced by create_buttons().
rect display::map_area | ( | ) | const |
Returns the area used for the map.
Definition at line 495 of file display.cpp.
References map_outside_area(), map_screenshot_, and max_map_area().
Referenced by bounds_check_position(), soundsource::positional_source::calculate_volume(), draw_minimap(), drawing_buffer_commit(), get_clip_rect(), get_location(), get_middle_location(), get_visible_hexes(), controller_base::handle_event(), hex_clicked_on(), hexes_under_rect(), invalidate_visible_locations_in_rect(), layout(), events::mouse_handler::right_click_show_menu(), screenshot(), scroll(), scroll_to_tiles(), scroll_to_xy(), set_zoom(), tile_fully_on_screen(), and tile_nearly_on_screen().
rect display::map_outside_area | ( | ) | const |
Returns the available area for a map, this may differ from the above.
This area will get the background area applied to it.
Definition at line 521 of file display.cpp.
References video::game_canvas(), theme::main_map_location(), map_screenshot_, max_map_area(), and theme_.
Referenced by display_chat_manager::add_chat_message(), announce(), draw(), draw_minimap(), expose(), fade_to(), fade_tod_mask(), editor::editor_display::get_clip_rect(), game_lua_kernel::intf_set_floating_label(), editor::editor_display::layout(), map_area(), terrain_label::recalculate(), unit_drawer::redraw_unit(), render_map_outside_area(), set_diagnostic(), set_zoom(), and gui2::settings::update_screen_size_variables().
rect display::max_map_area | ( | ) | const |
Returns the maximum area used for the map regardless to resolution and view size.
Definition at line 478 of file display.cpp.
References theme::border(), context(), gamemap_base::h(), hex_size(), hex_width(), display_context::map(), theme::border_t::size, theme_, and gamemap_base::w().
Referenced by map_area(), map_outside_area(), and screenshot().
const theme::menu * display::menu_pressed | ( | ) |
Definition at line 1544 of file display.cpp.
References theme::get_menu_item(), i, utf8::index(), menu_buttons_, theme::menus(), and theme_.
Referenced by controller_base::play_slice().
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 463 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().
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 693 of file display.cpp.
References utils::contains(), context(), gamemap_base::h(), h, hex_size(), hex_width(), loc, display_context::map(), 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().
|
inline |
Definition at line 310 of file display.hpp.
References mouseoverHex_.
Referenced by editor::editor_controller::can_execute_command(), game_lua_kernel::intf_get_mouseover_tile(), controller_base::play_slice(), editor::editor_controller::terrain_description(), and unit_display::unit_recruited().
|
inlinevirtual |
Reimplemented in game_display.
Definition at line 223 of file display.hpp.
|
static |
Check if the bbox of the hex at x,y has pixels outside the area rectangle.
Definition at line 530 of file display.cpp.
References hex_size().
Referenced by scroll_to_tiles(), and set_zoom().
const rect & display::palette_area | ( | ) | const |
Definition at line 468 of file display.cpp.
References video::game_canvas(), theme::palette_location(), and theme_.
Referenced by editor::palette_manager::adjust_size().
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 552 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().
const team & display::playing_team | ( | ) | const |
Definition at line 337 of file display.cpp.
References context(), playing_team_index(), and display_context::teams().
Referenced by attack_info(), playmp_controller::process_network_change_controller_impl(), playmp_controller::process_network_side_drop_impl(), and unit_moves().
|
inline |
The playing team is the team whose turn it is.
Definition at line 116 of file display.hpp.
References playing_team_index_.
Referenced by playing_team(), editor::mouse_action_village::up_left(), and viewing_team_is_playing().
|
protected |
Definition at line 3259 of file display.cpp.
References get_visible_hexes(), invalidate(), reach_map_, reach_map_changed_, and reach_map_old_.
Referenced by game_display::update().
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 3108 of file display.cpp.
References i, invalidateAll_, and invalidated_.
Referenced by unit_animation::invalidate().
void display::queue_repaint | ( | ) |
Queues repainting to the screen, but doesn't rerender.
Definition at line 2313 of file display.cpp.
References draw_manager::invalidate_all().
void display::queue_rerender | ( | ) |
Marks everything for rendering including all tiles and sidebar.
Also calls redraw observers.
Definition at line 2261 of file display.cpp.
References action_buttons_, bounds_check_position(), tooltips::clear_tooltips(), resources::controller, create_buttons(), DBG_DP, f, video::game_canvas(), play_controller::get_hotkey_command_executor(), video::headless(), invalidate_all(), draw_manager::invalidate_all(), invalidateGameStatus_, gui2::is_in_dialog(), labels(), menu_buttons_, map_labels::recalculate_labels(), redraw_background_, redraw_observers_, reportLocations_, reports_, reportSurfaces_, hotkey::command_executor::set_button_state(), theme::set_resolution(), and theme_.
Referenced by editor::editor_controller::editor_controller(), events::menu_handler::preferences(), replay_controller::replay_controller(), set_theme(), SYNCED_COMMAND_HANDLER_FUNCTION(), blindfold::unblind(), replay_controller::update_enabled_buttons(), replay_controller::update_gui(), update_render_textures(), and replay_controller::~replay_controller().
|
private |
Definition at line 3251 of file display.cpp.
References tod_color::b, color_adjust_, tod_color::g, tod_color::r, and view_locked_.
Referenced by display().
void display::rebuild_all | ( | ) |
Rebuild all dynamic terrain.
Definition at line 433 of file display.cpp.
References builder_.
Referenced by game_display::maybe_rebuild(), editor::context_manager::refresh_all(), and set_theme().
void display::recalculate_minimap | ( | ) |
Schedule the minimap for recalculation.
Useful if any terrain in the map has changed.
Definition at line 1576 of file display.cpp.
References context(), rect::empty(), video::headless(), is_blindfolded(), minimap_area(), minimap_renderer_, image::prep_minimap_for_rendering(), reach_map_, redraw_minimap(), selectedHex_, map_location::valid(), and viewing_team().
Referenced by do_replay(), game_lua_kernel::intf_override_shroud(), game_lua_kernel::intf_redraw(), game_lua_kernel::intf_toggle_fog(), game_lua_kernel::intf_toggle_shroud(), actions::shroud_clearer::invalidate_after_clear(), game_display::maybe_rebuild(), hotkey::command_executor_default::recalculate_minimap(), editor::context_manager::refresh_all(), render(), select_hex(), and SYNCED_COMMAND_HANDLER_FUNCTION().
void display::redraw_minimap | ( | ) |
Schedule the minimap to be redrawn.
Useful if units have moved about on the map.
Definition at line 1597 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().
void display::refresh_report | ( | const std::string & | report_name, |
const config * | new_cfg = nullptr |
||
) |
Update the given report.
Redraws the specified report (if anything has changed).
Actual drawing is done in draw_report().
If a config is not supplied, it will be generated via reports::generate_report().
Definition at line 2836 of file display.cpp.
References config::add_child(), config::add_child_at(), tooltips::clear_tooltips(), resources::controller, DBG_DP, dc_, draw_report(), e, config::empty(), video::game_canvas(), reports::generate_report(), play_controller::get_mouse_handler_base(), theme::get_status_item(), draw_manager::invalidate_region(), loc, theme::status_item::location(), config::mandatory_child(), theme::status_item::postfix(), theme::status_item::prefix(), reportLocations_, reports_, reports_object_, theme_, resources::tod_manager, and wb_.
Referenced by editor::editor_display::layout(), and game_display::layout().
void display::reinit_flags_for_team | ( | const team & | t | ) |
Rebuild the flag list (not team colors) for a single side.
Definition at line 270 of file display.cpp.
References animated< T >::add_frame(), randomness::rng::default_instance(), ERR_DP, f, game_config::images::flag, game_config::flag_rgb, flags_, randomness::rng::get_random_int(), LOG_DP, utils::split(), utils::square_parenthetical_split(), utils::stoi(), and t.
Referenced by init_flags(), and game_lua_kernel::intf_set_side_id().
void display::reload_map | ( | ) |
Updates internals that cache map size.
This should be called when the map size has changed.
Definition at line 438 of file display.cpp.
References builder_, and redraw_background_.
Referenced by editor::context_manager::reload_map(), and game_events::WML_HANDLER_FUNCTION().
void display::remove_arrow | ( | arrow & | arrow | ) |
Definition at line 3218 of file display.cpp.
References arrows_map_, arrow::get_path(), and loc.
std::string display::remove_exclusive_draw | ( | const map_location & | loc | ) |
Cancels an exclusive draw request.
Definition at line 378 of file display.cpp.
References exclusive_unit_draw_requests_, id, loc, and map_location::valid().
Referenced by wb::highlighter::unhighlight().
void display::remove_overlay | ( | const map_location & | loc | ) |
remove_overlay will remove all overlays on a tile.
Definition at line 134 of file display.cpp.
References loc.
Referenced by editor::mouse_action_item::click_right(), and game_lua_kernel::intf_remove_tile_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 139 of file display.cpp.
References utils::erase_if(), overlay::halo, overlay::id, overlay::image, and loc.
Referenced by game_lua_kernel::intf_remove_tile_overlay().
|
overridevirtual |
Update offscreen render buffers.
Reimplemented from gui2::top_level_drawable.
Reimplemented in game_display.
Definition at line 2414 of file display.cpp.
References DBG_DP, draw(), rect::empty(), front_, minimap_area(), minimap_renderer_, prevent_draw_, recalculate_minimap(), and draw::set_render_target().
Referenced by game_display::render().
|
private |
Draw/redraw the off-map background area.
This updates both render textures.
Definition at line 2536 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(), setter, theme_, and draw::tiled().
Referenced by draw(), and update_render_textures().
|
inline |
Definition at line 674 of file display.hpp.
References reports_object_.
void display::reset_standing_animations | ( | ) |
Definition at line 3204 of file display.cpp.
References context().
Definition at line 282 of file display.hpp.
References get_zoom_factor(), and p.
|
inlinestatic |
Scale the width and height of a rect by the current zoom factor.
Definition at line 276 of file display.hpp.
References get_zoom_factor().
Referenced by unit_drawer::redraw_unit().
|
overridevirtual |
Return the current draw location of the display, on the screen.
Implements gui2::top_level_drawable.
Definition at line 2483 of file display.cpp.
References video::game_canvas(), and map_screenshot_.
surface display::screenshot | ( | bool | map_screenshot = false | ) |
Capture a (map-)screenshot into a surface.
Definition at line 725 of file display.cpp.
References context(), DBG_DP, draw(), ERR_DP, invalidate_locations_in_rect(), LOG_DP, map_area(), map_screenshot_, max_map_area(), draw::override_clip(), video::read_pixels(), draw::set_render_target(), viewport_origin_, and WRN_DP.
Referenced by editor::editor_controller::do_screenshot().
bool display::scroll | ( | const point & | amount, |
bool | force = false |
||
) |
Scrolls the display by amount pixels.
Invalidation and redrawing will be scheduled.
Definition at line 1700 of file display.cpp.
References back_, draw::blit(), bounds_check_position(), texture::clear_src(), rect::clip(), dst, front_, video::headless(), invalidate_locations_in_rect(), draw_manager::invalidate_region(), labels(), map_area(), events::generic_event::notify_observers(), map_labels::recalculate_shroud(), redraw_minimap(), scroll_event_, font::scroll_floating_labels(), draw::set_render_target(), texture::set_src(), rect::shift(), src, swap(), view_locked_, and viewport_origin_.
Referenced by controller_base::handle_scroll(), game_lua_kernel::intf_scroll(), events::mouse_handler_base::mouse_wheel(), scroll_to_xy(), and events::mouse_handler::touch_motion().
|
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().
void display::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.
WARP jumps to loc; SCROLL uses scroll speed; ONSCREEN only scrolls if x,y is offscreen force : scroll even if preferences tell us not to, or the view is locked.
Definition at line 1975 of file display.cpp.
References context(), ERR_DP, loc, and scroll_to_tiles().
Referenced by editor::location_palette::adjust_size(), events::mouse_handler::cycle_units(), game_lua_kernel::intf_scroll_to_tile(), editor::mouse_action::key_event(), events::mouse_handler_base::left_click(), events::mouse_handler_base::mouse_motion_default(), events::mouse_handler_base::mouse_press(), game_display::scroll_to_leader(), events::mouse_handler::touch_motion(), unit_display::unit_healing(), and unit_display::unit_recruited().
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 |
||
) |
Scroll to fit as many locations on-screen as possible, starting with the first.
Definition at line 1992 of file display.cpp.
References rect::center(), context(), ERR_DP, fogged(), get_location(), h, hex_size(), loc, map_area(), ONSCREEN, ONSCREEN_WARP, outside_area(), rect::padded_by(), scroll_to_xy(), and w.
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 1985 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().
|
protected |
Definition at line 1897 of file display.cpp.
References bounds_check_position(), rect::center(), events::draw(), prefs::get(), video::headless(), map_area(), ONSCREEN_WARP, events::pump(), redraw_minimap(), scroll(), prefs::scroll_speed(), turbo_speed(), view_locked_, viewport_origin_, and WARP.
Referenced by scroll_to_tiles().
|
virtual |
Reimplemented in game_display.
Definition at line 1476 of file display.cpp.
References invalidate(), recalculate_minimap(), and selectedHex_.
Referenced by game_display::select_hex(), and unit_display::unit_attack().
|
inline |
Definition at line 309 of file display.hpp.
References selectedHex_.
Referenced by get_selected_unit(), get_selected_unit_ptr(), and game_lua_kernel::intf_get_selected_tile().
|
inline |
Definition at line 942 of file display.hpp.
References debug_flags_, and game_config::images::flag.
Referenced by editor::editor_controller::init_gui().
void display::set_diagnostic | ( | const std::string & | msg | ) |
Definition at line 1494 of file display.cpp.
References font::add_floating_label(), diagnostic_label_, map_outside_area(), wfl::msg(), font::remove_floating_label(), font::floating_label::set_clip_rect(), font::floating_label::set_color(), font::floating_label::set_font_size(), font::floating_label::set_position(), font::SIZE_PLUS, and font::YELLOW_COLOR.
Referenced by ai::readonly_context_impl::diagnostic().
void display::set_fade | ( | const color_t & | color | ) |
Definition at line 2256 of file display.cpp.
References c, and fade_color_.
void display::set_playing_team_index | ( | std::size_t | team | ) |
sets the team whose turn it currently is
Definition at line 364 of file display.cpp.
References context(), invalidate_game_status(), playing_team_index_, and utf8::size().
Referenced by editor::context_manager::refresh_on_context_change().
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 2139 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().
void display::set_theme | ( | const std::string & | new_theme | ) |
Definition at line 248 of file display.cpp.
References action_buttons_, theme::border(), builder_, create_buttons(), video::game_canvas(), theme::get_theme_config(), menu_buttons_, queue_rerender(), rebuild_all(), theme::border_t::show_border, and theme_.
Referenced by gui2::dialogs::preferences_dialog::handle_theme_select(), and prefs::show_theme_dialog().
|
inline |
Sets whether the map view is locked (e.g.
so the user can't scroll away)
Definition at line 507 of file display.hpp.
References view_locked_.
Referenced by game_lua_kernel::intf_lock_view().
void display::set_viewing_team_index | ( | 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 347 of file display.cpp.
References context(), dont_show_all_, labels(), map_labels::recalculate_labels(), map_labels::set_team(), show_everything(), utf8::size(), viewing_team_index_, w, and wb_.
Referenced by editor::context_manager::refresh_on_context_change().
bool display::set_zoom | ( | bool | increase | ) |
Zooms the display in (true) or out (false).
Definition at line 1803 of file display.cpp.
References final_zoom_index, zoom_index_, and zoom_levels.
Referenced by game_lua_kernel::intf_zoom(), toggle_default_zoom(), hotkey::command_executor_default::zoom_in(), and hotkey::command_executor_default::zoom_out().
bool display::set_zoom | ( | unsigned int | amount, |
const bool | validate_value_and_set_index = true |
||
) |
Sets the display zoom to the specified amount.
Definition at line 1813 of file display.cpp.
References bounds_check_position(), DefaultZoom, prefs::get(), get_zoom_levels_index(), invalidate_all(), labels(), last_zoom_, LOG_DP, map_area(), map_outside_area(), MaxZoom, MinZoom, outside_area(), map_labels::recalculate_labels(), redraw_background_, rect::size(), viewport_origin_, WRN_DP, zoom_, zoom_index_, and zoom_levels.
|
inline |
Definition at line 113 of file display.hpp.
References dont_show_all_, and is_blindfolded().
Referenced by attack_info(), get_selected_unit(), get_selected_unit_ptr(), get_visible_unit(), game_lua_kernel::intf_get_displayed_unit(), gui2::dialogs::game_stats::pre_show(), and set_viewing_team_index().
bool display::shrouded | ( | const map_location & | loc | ) | const |
Returns true if location (x,y) is covered in shroud.
Definition at line 669 of file display.cpp.
References dont_show_all_, is_blindfolded(), loc, team::shrouded(), and viewing_team().
Referenced by soundsource::positional_source::calculate_volume(), draw_hex(), game_display::draw_hex(), get_fog_shroud_images(), invalidate_animations(), is_shrouded(), and tod_stats_at().
bool display::tile_fully_on_screen | ( | const map_location & | loc | ) | const |
Check if a tile is fully visible on screen.
Definition at line 1883 of file display.cpp.
References rect::contains(), get_location_rect(), loc, and map_area().
Referenced by unit_display::unit_mover::proceed_to().
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 1888 of file display.cpp.
References get_location(), hex_size(), hex_width(), loc, and map_area().
Referenced by unit_animation::invalidate(), and unit_animation_component::refresh().
|
inline |
Definition at line 947 of file display.hpp.
References debug_flags_, and game_config::images::flag.
Referenced by editor::editor_controller::do_execute_command().
void display::toggle_default_zoom | ( | ) |
Sets the zoom amount to the default.
Definition at line 1871 of file display.cpp.
References DefaultZoom, last_zoom_, set_zoom(), and zoom_.
Referenced by hotkey::command_executor_default::zoom_default().
double display::turbo_speed | ( | ) | const |
Definition at line 2125 of file display.cpp.
References prefs::get(), video::headless(), keys_, and prefs::turbo().
Referenced by fade_tod_mask(), game_display::float_label(), game_lua_kernel::intf_delay(), scroll_to_xy(), unit_animation::update_last_draw_time(), and unit_animator::wait_until().
void display::unhide_buttons | ( | ) |
Unhide theme buttons so they draw again.
Definition at line 942 of file display.cpp.
References action_buttons_, and menu_buttons_.
Referenced by set_prevent_draw().
bool display::unit_can_draw_here | ( | const map_location & | loc, |
const unit & | unit | ||
) | const |
Returns true if there is no exclusive draw request for loc, or if there is, that it's for unit.
Definition at line 386 of file display.cpp.
References exclusive_unit_draw_requests_, unit::id(), and loc.
Referenced by draw_invalidated(), and game_display::draw_invalidated().
const rect & display::unit_image_area | ( | ) | const |
Definition at line 473 of file display.cpp.
References video::game_canvas(), theme_, and theme::unit_image_location().
|
overridevirtual |
Update animations and internal state.
Reimplemented from gui2::top_level_drawable.
Reimplemented in game_display.
Definition at line 2366 of file display.cpp.
References animate_water_, builder_, DEBUG_BENCHMARK, debug_flag_set(), prefs::get(), invalidate_all(), and update_render_textures().
Referenced by game_display::update().
void display::update_arrow | ( | arrow & | a | ) |
Called by arrow objects when they change.
You should not need to call this directly.
Definition at line 3225 of file display.cpp.
References arrows_map_, arrow::get_path(), arrow::get_previous_path(), and loc.
void display::update_fps_count | ( | ) |
Definition at line 1512 of file display.cpp.
References fps_actual_, fps_counter_, fps_start_, frametimes_, last_frame_finished_, and s.
Referenced by draw().
void display::update_fps_label | ( | ) |
Definition at line 1297 of file display.cpp.
References font::add_floating_label(), font::BAD_COLOR, calculate_fps(), current_frame_sample_, game_config::debug, DEBUG_BENCHMARK, debug_flag_set(), drawn_hexes_, filename, float_to_color(), fps_actual_, fps_handle_, fps_history_, frametimes_, filesystem::get_user_data_dir(), invalidated_hexes_, font::LEFT_ALIGN, font::NORMAL_COLOR, filesystem::ostream_file(), font::remove_floating_label(), font::floating_label::set_alignment(), font::floating_label::set_bg_color(), font::floating_label::set_border_size(), font::floating_label::set_color(), font::floating_label::set_font_size(), and font::floating_label::set_position().
Referenced by draw().
|
private |
Ensure render textures are valid and correct.
Definition at line 2491 of file display.cpp.
References back_, texture::draw_size(), draw::fill(), front_, video::game_canvas(), video::get_pixel_scale(), texture::get_raw_size(), video::headless(), i, LOG_DP, queue_rerender(), render_map_outside_area(), texture::set_draw_size(), draw::set_render_target(), setter, and utf8::size().
Referenced by update().
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.
tod_override | The ToD to apply to the map instead of that of the current ToD's. |
Definition at line 392 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().
|
inline |
Definition at line 504 of file display.hpp.
References view_locked_.
Referenced by game_lua_kernel::intf_view_locked().
const team & display::viewing_team | ( | ) | const |
Definition at line 342 of file display.cpp.
References context(), display_context::teams(), and viewing_team_index().
Referenced by attack_info(), wb::move::calculate_moves_left(), wb::manager::create_temp_move(), events::mouse_handler::current_unit_attacks_from(), game_display::display_unit_hex(), game_display::draw_hex(), draw_minimap_units(), draw_overlays_at(), fogged(), get_flag(), 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(), invalidate_animations_location(), pathfind::mark_route(), wb::mapbuilder::pre_build(), recalculate_minimap(), unit_display::unit_mover::replace_temporary(), game_display::scroll_to_leader(), editor::mouse_action_unit::set_unit_mouse_overlay(), editor::unit_palette::setup_item(), shrouded(), events::menu_handler::status_table(), unit_display::unit_recruited(), editor::mouse_action_unit::up_left(), wb::viewer_actions(), and wb::viewer_side().
|
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 dc_->teams().
Definition at line 126 of file display.hpp.
References viewing_team_index_.
Referenced by quit_confirmation::default_prompt(), hotkey::command_executor::surrender_game(), viewing_team(), and viewing_team_is_playing().
|
inline |
Definition at line 131 of file display.hpp.
References playing_team_index(), and viewing_team_index().
Referenced by gray_inactive().
void display::write | ( | config & | cfg | ) | const |
Definition at line 3242 of file display.cpp.
References config::add_child(), tod_color::b, color_adjust_, tod_color::g, get_middle_location(), tod_color::r, view_locked_, and map_location::write().
|
static |
Definition at line 1793 of file display.cpp.
|
static |
Definition at line 1798 of file display.cpp.
|
protected |
Definition at line 771 of file display.hpp.
Referenced by action_pressed(), create_buttons(), display(), find_action_button(), hide_buttons(), queue_rerender(), set_theme(), and unhide_buttons().
|
protected |
Local cache for prefs::get().animate_map, since it is constantly queried.
Definition at line 787 of file display.hpp.
Referenced by get_flag(), get_terrain_images(), and invalidate_animations().
|
protected |
Local version of prefs::get().animate_water, used to detect when it's changed.
Definition at line 790 of file display.hpp.
Referenced by update().
|
private |
Maps the list of arrows for each location.
Definition at line 957 of file display.hpp.
Referenced by add_arrow(), draw_hex(), remove_arrow(), and update_arrow().
|
private |
Definition at line 598 of file display.hpp.
Referenced by render_map_outside_area(), scroll(), and update_render_textures().
|
private |
Definition at line 680 of file display.hpp.
Referenced by blindfold(), display(), and is_blindfolded().
|
protected |
Definition at line 747 of file display.hpp.
Referenced by change_display_context(), get_builder(), get_terrain_images(), invalidate_animations(), rebuild_all(), editor::editor_display::rebuild_terrain(), reload_map(), set_theme(), and update().
|
private |
Definition at line 959 of file display.hpp.
Referenced by adjust_color_overlay(), draw_overlays_at(), get_color_overlay(), get_terrain_images(), read(), update_tod(), and write().
|
protected |
Definition at line 761 of file display.hpp.
Referenced by update_fps_label().
|
protected |
Definition at line 684 of file display.hpp.
Referenced by change_display_context(), context(), game_display::draw_hex(), init_flags(), and refresh_report().
|
private |
Currently set debug flags.
Definition at line 954 of file display.hpp.
Referenced by debug_flag_set(), draw_hex(), set_debug_flag(), and toggle_debug_flag().
|
protected |
Definition at line 752 of file display.hpp.
Referenced by set_diagnostic().
|
protected |
Definition at line 728 of file display.hpp.
Referenced by game_display::display_unit_hex(), draw_overlays_at(), fogged(), game_display::highlight_hex(), set_viewing_team_index(), show_everything(), and shrouded().
|
protected |
Definition at line 856 of file display.hpp.
Referenced by drawing_buffer_add(), and drawing_buffer_commit().
|
private |
Definition at line 912 of file display.hpp.
Referenced by clear_fps_label(), draw_invalidated(), and update_fps_label().
|
protected |
map of hexes where only one unit should be drawn, the one identified by the associated id string
Definition at line 690 of file display.hpp.
Referenced by add_exclusive_draw(), clear_exclusive_draws(), remove_exclusive_draw(), and unit_can_draw_here().
|
private |
Definition at line 573 of file display.hpp.
Referenced by expose(), fade_to(), and set_fade().
|
protected |
Definition at line 746 of file display.hpp.
Referenced by display(), game_display::draw_invalidated(), and invalidate_animations().
|
private |
Animated flags for each team.
Definition at line 797 of file display.hpp.
Referenced by get_flag(), init_flags(), invalidate_animations_location(), and reinit_flags_for_team().
|
protected |
Definition at line 779 of file display.hpp.
Referenced by display(), and draw_hex().
|
protected |
Definition at line 764 of file display.hpp.
Referenced by update_fps_count(), and update_fps_label().
|
protected |
Definition at line 762 of file display.hpp.
Referenced by update_fps_count().
|
private |
Handle for the label which displays frames per second.
Definition at line 909 of file display.hpp.
Referenced by clear_fps_label(), draw(), and update_fps_label().
|
private |
Definition at line 961 of file display.hpp.
Referenced by update_fps_label().
|
protected |
Definition at line 763 of file display.hpp.
Referenced by update_fps_count().
|
protected |
Definition at line 760 of file display.hpp.
Referenced by update_fps_count(), and update_fps_label().
|
private |
Render textures, for intermediate rendering.
Definition at line 597 of file display.hpp.
Referenced by expose(), render(), render_map_outside_area(), scroll(), and update_render_textures().
|
protected |
Definition at line 685 of file display.hpp.
Referenced by expose(), get_halo_manager(), and invalidate_animations().
|
protected |
Definition at line 751 of file display.hpp.
Referenced by invalidate(), invalidate_all(), invalidate_locations_in_rect(), layout(), and propagate_invalidation().
|
protected |
Definition at line 772 of file display.hpp.
Referenced by draw(), draw_invalidated(), game_display::draw_invalidated(), invalidate(), invalidate_all(), and propagate_invalidation().
|
private |
Count work done for the debug info displayed under fps.
Definition at line 911 of file display.hpp.
Referenced by clear_fps_label(), draw_invalidated(), and update_fps_label().
|
protected |
Definition at line 753 of file display.hpp.
Referenced by invalidate_game_status(), game_display::invalidate_unit(), game_display::layout(), and queue_rerender().
|
protected |
Definition at line 784 of file display.hpp.
Referenced by turbo_speed().
|
protected |
Definition at line 765 of file display.hpp.
Referenced by clear_fps_label(), and update_fps_count().
|
staticprotected |
The previous value of zoom_.
Definition at line 745 of file display.hpp.
Referenced by set_zoom(), and toggle_default_zoom().
|
protected |
Definition at line 754 of file display.hpp.
Referenced by labels().
|
protected |
Used to indicate to drawing functions that we are doing a map screenshot.
Definition at line 883 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().
|
protected |
Definition at line 771 of file display.hpp.
Referenced by create_buttons(), display(), find_menu_button(), hide_buttons(), menu_pressed(), queue_rerender(), set_theme(), and unhide_buttons().
|
protected |
Definition at line 749 of file display.hpp.
Referenced by draw_minimap(), draw_minimap_units(), and minimap_location_on().
Definition at line 748 of file display.hpp.
Referenced by draw_minimap(), recalculate_minimap(), and render().
|
protected |
Definition at line 783 of file display.hpp.
Referenced by editor::editor_display::draw_hex(), game_display::draw_hex(), highlight_hex(), game_display::highlight_hex(), editor::editor_display::layout(), and mouseover_hex().
|
protected |
Definition at line 815 of file display.hpp.
Referenced by playing_team_index(), and set_playing_team_index().
|
private |
Definition at line 562 of file display.hpp.
Referenced by create_buttons(), expose(), get_prevent_draw(), render(), and set_prevent_draw().
|
protected |
Definition at line 898 of file display.hpp.
Referenced by game_display::draw_hex(), game_display::get_reachmap_images(), game_display::highlight_another_reach(), process_reachmap_changes(), recalculate_minimap(), and game_display::unhighlight_reach().
|
protected |
Definition at line 900 of file display.hpp.
Referenced by game_display::highlight_another_reach(), process_reachmap_changes(), and game_display::unhighlight_reach().
|
protected |
Definition at line 899 of file display.hpp.
Referenced by process_reachmap_changes().
|
protected |
Definition at line 750 of file display.hpp.
Referenced by draw(), layout(), queue_rerender(), reload_map(), and set_zoom().
|
private |
Definition at line 914 of file display.hpp.
Referenced by add_redraw_observer(), clear_redraw_observers(), and queue_rerender().
|
protected |
Definition at line 768 of file display.hpp.
Referenced by draw_report(), draw_reports(), queue_rerender(), and refresh_report().
|
protected |
Definition at line 770 of file display.hpp.
Referenced by draw_report(), draw_reports(), queue_rerender(), and refresh_report().
|
protected |
Definition at line 755 of file display.hpp.
Referenced by game_display::layout(), refresh_report(), and reset_reports().
|
protected |
Definition at line 769 of file display.hpp.
Referenced by queue_rerender().
|
mutableprotected |
Event raised when the map is being scrolled.
Definition at line 758 of file display.hpp.
Referenced by scroll(), and scroll_event().
|
protected |
Definition at line 782 of file display.hpp.
Referenced by game_display::draw_hex(), game_display::highlight_hex(), recalculate_minimap(), select_hex(), and selected_hex().
|
protected |
Definition at line 780 of file display.hpp.
Referenced by display(), and draw_hex().
|
staticprotected |
Definition at line 964 of file display.hpp.
Referenced by display(), get_singleton(), game_display::get_singleton(), and ~display().
|
private |
Definition at line 801 of file display.hpp.
Referenced by draw_hex(), and get_terrain_images().
|
protected |
Definition at line 737 of file display.hpp.
Referenced by action_pressed(), bounds_check_position(), create_buttons(), draw_all_panels(), draw_minimap(), draw_report(), get_location(), get_terrain_images(), get_theme(), hexes_under_rect(), layout_buttons(), map_outside_area(), max_map_area(), menu_pressed(), minimap_area(), palette_area(), pixel_position_to_hex(), queue_rerender(), refresh_report(), render_map_outside_area(), set_theme(), and unit_image_area().
|
protected |
Definition at line 777 of file display.hpp.
Referenced by draw_hex(), and fade_tod_mask().
|
protected |
Definition at line 778 of file display.hpp.
Referenced by draw_hex(), and fade_tod_mask().
|
protected |
Definition at line 775 of file display.hpp.
Referenced by draw_hex(), and fade_tod_mask().
|
protected |
Definition at line 776 of file display.hpp.
Referenced by draw_hex(), and fade_tod_mask().
|
protected |
Definition at line 736 of file display.hpp.
Referenced by read(), scroll(), scroll_to_xy(), set_view_locked(), view_locked(), and write().
|
protected |
Definition at line 727 of file display.hpp.
Referenced by set_viewing_team_index(), and viewing_team_index().
|
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 735 of file display.hpp.
Referenced by bounds_check_position(), draw_minimap(), get_location(), get_middle_location(), hex_clicked_on(), hexes_under_rect(), screenshot(), scroll(), scroll_to_xy(), and set_zoom().
|
protected |
Definition at line 686 of file display.hpp.
Referenced by game_display::draw_hex(), game_display::draw_movement_info(), refresh_report(), game_display::render(), set_viewing_team_index(), and game_display::update().
|
staticprotected |
The current zoom, in pixels (on screen) per 72 pixels (in the graphic assets), i.e., 72 means 100%.
Definition at line 742 of file display.hpp.
Referenced by bounds_check_position(), display(), get_location(), get_zoom_factor(), hex_size(), hex_width(), set_zoom(), toggle_default_zoom(), zoom_at_max(), and zoom_at_min().
|
protected |
Definition at line 743 of file display.hpp.
Referenced by display(), and set_zoom().