#include <display.hpp>
Public Types | |
enum | SCROLL_TYPE { SCROLL, WARP, ONSCREEN } |
enum | tdrawing_layer { LAYER_TERRAIN_BG, LAYER_TERRAIN_TMP_BG, LAYER_UNIT_BG, LAYER_UNIT_FIRST, LAYER_UNIT_LAST = LAYER_UNIT_FIRST+100, LAYER_UNIT_FG, LAYER_UNIT_FAKE, LAYER_TERRAIN_FG, LAYER_TERRAIN_TMP_FG, LAYER_UNIT_BAR, LAYER_LINGER_OVERLAY, LAYER_LAST_LAYER } |
The layers to render something on. More... | |
Public Member Functions | |
display (CVideo &video, const gamemap &map, const config &theme_cfg, const config &cfg, const config &level) | |
virtual | ~display () |
CVideo & | video () |
surface | get_screen_surface () |
virtual bool | in_game () const |
virtual bool | in_editor () const |
int | w () const |
width | |
int | h () const |
height | |
const SDL_Rect & | minimap_area () const |
const SDL_Rect & | unit_image_area () const |
SDL_Rect | screen_area () const |
const SDL_Rect & | max_map_area () const |
Returns the maximum area used for the map regardless to resolution and view size. | |
const SDL_Rect & | map_area () const |
Returns the area used for the map. | |
const SDL_Rect & | map_outside_area () const |
Returns the available area for a map, this may differ from the above. | |
bool | outside_area (const SDL_Rect &area, const int x, const int y) const |
Check if the bbox of the hex at x,y has pixels outside the area rectangle. | |
int | hex_width () const |
Function which returns the width of a hex in pixels, up to where the next hex starts. | |
int | hex_size () const |
Function which returns the size of a hex in pixels (from top tip to bottom tip or left edge to right edge). | |
double | get_zoom_factor () |
Returns the current zoom factor. | |
const gamemap::location | hex_clicked_on (int x, int y, gamemap::location::DIRECTION *nearest_hex=NULL, gamemap::location::DIRECTION *second_nearest_hex=NULL) const |
const gamemap::location | pixel_position_to_hex (int x, int y, gamemap::location::DIRECTION *nearest_hex=NULL, gamemap::location::DIRECTION *second_nearest_hex=NULL) const |
gamemap::location | minimap_location_on (int x, int y) |
const gamemap::location & | selected_hex () |
const gamemap::location & | mouseover_hex () |
virtual void | select_hex (gamemap::location hex) |
virtual void | highlight_hex (gamemap::location hex) |
void | invalidate_game_status () |
Function to invalidate the game status displayed on the sidebar. | |
void | get_rect_hex_bounds (SDL_Rect rect, gamemap::location &topleft, gamemap::location &bottomright) const |
int | get_location_x (const gamemap::location &loc) const |
Functions to get the on-screen positions of hexes. | |
int | get_location_y (const gamemap::location &loc) const |
bool | shrouded (const gamemap::location &loc) const |
Returns true if location (x,y) is covered in shroud. | |
bool | fogged (const gamemap::location &loc) const |
Returns true if location (x,y) is covered in fog. | |
void | set_grid (const bool grid) |
Determines whether a grid should be overlayed on the game board. | |
void | get_visible_hex_bounds (gamemap::location &topleft, gamemap::location &bottomright) const |
Returns the locations of 2 hexes that bind the visible area of the map. | |
int | screenshot (std::string filename, bool map_screenshot=false) |
Save a (map-)screenshot and return the estimated file size. | |
void | redraw_everything () |
Invalidates entire screen, including all tiles and sidebar. | |
theme & | get_theme () |
gui::button * | find_button (const std::string &id) |
gui::button::TYPE | string_to_button_type (std::string type) |
void | create_buttons () |
void | invalidate_theme () |
void | refresh_report (reports::TYPE report_num, reports::report report, bool brightened=false) |
virtual void | invalidate (const gamemap::location &loc) |
virtual void | invalidate_rectangle (const gamemap::location &first_corner, const gamemap::location &second_corner) |
virtual void | invalidate_zone (const int x1, const int y1, const int x2, const int y2) |
virtual void | draw_minimap_units () |
const gamemap & | get_map () const |
void | set_hex_overlay (const gamemap::location &loc, surface image) |
void | clear_hex_overlay (const gamemap::location &loc) |
void | set_selected_hex_overlay (const surface &image) |
void | clear_selected_hex_overlay () |
void | set_mouseover_hex_overlay (const surface &image) |
void | clear_mouseover_hex_overlay () |
void | sunset (const size_t delay=0) |
Debug function to toggle the "sunset" mode. | |
void | toggle_benchmark () |
Toogle to continuously redraw the screen. | |
void | flip () |
void | update_display () |
Copy the backbuffer to the framebuffer. | |
void | rebuild_all () |
Rebuild all dynamic terrain. | |
void | render_unit_image (int x, int y, const bool fake_unit, const int drawing_order, surface image, bool hreverse=false, bool greyscale=false, fixed_t alpha=ftofxp(1.0), Uint32 blendto=0, double blend_ratio=0, double submerged=0.0, bool vreverse=false) |
Draw the image of a unit at a certain location. | |
const theme::menu * | menu_pressed () |
void | enable_menu (const std::string &item, bool enable) |
Finds the menu which has a given item in it, and enables or disables it. | |
void | set_diagnostic (const std::string &msg) |
void | delay (unsigned int milliseconds) const |
Delay routines: use these instead of SDL_Delay (for --nogui). | |
void | set_turbo (const bool turbo) |
Set/Get whether 'turbo' mode is on. | |
double | turbo_speed () const |
void | set_turbo_speed (const double speed) |
void | set_idle_anim (bool ison) |
bool | idle_anim () const |
void | set_idle_anim_rate (int rate) |
double | idle_anim_rate () const |
void | add_highlighted_loc (const gamemap::location &hex) |
Add a location to highlight. | |
void | clear_highlighted_locs () |
void | remove_highlighted_loc (const gamemap::location &hex) |
void | bounds_check_position () |
void | bounds_check_position (int &xpos, int &ypos) |
void | invalidate_all () |
Function to invalidate all tiles. | |
void | scroll (int xmov, int ymov) |
Scrolls the display by xmov,ymov pixels. | |
void | set_zoom (int amount) |
Zooms the display by the specified amount. | |
void | set_default_zoom () |
Sets the zoom amount to the default. | |
void | scroll_to_tile (const gamemap::location &loc, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true) |
Scroll such that location loc is on-screen. | |
void | scroll_to_tiles (gamemap::location loc1, gamemap::location loc2, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, double add_spacing=0.0) |
Scroll such that location loc1 is on-screen. | |
void | scroll_to_tiles (const std::vector< gamemap::location > &locs, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool only_if_possible=false, double add_spacing=0.0) |
Scroll to fit as many locations on-screen as possible, starting with the first. | |
events::generic_event & | scroll_event () const |
Expose the event, so observers can be notified about map scrolling. | |
bool | tile_on_screen (const gamemap::location &loc) |
Check if a tile is fully on screen. | |
virtual void | draw (bool update=true, bool force=false)=0 |
Draws invalidated items. | |
map_labels & | labels () |
const map_labels & | labels () const |
void | announce (const std::string msg, const SDL_Color &colour=font::GOOD_COLOUR) |
Announce a message prominently. | |
void | recalculate_minimap () |
Schedule the minimap for recalculation. | |
void | redraw_minimap () |
Schedule the minimap to be redrawn. | |
void | set_report_content (const reports::TYPE which_report, const std::string &content) |
Set what will be shown for the report with type which_report. | |
std::map< reports::TYPE, std::string > | get_report_contents () |
void | draw_text_in_hex (const gamemap::location &loc, const tdrawing_layer layer, const std::string &text, size_t font_size, SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5) |
Draw text on a hex. | |
void | drawing_buffer_add (const tdrawing_layer layer, const int drawing_order, const tblit &blit) |
Add an item to the drawing buffer. | |
Static Public Member Functions | |
static Uint32 | rgb (Uint8 red, Uint8 green, Uint8 blue) |
Protected Types | |
enum | ADJACENT_TERRAIN_TYPE { ADJACENT_BACKGROUND, ADJACENT_FOREGROUND, ADJACENT_FOGSHROUD } |
typedef std::map < tdrawing_layer, std::map < int, std::vector< tblit > > > | tdrawing_buffer |
* Surfaces are rendered per level in a map. | |
Protected Member Functions | |
virtual void | draw_border (const gamemap::location &loc, const int xpos, const int ypos) |
Draws the border tile overlay. | |
void | draw_minimap () |
std::vector< surface > | get_terrain_images (const gamemap::location &loc, const std::string timeid, image::TYPE type, ADJACENT_TERRAIN_TYPE terrain_type) |
std::vector< std::string > | get_fog_shroud_graphics (const gamemap::location &loc) |
void | draw_image_for_report (surface &img, SDL_Rect &rect) |
void | scroll_to_xy (int screenxpos, int screenypos, SCROLL_TYPE scroll_type) |
void | drawing_buffer_commit () |
Draws the drawing_buffer_ and clears it. | |
void | drawing_buffer_clear () |
Clears the drawing buffer. | |
void | draw_all_panels () |
redraw all panels associated with the map display | |
void | invalidate_locations_in_rect (SDL_Rect r) |
bool | draw_init () |
Invalidate controls and panels when changed after they have been drawn initially. | |
void | draw_wrap (bool update, bool force, bool changed) |
Protected Attributes | |
CVideo & | screen_ |
const gamemap & | map_ |
const viewpoint * | viewpoint_ |
int | xpos_ |
int | ypos_ |
theme | theme_ |
int | zoom_ |
int | last_zoom_ |
terrain_builder | builder_ |
surface | minimap_ |
SDL_Rect | minimap_location_ |
bool | redrawMinimap_ |
bool | redraw_background_ |
bool | invalidateAll_ |
bool | grid_ |
int | diagnostic_label_ |
bool | panelsDrawn_ |
double | turbo_speed_ |
bool | turbo_ |
bool | invalidateGameStatus_ |
map_labels | map_labels_ |
events::generic_event | _scroll_event |
Event raised when the map is being scrolled. | |
int | nextDraw_ |
Holds the tick count for when the next drawing event is scheduled. | |
SDL_Rect | reportRects_ [reports::NUM_REPORTS] |
surface | reportSurfaces_ [reports::NUM_REPORTS] |
reports::report | reports_ [reports::NUM_REPORTS] |
std::map< reports::TYPE, std::string > | report_ |
std::vector< gui::button > | buttons_ |
std::set< gamemap::location > | invalidated_ |
std::map< gamemap::location, surface > | hex_overlay_ |
surface | selected_hex_overlay_ |
surface | mouseover_hex_overlay_ |
gamemap::location | selectedHex_ |
gamemap::location | mouseoverHex_ |
std::set< gamemap::location > | highlighted_locations_ |
CKey | keys_ |
tdrawing_buffer | drawing_buffer_ |
bool | map_screenshot_ |
Used to indicate to drawing funtions that we are doing a map screenshot. | |
Private Attributes | |
int | fps_handle_ |
Handle for the label which displays frames per second. | |
bool | idle_anim_ |
double | idle_anim_rate_ |
surface | map_screenshot_surf_ |
Classes | |
struct | ordered_draw |
Strict weak ordering to sort a STL-set of hexes for drawing using the z-order. More... | |
struct | tblit |
Helper structure for rendering the terrains. More... |
Definition at line 58 of file display.hpp.
typedef std::map<tdrawing_layer, std::map<int , std::vector<tblit> > > display::tdrawing_buffer [protected] |
* Surfaces are rendered per level in a map.
Per level the items are rendered per location these locations are stored in the drawing order required for units. every location has a vector with surfaces, each with its own screen coordinate to render at. every vector element has a vector with surfaces to render.
Definition at line 522 of file display.hpp.
enum display::SCROLL_TYPE |
enum display::ADJACENT_TERRAIN_TYPE [protected] |
Definition at line 374 of file display.hpp.
The layers to render something on.
This value should never be stored it's the internal drawing order and adding removing and reordering the layers should be save. If needed in WML use the name and map that to the enum value.
LAYER_TERRAIN_BG |
Layer for the terrain drawn behind the unit.
|
LAYER_TERRAIN_TMP_BG | Layer which holds stuff that needs to be sorted out further, but under units. |
LAYER_UNIT_BG | Used for the ellipse behind the unit. |
LAYER_UNIT_FIRST | Reserve layeres to be selected for WML. |
LAYER_UNIT_LAST | |
LAYER_UNIT_FG |
Used for the ellipse in front of the unit.
|
LAYER_UNIT_FAKE | The fake unit is drawn on this layer. |
LAYER_TERRAIN_FG |
Layer for the terrain drawn in front of the unit.
|
LAYER_TERRAIN_TMP_FG | Layer which holds stuff that needs to be sorted out further, but on top of units. |
LAYER_UNIT_BAR |
Unit bars and overlays are drawn on this layer (for testing here).
|
LAYER_LINGER_OVERLAY | The overlay used for the linger mode. |
LAYER_LAST_LAYER |
Don't draw to this layer it's a dummy to size the vector.
|
Definition at line 466 of file display.hpp.
display::display | ( | CVideo & | video, | |
const gamemap & | map, | |||
const config & | theme_cfg, | |||
const config & | cfg, | |||
const config & | level | |||
) |
Definition at line 72 of file display.cpp.
References empty_rect, preferences::idle_anim_rate(), CVideo::lock_updates(), non_interactive(), reports::NUM_REPORTS, reportRects_, screen_, set_idle_anim_rate(), image::set_zoom(), and zoom_.
display::~display | ( | ) | [virtual] |
Definition at line 129 of file display.cpp.
static Uint32 display::rgb | ( | Uint8 | red, | |
Uint8 | green, | |||
Uint8 | blue | |||
) | [inline, static] |
Definition at line 65 of file display.hpp.
Referenced by unit_animation::add_anims(), unit_animation::fill_initial_animations(), frame_builder::frame_builder(), unit::overlaps(), unit::redraw_unit(), unit_display::unit_attack(), and unit_display::unit_healing().
CVideo& display::video | ( | ) | [inline] |
Definition at line 69 of file display.hpp.
References screen_.
Referenced by gui::dialog::add_button(), gui::dialog::add_option(), dialogs::animate_unit_advancement(), gui::dialog::dialog(), do_replay(), map_editor::brush_bar::draw(), map_editor::terrain_palette::draw(), draw_all_panels(), draw_background(), game_display::draw_minimap_units(), draw_tip_of_day(), fade_logo(), dialogs::file_dialog::file_dialog(), play_controller::finish_turn(), play_controller::fire_prestart(), flip(), gui::dialog::get_frame(), gui::dialog::get_menu(), dialogs::get_save_name(), playsingle_controller::init_gui(), play_controller::init_managers(), gui::dialog::layout(), dialogs::load_game_dialog(), move_unit_between(), dialogs::network_connect_dialog(), dialogs::network_data_dialog(), map_editor::new_map_dialog(), open_connection(), playmp_scenario(), playsingle_scenario(), map_editor::preferences_dialog(), game_events::pump(), map_editor::resize_dialog(), run_lobby_loop(), events::menu_handler::scenario_settings_table(), preferences::set_adjust_gamma(), preferences::set_fullscreen(), preferences::set_gamma(), gui::dialog::set_image(), gui::dialog::set_menu(), preferences::set_resolution(), gui::dialog::set_textbox(), gui::floating_textbox::show(), gui::dialog::show(), about::show_about(), gui::show_dialog(), help::show_help(), preferences::show_hotkeys_dialog(), show_intro_part(), show_intro_part_helper(), gui::show_title(), preferences::show_video_mode_dialog(), events::menu_handler::status_table(), teleport_unit_between(), the_end(), mp::ui::ui(), unit_display::unit_attack(), unit_display::unit_die(), unit_display::unit_healing(), events::menu_handler::unit_list(), unit_display::unit_recruited(), map_editor::update_l_button_palette(), and default_map_generator::user_config().
surface display::get_screen_surface | ( | ) | [inline] |
Definition at line 72 of file display.hpp.
References CVideo::getSurface(), map_screenshot_, map_screenshot_surf_, and screen_.
Referenced by game_display::draw(), editor_display::draw(), draw_border(), draw_init(), and drawing_buffer_commit().
virtual bool display::in_game | ( | ) | const [inline, virtual] |
Reimplemented in game_display.
Definition at line 74 of file display.hpp.
Referenced by hotkey::execute_command(), and hotkey::key_event().
virtual bool display::in_editor | ( | ) | const [inline, virtual] |
Reimplemented in editor_display.
Definition at line 75 of file display.hpp.
Referenced by hotkey::execute_command().
int display::w | ( | ) | const [inline] |
width
Definition at line 80 of file display.hpp.
References CVideo::getx(), and screen_.
Referenced by game_display::add_chat_message(), announce(), draw_background(), game_display::draw_bar(), game_display::draw_movement_info(), draw_tip_of_day(), dialogs::file_dialog::file_dialog(), dialogs::network_connect_dialog(), dialogs::network_data_dialog(), map_editor::new_map_dialog(), play_controller::play_slice(), map_editor::preferences_dialog(), refresh_report(), map_editor::resize_dialog(), screen_area(), scroll_to_tiles(), about::show_about(), preferences::show_hotkeys_dialog(), and gui::show_title().
int display::h | ( | ) | const [inline] |
height
Definition at line 81 of file display.hpp.
References CVideo::gety(), and screen_.
Referenced by map_editor::adjust_sizes(), announce(), bounds_check_position(), draw_background(), game_display::draw_bar(), dialogs::file_dialog::file_dialog(), game_display::footsteps_images(), dialogs::network_connect_dialog(), dialogs::network_data_dialog(), map_editor::new_map_dialog(), play_controller::play_slice(), map_editor::preferences_dialog(), game_display::prune_chat_messages(), map_editor::resize_dialog(), screen_area(), scroll_to_tiles(), about::show_about(), preferences::show_hotkeys_dialog(), and gui::show_title().
const SDL_Rect& display::minimap_area | ( | ) | const [inline] |
Definition at line 82 of file display.hpp.
References theme::mini_map_location(), screen_area(), and theme_.
Referenced by draw_minimap(), and minimap_location_on().
const SDL_Rect& display::unit_image_area | ( | ) | const [inline] |
Definition at line 84 of file display.hpp.
References screen_area(), theme_, and theme::unit_image_location().
SDL_Rect display::screen_area | ( | ) | const [inline] |
Definition at line 87 of file display.hpp.
Referenced by create_buttons(), draw_background(), draw_label(), draw_panel(), editor_display::editor_display(), game_display::float_label(), game_display::game_display(), map_editor::load_tooltips(), map_outside_area(), minimap_area(), play_controller::play_slice(), map_editor::preferences_dialog(), redraw_everything(), refresh_report(), unit_image_area(), and update_display().
const SDL_Rect & display::max_map_area | ( | ) | const |
Returns the maximum area used for the map regardless to resolution and view size.
Definition at line 133 of file display.cpp.
References theme::border(), gamemap::h(), hex_size(), hex_width(), map_, theme_, and gamemap::w().
Referenced by map_area(), map_outside_area(), and screenshot().
const SDL_Rect & display::map_area | ( | ) | const |
Returns the area used for the map.
Definition at line 150 of file display.cpp.
References map_outside_area(), map_screenshot_, and max_map_area().
Referenced by bounds_check_position(), soundsource::positional_source::calculate_volume(), game_display::draw(), draw_minimap(), drawing_buffer_commit(), get_location_x(), get_location_y(), get_rect_hex_bounds(), get_visible_hex_bounds(), hex_clicked_on(), invalidate_all(), invalidate_zone(), pixel_position_to_hex(), render_unit_image(), scroll(), scroll_to_tiles(), scroll_to_xy(), set_zoom(), and tile_on_screen().
const SDL_Rect& display::map_outside_area | ( | ) | const [inline] |
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 106 of file display.hpp.
References theme::main_map_location(), map_screenshot_, max_map_area(), screen_area(), and theme_.
Referenced by game_display::add_chat_message(), map_editor::adjust_sizes(), announce(), create_buttons(), terrain_label::draw(), editor_display::draw(), draw_init(), draw_minimap(), flip(), map_area(), play_controller::play_slice(), unit::redraw_unit(), set_diagnostic(), and gui::floating_textbox::update_location().
bool display::outside_area | ( | const SDL_Rect & | area, | |
const int | x, | |||
const int | y | |||
) | const |
Check if the bbox of the hex at x,y has pixels outside the area rectangle.
Definition at line 178 of file display.cpp.
References hex_size().
Referenced by scroll_to_tiles(), and tile_on_screen().
int display::hex_width | ( | ) | const [inline] |
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 116 of file display.hpp.
References zoom_.
Referenced by bounds_check_position(), draw_minimap(), get_location_x(), get_rect_hex_bounds(), max_map_area(), minimap_location_on(), and pixel_position_to_hex().
int display::hex_size | ( | ) | const [inline] |
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 120 of file display.hpp.
References zoom_.
Referenced by game_display::add_overlay(), draw_minimap(), draw_text_in_hex(), unit_frame::invalidate(), max_map_area(), minimap_location_on(), outside_area(), pixel_position_to_hex(), unit_frame::redraw(), unit::redraw_unit(), and scroll_to_tiles().
double display::get_zoom_factor | ( | ) | [inline] |
Returns the current zoom factor.
Definition at line 123 of file display.hpp.
References image::tile_size, and zoom_.
Referenced by game_display::draw_bar(), draw_text_in_hex(), unit::overlaps(), unit_frame::redraw(), and unit::redraw_unit().
const gamemap::location display::hex_clicked_on | ( | int | x, | |
int | y, | |||
gamemap::location::DIRECTION * | nearest_hex = NULL , |
|||
gamemap::location::DIRECTION * | second_nearest_hex = NULL | |||
) | const |
Definition at line 187 of file display.cpp.
References map_area(), pixel_position_to_hex(), point_in_rect(), rect, xpos_, and ypos_.
Referenced by soundsource::positional_source::calculate_volume().
const gamemap::location display::pixel_position_to_hex | ( | int | x, | |
int | y, | |||
gamemap::location::DIRECTION * | nearest_hex = NULL , |
|||
gamemap::location::DIRECTION * | second_nearest_hex = NULL | |||
) | const |
Definition at line 204 of file display.cpp.
References theme::border(), get_location_x(), get_location_y(), hex_size(), hex_width(), map_area(), gamemap::location::NORTH, gamemap::location::NORTH_EAST, gamemap::location::NORTH_WEST, gamemap::location::SOUTH, gamemap::location::SOUTH_EAST, gamemap::location::SOUTH_WEST, theme_, xpos_, and ypos_.
Referenced by hex_clicked_on(), invalidate_zone(), and minimap_location_on().
gamemap::location display::minimap_location_on | ( | int | x, | |
int | y | |||
) |
Definition at line 381 of file display.cpp.
References gamemap::h(), hex_size(), hex_width(), loc, map_, minimap_area(), minimap_location_, pixel_position_to_hex(), point_in_rect(), gamemap::w(), gamemap::location::x, and gamemap::location::y.
Referenced by events::mouse_handler::left_click(), and events::mouse_handler::mouse_press().
const gamemap::location& display::selected_hex | ( | ) | [inline] |
Definition at line 144 of file display.hpp.
References selectedHex_.
Referenced by unit::overlaps(), unit::redraw_unit(), and events::menu_handler::unit_list().
const gamemap::location& display::mouseover_hex | ( | ) | [inline] |
Definition at line 145 of file display.hpp.
References mouseoverHex_.
Referenced by unit::redraw_unit(), and unit_display::unit_recruited().
void display::select_hex | ( | gamemap::location | hex | ) | [virtual] |
Reimplemented in game_display.
Definition at line 1035 of file display.cpp.
References invalidate(), and selectedHex_.
Referenced by game_display::select_hex().
void display::highlight_hex | ( | gamemap::location | hex | ) | [virtual] |
Reimplemented in game_display.
Definition at line 1042 of file display.cpp.
References invalidate(), and mouseoverHex_.
Referenced by game_display::highlight_hex().
void display::invalidate_game_status | ( | ) | [inline] |
Function to invalidate the game status displayed on the sidebar.
Definition at line 151 of file display.hpp.
References invalidateGameStatus_.
Referenced by apply_shroud_changes(), do_replay_handle(), game_display::highlight_hex(), map_editor::terrain_palette::left_mouse_click(), events::menu_handler::move_unit_to_loc(), playsingle_controller::play_ai_turn(), replay_controller::play_turn(), playsingle_controller::play_turn(), events::menu_handler::recall(), events::menu_handler::redo(), replay_controller::reset_replay(), map_editor::terrain_palette::right_mouse_click(), game_display::set_playing_team(), and events::menu_handler::undo().
void display::get_rect_hex_bounds | ( | SDL_Rect | rect, | |
gamemap::location & | topleft, | |||
gamemap::location & | bottomright | |||
) | const |
Definition at line 329 of file display.cpp.
References theme::border(), gamemap::h(), hex_width(), is_odd(), map_, map_area(), theme_, gamemap::w(), gamemap::location::x, xpos_, gamemap::location::y, ypos_, and zoom_.
Referenced by get_visible_hex_bounds(), and invalidate_locations_in_rect().
int display::get_location_x | ( | const gamemap::location & | loc | ) | const |
Functions to get the on-screen positions of hexes.
Definition at line 371 of file display.cpp.
References theme::border(), hex_width(), map_area(), theme_, gamemap::location::x, and xpos_.
Referenced by game_display::add_overlay(), terrain_label::draw(), game_display::draw(), editor_display::draw(), game_display::draw_movement_info(), draw_text_in_hex(), game_display::float_label(), unit_frame::invalidate(), pixel_position_to_hex(), unit_frame::redraw(), unit::redraw_unit(), scroll_to_tiles(), and tile_on_screen().
int display::get_location_y | ( | const gamemap::location & | loc | ) | const |
Definition at line 376 of file display.cpp.
References theme::border(), is_odd(), map_area(), theme_, gamemap::location::x, gamemap::location::y, ypos_, and zoom_.
Referenced by game_display::add_overlay(), terrain_label::draw(), game_display::draw(), editor_display::draw(), game_display::draw_movement_info(), draw_text_in_hex(), game_display::float_label(), unit_frame::invalidate(), pixel_position_to_hex(), unit_frame::redraw(), unit::redraw_unit(), scroll_to_tiles(), and tile_on_screen().
bool display::shrouded | ( | const gamemap::location & | loc | ) | const [inline] |
Returns true if location (x,y) is covered in shroud.
Definition at line 160 of file display.hpp.
References viewpoint::shrouded(), and viewpoint_.
Referenced by playsingle_controller::can_execute_command(), events::menu_handler::do_search(), game_display::draw(), game_display::draw_report(), get_fog_shroud_graphics(), game_display::invalidate_animations(), is_shrouded(), and soundsource::positional_source::update_positions().
bool display::fogged | ( | const gamemap::location & | loc | ) | const [inline] |
Returns true if location (x,y) is covered in fog.
Definition at line 163 of file display.hpp.
References viewpoint::fogged(), and viewpoint_.
Referenced by events::menu_handler::do_search(), game_display::draw(), game_display::draw_minimap_units(), game_display::draw_report(), play_controller::enemies_visible(), game_display::float_label(), game_display::get_flag(), get_fog_shroud_graphics(), game_display::invalidate_animations(), move_unit_between(), unit::redraw_unit(), scroll_to_tiles(), game_display::select_hex(), events::menu_handler::show_enemy_moves(), teleport_unit_between(), unit_display::unit_attack(), unit_display::unit_die(), unit_display::unit_healing(), events::mouse_handler::unit_in_cycle(), unit_display::unit_recruited(), and soundsource::positional_source::update_positions().
void display::set_grid | ( | const bool | grid | ) | [inline] |
Determines whether a grid should be overlayed on the game board.
(to more clearly show where hexes are)
Definition at line 168 of file display.hpp.
References grid_.
Referenced by preferences::set_grid().
void display::get_visible_hex_bounds | ( | gamemap::location & | topleft, | |
gamemap::location & | bottomright | |||
) | const |
Returns the locations of 2 hexes that bind the visible area of the map.
Definition at line 411 of file display.cpp.
References get_rect_hex_bounds(), map_area(), and r.
Referenced by draw_init(), game_display::invalidate_animations(), and game_display::process_reachmap_changes().
int display::screenshot | ( | std::string | filename, | |
bool | map_screenshot = false | |||
) |
Save a (map-)screenshot and return the estimated file size.
Definition at line 417 of file display.cpp.
References create_compatible_surface(), DBG_DP, draw(), gamemap::empty(), CVideo::getSurface(), invalidateAll_, map_, map_screenshot_, map_screenshot_surf_, max_map_area(), redraw_everything(), screen_, size, xpos_, and ypos_.
Referenced by hotkey::execute_command().
void display::redraw_everything | ( | ) |
Invalidates entire screen, including all tiles and sidebar.
Definition at line 1794 of file display.cpp.
References surface::assign(), bounds_check_position(), buttons_, tooltips::clear_tooltips(), create_buttons(), draw(), empty_rect, invalidate_all(), invalidateGameStatus_, map_labels_, reports::NUM_REPORTS, panelsDrawn_, map_labels::recalculate_labels(), redraw_background_, reportRects_, reports_, reportSurfaces_, screen_, screen_area(), theme::set_resolution(), theme_, and CVideo::update_locked().
Referenced by events::console_handler::do_event(), events::console_handler::do_fog(), events::console_handler::do_gold(), events::console_handler::do_refresh(), events::console_handler::do_shroud(), playsingle_controller::linger(), events::menu_handler::preferences(), playmp_controller::reset_end_scenario_button(), screenshot(), playmp_controller::set_end_scenario_button(), preferences::set_fullscreen(), and preferences::set_resolution().
theme& display::get_theme | ( | ) | [inline] |
Definition at line 180 of file display.hpp.
References theme_.
Referenced by play_controller::handle_event(), replay_controller::init_replay_display(), playsingle_controller::linger(), events::mouse_handler::mouse_press(), replay_controller::rebuild_replay_theme(), playmp_controller::reset_end_scenario_button(), playmp_controller::set_end_scenario_button(), preferences::show_theme_dialog(), and replay_controller::~replay_controller().
gui::button * display::find_button | ( | const std::string & | id | ) |
Definition at line 473 of file display.cpp.
References buttons_.
Referenced by create_buttons(), playmp_controller::handle_generic_event(), replay_controller::play_replay(), turn_info::process_network_data(), replay_controller::replay_next_side(), replay_controller::replay_next_turn(), replay_controller::reset_replay(), playmp_controller::set_end_scenario_button(), and replay_controller::stop_replay().
gui::button::TYPE display::string_to_button_type | ( | std::string | type | ) |
Definition at line 512 of file display.cpp.
References gui::button::TYPE_CHECK, gui::button::TYPE_IMAGE, and gui::button::TYPE_PRESS.
Referenced by create_buttons().
void display::create_buttons | ( | ) |
Definition at line 483 of file display.cpp.
References tooltips::add_tooltip(), b, buttons_, DBG_DP, gui::widget::enabled(), find_button(), loc, gamemap::location::location(), map_outside_area(), theme::menus(), rects_overlap(), screen_, screen_area(), string_to_button_type(), and theme_.
Referenced by game_display::begin_game(), draw_all_panels(), and redraw_everything().
void display::invalidate_theme | ( | ) | [inline] |
Definition at line 184 of file display.hpp.
References panelsDrawn_.
Referenced by playmp_controller::handle_generic_event(), playsingle_controller::linger(), replay_controller::rebuild_replay_theme(), playmp_controller::reset_end_scenario_button(), and playmp_controller::set_end_scenario_button().
void display::refresh_report | ( | reports::TYPE | report_num, | |
reports::report | report, | |||
bool | brightened = false | |||
) |
Definition at line 1864 of file display.cpp.
References tooltips::add_tooltip(), surface::assign(), tooltips::clear_tooltips(), draw_image_for_report(), font::draw_text(), game_config::ellipsis_image, ERR_DP, theme::status_item::font_rgb(), theme::status_item::font_rgb_set(), theme::status_item::font_size(), image::get_image(), theme::get_status_item(), get_surface_portion(), CVideo::getSurface(), theme::object::location(), font::NORMAL_COLOUR, theme::status_item::postfix(), theme::status_item::prefix(), rect, reports::report_name(), reportRects_, reports_, reportSurfaces_, screen_, screen_area(), theme_, game_config::tod_bright_image, update_rect(), and w().
Referenced by editor_display::draw(), and game_display::draw_report().
virtual void display::invalidate | ( | const gamemap::location & | loc | ) | [inline, virtual] |
Reimplemented in game_display.
Definition at line 190 of file display.hpp.
References invalidated_.
Referenced by add_highlighted_loc(), clear_highlighted_locs(), highlight_hex(), invalidate_locations_in_rect(), invalidate_rectangle(), remove_highlighted_loc(), and select_hex().
void display::invalidate_rectangle | ( | const gamemap::location & | first_corner, | |
const gamemap::location & | second_corner | |||
) | [virtual] |
Definition at line 2024 of file display.cpp.
References invalidate(), gamemap::location::x, and gamemap::location::y.
Referenced by invalidate_zone().
void display::invalidate_zone | ( | const int | x1, | |
const int | y1, | |||
const int | x2, | |||
const int | y2 | |||
) | [virtual] |
Definition at line 2033 of file display.cpp.
References invalidate_rectangle(), map_area(), pixel_position_to_hex(), and rect.
Referenced by unit_frame::invalidate().
virtual void display::draw_minimap_units | ( | ) | [inline, virtual] |
Reimplemented in game_display.
Definition at line 193 of file display.hpp.
Referenced by draw_minimap().
const gamemap& display::get_map | ( | ) | const [inline] |
Definition at line 195 of file display.hpp.
References map_.
Referenced by unit_animation::matches(), unit::overlaps(), and unit::redraw_unit().
void display::set_hex_overlay | ( | const gamemap::location & | loc, | |
surface | image | |||
) | [inline] |
void display::clear_hex_overlay | ( | const gamemap::location & | loc | ) |
void display::set_selected_hex_overlay | ( | const surface & | image | ) | [inline] |
void display::clear_selected_hex_overlay | ( | ) | [inline] |
void display::set_mouseover_hex_overlay | ( | const surface & | image | ) | [inline] |
void display::clear_mouseover_hex_overlay | ( | ) | [inline] |
Definition at line 212 of file display.hpp.
References mouseover_hex_overlay_.
Referenced by map_editor::map_editor::reset_mouseover_overlay().
void display::sunset | ( | const size_t | delay = 0 |
) |
Debug function to toggle the "sunset" mode.
The map area become progressively darker, except where hexes are refreshed. delay is the number of frames between each darkening (0 to toggle).
Definition at line 731 of file display.cpp.
References sunset_delay.
Referenced by events::console_handler::do_sunset().
void display::toggle_benchmark | ( | ) |
Toogle to continuously redraw the screen.
Definition at line 737 of file display.cpp.
References benchmark.
Referenced by events::console_handler::do_benchmark().
void display::flip | ( | ) |
Definition at line 742 of file display.cpp.
References cursor::draw(), font::draw_floating_labels(), fill_rect_alpha(), CVideo::flip(), frameBuffer, get_video_surface(), map_outside_area(), r, events::raise_volatile_draw_event(), events::raise_volatile_undraw_event(), sunset_delay, sunset_timer, cursor::undraw(), font::undraw_floating_labels(), update_rect(), and video().
Referenced by gui::dialog::draw_contents(), dialogs::network_connect_dialog(), dialogs::network_data_dialog(), gui::dialog::refresh(), run_lobby_loop(), about::show_about(), help::show_help(), preferences::show_hotkeys_dialog(), show_intro_part(), show_intro_part_helper(), gui::show_title(), the_end(), and update_display().
void display::update_display | ( | ) |
Copy the backbuffer to the framebuffer.
Definition at line 771 of file display.cpp.
References font::add_floating_label(), font::BAD_COLOUR, benchmark, flip(), fps, fps_handle_, font::LEFT_ALIGN, font::NORMAL_COLOUR, font::remove_floating_label(), screen_, screen_area(), preferences::show_fps(), stream, and CVideo::update_locked().
Referenced by draw_wrap(), fade_logo(), map_editor::new_map_dialog(), map_editor::preferences_dialog(), map_editor::resize_dialog(), preferences::show_hotkeys_dialog(), teleport_unit_between(), and default_map_generator::user_config().
void display::rebuild_all | ( | ) | [inline] |
Rebuild all dynamic terrain.
Definition at line 230 of file display.hpp.
References builder_, and terrain_builder::rebuild_all().
Referenced by process_event().
void display::render_unit_image | ( | int | x, | |
int | y, | |||
const bool | fake_unit, | |||
const int | drawing_order, | |||
surface | image, | |||
bool | hreverse = false , |
|||
bool | greyscale = false , |
|||
fixed_t | alpha = ftofxp(1.0) , |
|||
Uint32 | blendto = 0 , |
|||
double | blend_ratio = 0 , |
|||
double | submerged = 0.0 , |
|||
bool | vreverse = false | |||
) |
Draw the image of a unit at a certain location.
x,y: pixel location on screen to draw the unit image: the image of the unit reverse: if the unit should be flipped across the x axis greyscale: used when the unit is stoned alpha: the merging to use with the background blendto: blend to this colour using blend_ratio submerged: the amount of the unit out of 1.0 that is submerged (presumably under water) and thus shouldn't be drawn
Definition at line 971 of file display.cpp.
References adjust_surface_alpha(), surface::assign(), blend_surface(), brighten_image(), drawing_buffer_add(), ERR_DP, flop_surface(), ftofxp, greyscale_image(), LAYER_UNIT_FIRST, map_area(), rects_overlap(), and image::reverse_image().
Referenced by unit_frame::redraw(), and unit::redraw_unit().
const theme::menu * display::menu_pressed | ( | ) |
Definition at line 1165 of file display.cpp.
References buttons_, theme::menus(), and theme_.
Referenced by play_controller::play_slice().
void display::enable_menu | ( | const std::string & | item, | |
bool | enable | |||
) |
Finds the menu which has a given item in it, and enables or disables it.
Definition at line 1182 of file display.cpp.
References buttons_, theme::menus(), and theme_.
Referenced by playsingle_controller::linger(), playsingle_controller::play_ai_turn(), playsingle_controller::play_human_turn(), playmp_controller::play_human_turn(), and playmp_controller::play_network_turn().
void display::set_diagnostic | ( | const std::string & | msg | ) |
Definition at line 1061 of file display.cpp.
References font::add_floating_label(), diagnostic_label_, map_outside_area(), font::remove_floating_label(), font::SIZE_PLUS, and font::YELLOW_COLOUR.
Referenced by ai_interface::diagnostic().
void display::delay | ( | unsigned int | milliseconds | ) | const |
Delay routines: use these instead of SDL_Delay (for --nogui).
Definition at line 1159 of file display.cpp.
References game_config::no_delay.
Referenced by fade_logo(), playsingle_controller::play_ai_turn(), play_controller::play_slice(), gui::dialog::refresh(), run_lobby_loop(), about::show_about(), help::show_help(), preferences::show_hotkeys_dialog(), show_intro_part(), show_intro_part_helper(), gui::show_title(), the_end(), default_map_generator::user_config(), unit_animator::wait_for_end(), and unit_animator::wait_until().
void display::set_turbo | ( | const bool | turbo | ) | [inline] |
Set/Get whether 'turbo' mode is on.
When turbo mode is on, everything moves much faster.
Definition at line 260 of file display.hpp.
References turbo_.
Referenced by preferences::set_turbo().
double display::turbo_speed | ( | ) | const |
Definition at line 1775 of file display.cpp.
References CVideo::faked(), keys_, screen_, turbo_, and turbo_speed_.
Referenced by game_display::float_label(), game_display::new_turn(), scroll_to_xy(), unit_animation::update_last_draw_time(), and unit_animator::wait_until().
void display::set_turbo_speed | ( | const double | speed | ) | [inline] |
Definition at line 264 of file display.hpp.
References turbo_speed_.
Referenced by preferences::set_turbo_speed().
void display::set_idle_anim | ( | bool | ison | ) | [inline] |
Definition at line 267 of file display.hpp.
References idle_anim_.
Referenced by preferences::set_idle_anim().
bool display::idle_anim | ( | ) | const [inline] |
Definition at line 268 of file display.hpp.
References idle_anim_.
Referenced by unit::start_animation().
void display::set_idle_anim_rate | ( | int | rate | ) |
Definition at line 1789 of file display.cpp.
References idle_anim_rate_.
Referenced by display(), and preferences::set_idle_anim_rate().
double display::idle_anim_rate | ( | ) | const [inline] |
Definition at line 270 of file display.hpp.
References idle_anim_rate_.
Referenced by unit::start_animation().
void display::add_highlighted_loc | ( | const gamemap::location & | hex | ) |
Add a location to highlight.
Note that this has nothing to do with selecting hexes, it is pure highlighting. These hexes will be highlighted slightly darker than the currently selected hex.
Definition at line 1201 of file display.cpp.
References highlighted_locations_, and invalidate().
void display::clear_highlighted_locs | ( | ) |
void display::remove_highlighted_loc | ( | const gamemap::location & | hex | ) |
void display::bounds_check_position | ( | ) |
Definition at line 1723 of file display.cpp.
References MaxZoom, MinZoom, image::set_zoom(), xpos_, ypos_, and zoom_.
Referenced by redraw_everything(), scroll(), scroll_to_xy(), and set_zoom().
void display::bounds_check_position | ( | int & | xpos, | |
int & | ypos | |||
) |
Definition at line 1742 of file display.cpp.
References theme::border(), h(), gamemap::h(), hex_width(), map_, map_area(), theme_, gamemap::w(), and zoom_.
void display::invalidate_all | ( | ) |
Function to invalidate all tiles.
Definition at line 1767 of file display.cpp.
References DBG_DP, invalidateAll_, invalidated_, map_area(), and update_rect().
Referenced by dialogs::animate_unit_advancement(), apply_shroud_changes(), attack::attack(), playsingle_controller::before_human_turn(), game_display::begin_game(), check_victory(), gui::floating_textbox::close(), do_replay_handle(), gui::dialog::draw_contents(), play_controller::finish_side_turn(), play_controller::init_side(), events::mouse_handler::left_click(), playmp_controller::linger(), move_unit(), game_display::new_turn(), playsingle_controller::play_ai_turn(), playsingle_controller::play_side(), playmp_controller::play_side(), process_event(), events::menu_handler::recall(), redraw_everything(), game_display::set_game_mode(), set_zoom(), help::show_help(), events::menu_handler::toggle_grid(), and replay_controller::update_teams().
void display::scroll | ( | int | xmov, | |
int | ymov | |||
) |
Scrolls the display by xmov,ymov pixels.
Invalidation and redrawing will be scheduled.
Definition at line 1386 of file display.cpp.
References _scroll_event, bounds_check_position(), CVideo::getSurface(), intersect_rects(), invalidate_locations_in_rect(), map_area(), map_labels_, events::generic_event::notify_observers(), r, redrawMinimap_, screen, screen_, map_labels::scroll(), font::scroll_floating_labels(), update_rect(), xpos_, and ypos_.
Referenced by events::mouse_handler::mouse_press(), play_controller::play_slice(), and scroll_to_xy().
void display::set_zoom | ( | int | amount | ) |
Zooms the display by the specified amount.
Negative values zoom out. Note the amount should be a multiple of four, otherwise the images might start to look odd (hex_width() gets rounding errors).
Definition at line 1439 of file display.cpp.
References bounds_check_position(), draw(), invalidate_all(), map_area(), map_labels_, MaxZoom, MinZoom, map_labels::recalculate_labels(), redraw_background_, image::set_zoom(), xpos_, ypos_, and zoom_.
Referenced by hotkey::execute_command(), and set_default_zoom().
void display::set_default_zoom | ( | ) |
Sets the zoom amount to the default.
Definition at line 1466 of file display.cpp.
References DefaultZoom, last_zoom_, set_zoom(), and zoom_.
Referenced by hotkey::execute_command().
void display::scroll_to_tile | ( | const gamemap::location & | loc, | |
SCROLL_TYPE | scroll_type = ONSCREEN , |
|||
bool | check_fogged = 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
Definition at line 1568 of file display.cpp.
References ERR_DP, map_, gamemap::on_board(), and scroll_to_tiles().
Referenced by events::mouse_handler::cycle_units(), events::menu_handler::do_search(), events::menu_handler::goto_leader(), playsingle_controller::init_gui(), events::mouse_handler::left_click(), events::mouse_handler::mouse_press(), game_display::scroll_to_leader(), unit_display::unit_healing(), events::menu_handler::unit_list(), and unit_display::unit_recruited().
void display::scroll_to_tiles | ( | gamemap::location | loc1, | |
gamemap::location | loc2, | |||
SCROLL_TYPE | scroll_type = ONSCREEN , |
|||
bool | check_fogged = true , |
|||
double | add_spacing = 0.0 | |||
) |
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 1580 of file display.cpp.
Referenced by unit_display::move_unit(), move_unit_between(), scroll_to_tile(), teleport_unit_between(), and unit_display::unit_attack().
void display::scroll_to_tiles | ( | const std::vector< gamemap::location > & | locs, | |
SCROLL_TYPE | scroll_type = ONSCREEN , |
|||
bool | check_fogged = true , |
|||
bool | only_if_possible = false , |
|||
double | add_spacing = 0.0 | |||
) |
Scroll to fit as many locations on-screen as possible, starting with the first.
Definition at line 1590 of file display.cpp.
References ERR_DP, fogged(), get_location_x(), get_location_y(), h(), hex_size(), map_, map_area(), gamemap::on_board(), ONSCREEN, outside_area(), r, round_double(), scroll_to_xy(), and w().
events::generic_event& display::scroll_event | ( | ) | const [inline] |
Expose the event, so observers can be notified about map scrolling.
Definition at line 324 of file display.hpp.
References _scroll_event.
Referenced by soundsource::manager::manager().
bool display::tile_on_screen | ( | const gamemap::location & | loc | ) |
Check if a tile is fully on screen.
Definition at line 1479 of file display.cpp.
References get_location_x(), get_location_y(), map_area(), and outside_area().
Referenced by unit_display::move_unit().
virtual void display::draw | ( | bool | update = true , |
|
bool | force = false | |||
) | [pure virtual] |
Draws invalidated items.
If update is true, will also copy the display to the frame buffer. If force is true, will not skip frames, even if running behind.
Implemented in editor_display, and game_display.
Referenced by redraw_everything(), screenshot(), scroll_to_xy(), and set_zoom().
map_labels& display::labels | ( | ) | [inline] |
Definition at line 334 of file display.hpp.
References map_labels_.
Referenced by events::menu_handler::clear_labels(), clear_shroud(), do_replay_handle(), events::menu_handler::do_search(), draw_all_panels(), events::menu_handler::label_terrain(), playsingle_controller::play_scenario(), game_display::set_team(), and events::menu_handler::write_game_snapshot().
const map_labels& display::labels | ( | ) | const [inline] |
void display::announce | ( | const std::string | msg, | |
const SDL_Color & | colour = font::GOOD_COLOUR | |||
) |
Announce a message prominently.
Definition at line 1230 of file display.cpp.
References font::add_floating_label(), font::CENTER_ALIGN, h(), map_outside_area(), font::SIZE_XLARGE, and w().
Referenced by move_unit().
void display::recalculate_minimap | ( | ) | [inline] |
Schedule the minimap for recalculation.
Useful if any terrain in the map has changed.
Definition at line 343 of file display.hpp.
References minimap_, and redrawMinimap_.
Referenced by apply_shroud_changes(), attack::attack(), playsingle_controller::before_human_turn(), events::console_handler::do_fog(), do_replay(), do_replay_handle(), events::console_handler::do_shroud(), play_controller::finish_side_turn(), attack::fire_event(), events::mouse_handler::left_click(), playmp_controller::linger(), move_unit(), playsingle_controller::play_ai_turn(), playsingle_controller::play_scenario(), playsingle_controller::play_side(), playmp_controller::play_side(), process_event(), and events::menu_handler::undo().
void display::redraw_minimap | ( | ) | [inline] |
Schedule the minimap to be redrawn.
Useful if units have moved about on the map.
Definition at line 347 of file display.hpp.
References redrawMinimap_.
Referenced by events::menu_handler::undo().
void display::set_report_content | ( | const reports::TYPE | which_report, | |
const std::string & | content | |||
) |
Set what will be shown for the report with type which_report.
Note that this only works for some reports, i.e. reports that can not be deducted from the supplied arguments to generate_report, currently: SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION
Definition at line 1860 of file display.cpp.
References report_.
Referenced by map_editor::terrain_palette::update_report().
std::map<reports::TYPE, std::string> display::get_report_contents | ( | ) | [inline] |
void display::draw_border | ( | const gamemap::location & | loc, | |
const int | xpos, | |||
const int | ypos | |||
) | [protected, virtual] |
Draws the border tile overlay.
The routine determines by itself which border it is on and draws an overlay accordingly. The definition of the border is stored in the 'main_map_border' part of the theme.
loc | the map location of the tile | |
xpos | the on-screen pixels x coordinate of the tile | |
ypos | the on-screen pixels y coordinate of the tile |
at the moment the border must be between 0.0 and 0.5 and the image should always be prepared for a 0.5 border. This way this code doesn't need modifications for other border sizes.
Definition at line 1242 of file display.cpp.
References theme::border(), image::get_image(), get_screen_surface(), gamemap::h(), map_, rect, image::SCALED_TO_ZOOM, screen, theme_, gamemap::w(), gamemap::location::x, gamemap::location::y, and zoom_.
Referenced by game_display::draw(), and editor_display::draw().
void display::draw_minimap | ( | ) | [protected] |
Definition at line 1336 of file display.cpp.
References theme::border(), draw_centered_on_background(), draw_minimap_units(), draw_rectangle(), image::getMinimap(), CVideo::getSurface(), gamemap::h(), hex_size(), hex_width(), map_, map_area(), map_outside_area(), minimap_, minimap_area(), minimap_location_, screen, screen_, shift_x, shift_y, theme_, viewpoint_, gamemap::w(), xpos_, and ypos_.
Referenced by draw_wrap().
std::vector< surface > display::get_terrain_images | ( | const gamemap::location & | loc, | |
const std::string | timeid, | |||
image::TYPE | type, | |||
ADJACENT_TERRAIN_TYPE | terrain_type | |||
) | [protected] |
Definition at line 601 of file display.cpp.
References terrain_builder::ADJACENT_BACKGROUND, ADJACENT_FOGSHROUD, terrain_builder::ADJACENT_FOREGROUND, ADJACENT_FOREGROUND, preferences::animate_map(), theme::border(), builder_, image::locator::get_filename(), get_fog_shroud_graphics(), image::get_image(), terrain_builder::get_terrain_at(), surface::null(), theme_, and image::UNMASKED.
Referenced by game_display::draw(), and editor_display::draw().
std::vector< std::string > display::get_fog_shroud_graphics | ( | const gamemap::location & | loc | ) | [protected] |
Definition at line 526 of file display.cpp.
References image::exists(), fogged(), t_translation::FOGGED, get_adjacent_tiles(), get_direction(), gamemap::get_terrain_info(), map_, terrain_type::minimap_image(), name, t_translation::NONE_TERRAIN, shrouded(), stream, and t_translation::VOID_TERRAIN.
Referenced by get_terrain_images().
void display::draw_image_for_report | ( | surface & | img, | |
SDL_Rect & | rect | |||
) | [protected] |
Definition at line 1827 of file display.cpp.
References surface::assign(), get_non_transparent_portion(), get_surface_portion(), CVideo::getSurface(), scale_surface(), and screen_.
Referenced by refresh_report().
void display::scroll_to_xy | ( | int | screenxpos, | |
int | screenypos, | |||
SCROLL_TYPE | scroll_type | |||
) | [protected] |
Definition at line 1486 of file display.cpp.
References bounds_check_position(), draw(), map_area(), events::pump(), round_double(), screen_, scroll(), preferences::scroll_speed(), turbo_speed(), CVideo::update_locked(), WARP, xpos_, and ypos_.
Referenced by scroll_to_tiles().
void display::draw_text_in_hex | ( | const gamemap::location & | loc, | |
const tdrawing_layer | layer, | |||
const std::string & | text, | |||
size_t | font_size, | |||
SDL_Color | 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 and divided by 2 for tiny-gui.
Definition at line 930 of file display.cpp.
References font::BLACK_COLOUR, drawing_buffer_add(), gamemap::get_drawing_order(), get_location_x(), get_location_y(), font::get_rendered_text(), get_zoom_factor(), and hex_size().
Referenced by game_display::draw_movement_info().
void display::drawing_buffer_add | ( | const tdrawing_layer | layer, | |
const int | drawing_order, | |||
const tblit & | blit | |||
) | [inline] |
Add an item to the drawing buffer.
layer | The layer to draw on. | |
drawing_order | The order in which to draw, needed for units. | |
blit | The structure to blit. |
Definition at line 533 of file display.hpp.
References drawing_buffer_.
Referenced by game_display::draw(), editor_display::draw(), game_display::draw_bar(), game_display::draw_movement_info(), draw_text_in_hex(), unit::redraw_unit(), and render_unit_image().
void display::drawing_buffer_commit | ( | ) | [protected] |
Draws the drawing_buffer_ and clears it.
Definition at line 661 of file display.cpp.
References drawing_buffer_, drawing_buffer_clear(), get_screen_surface(), map, map_area(), update_rect(), and zoom_.
Referenced by game_display::draw(), and editor_display::draw().
void display::drawing_buffer_clear | ( | ) | [protected] |
Clears the drawing buffer.
Definition at line 715 of file display.cpp.
References drawing_buffer_.
Referenced by drawing_buffer_commit().
void display::draw_all_panels | ( | ) | [protected] |
redraw all panels associated with the map display
Definition at line 893 of file display.cpp.
References buttons_, create_buttons(), draw_label(), draw_panel(), CVideo::getSurface(), theme::labels(), labels(), theme::panels(), screen, screen_, theme_, and video().
Referenced by draw_init().
void display::invalidate_locations_in_rect | ( | SDL_Rect | r | ) | [protected] |
Definition at line 1049 of file display.cpp.
References get_rect_hex_bounds(), invalidate(), loc, gamemap::location::x, and gamemap::location::y.
Referenced by scroll().
bool display::draw_init | ( | ) | [protected] |
Invalidate controls and panels when changed after they have been drawn initially.
Initiate a redraw.
Useful for dynamic theme modification.
May require redrawing panels and background.
Definition at line 1075 of file display.cpp.
References benchmark, theme::border(), DBG_DP, draw_all_panels(), draw_background(), gamemap::empty(), get_screen_surface(), get_visible_hex_bounds(), invalidateAll_, invalidated_, map_, map_outside_area(), panelsDrawn_, redraw_background_, redrawMinimap_, screen, theme_, update_rect(), gamemap::location::x, and gamemap::location::y.
Referenced by game_display::draw(), and editor_display::draw().
void display::draw_wrap | ( | bool | update, | |
bool | force, | |||
bool | changed | |||
) | [protected] |
Definition at line 1124 of file display.cpp.
References preferences::draw_delay(), draw_minimap(), nextDraw_, redrawMinimap_, and update_display().
Referenced by game_display::draw(), and editor_display::draw().
CVideo& display::screen_ [protected] |
Definition at line 387 of file display.hpp.
Referenced by create_buttons(), display(), game_display::draw(), editor_display::draw(), draw_all_panels(), draw_image_for_report(), draw_minimap(), editor_display::editor_display(), game_display::game_display(), get_screen_surface(), h(), redraw_everything(), refresh_report(), screenshot(), scroll(), scroll_to_xy(), turbo_speed(), update_display(), video(), and w().
const gamemap& display::map_ [protected] |
Definition at line 388 of file display.hpp.
Referenced by bounds_check_position(), game_display::display_unit_hex(), game_display::draw(), editor_display::draw(), draw_border(), draw_init(), draw_minimap(), game_display::draw_minimap_units(), game_display::draw_movement_info(), game_display::draw_report(), game_display::draw_sidebar(), game_display::footsteps_images(), game_display::get_flag(), get_fog_shroud_graphics(), get_map(), get_rect_hex_bounds(), game_display::highlight_hex(), game_display::invalidate_animations(), max_map_area(), minimap_location_on(), screenshot(), scroll_to_tile(), and scroll_to_tiles().
const viewpoint* display::viewpoint_ [protected] |
Definition at line 389 of file display.hpp.
Referenced by draw_minimap(), fogged(), game_display::set_team(), and shrouded().
int display::xpos_ [protected] |
Definition at line 390 of file display.hpp.
Referenced by bounds_check_position(), draw_minimap(), get_location_x(), get_rect_hex_bounds(), hex_clicked_on(), pixel_position_to_hex(), screenshot(), scroll(), scroll_to_xy(), and set_zoom().
int display::ypos_ [protected] |
Definition at line 390 of file display.hpp.
Referenced by bounds_check_position(), draw_minimap(), get_location_y(), get_rect_hex_bounds(), hex_clicked_on(), pixel_position_to_hex(), screenshot(), scroll(), scroll_to_xy(), and set_zoom().
theme display::theme_ [protected] |
Definition at line 391 of file display.hpp.
Referenced by bounds_check_position(), create_buttons(), draw_all_panels(), draw_border(), draw_init(), draw_minimap(), enable_menu(), get_location_x(), get_location_y(), get_rect_hex_bounds(), get_terrain_images(), get_theme(), map_outside_area(), max_map_area(), menu_pressed(), minimap_area(), pixel_position_to_hex(), redraw_everything(), refresh_report(), and unit_image_area().
int display::zoom_ [protected] |
Definition at line 392 of file display.hpp.
Referenced by bounds_check_position(), display(), game_display::draw(), editor_display::draw(), draw_border(), drawing_buffer_commit(), game_display::float_label(), get_location_y(), get_rect_hex_bounds(), get_zoom_factor(), hex_size(), hex_width(), set_default_zoom(), and set_zoom().
int display::last_zoom_ [protected] |
terrain_builder display::builder_ [protected] |
Definition at line 394 of file display.hpp.
Referenced by get_terrain_images(), game_display::invalidate_animations(), rebuild_all(), and editor_display::rebuild_terrain().
surface display::minimap_ [protected] |
Definition at line 395 of file display.hpp.
Referenced by draw_minimap(), and recalculate_minimap().
SDL_Rect display::minimap_location_ [protected] |
Definition at line 396 of file display.hpp.
Referenced by draw_minimap(), game_display::draw_minimap_units(), and minimap_location_on().
bool display::redrawMinimap_ [protected] |
Definition at line 397 of file display.hpp.
Referenced by draw_init(), draw_wrap(), recalculate_minimap(), redraw_minimap(), and scroll().
bool display::redraw_background_ [protected] |
Definition at line 398 of file display.hpp.
Referenced by draw_init(), redraw_everything(), and set_zoom().
bool display::invalidateAll_ [protected] |
Definition at line 399 of file display.hpp.
Referenced by draw_init(), game_display::invalidate(), invalidate_all(), and screenshot().
bool display::grid_ [protected] |
Definition at line 400 of file display.hpp.
Referenced by game_display::draw(), editor_display::draw(), and set_grid().
int display::diagnostic_label_ [protected] |
bool display::panelsDrawn_ [protected] |
Definition at line 402 of file display.hpp.
Referenced by draw_init(), invalidate_theme(), and redraw_everything().
double display::turbo_speed_ [protected] |
bool display::turbo_ [protected] |
bool display::invalidateGameStatus_ [protected] |
Definition at line 405 of file display.hpp.
Referenced by game_display::draw_sidebar(), invalidate_game_status(), and redraw_everything().
map_labels display::map_labels_ [protected] |
Definition at line 406 of file display.hpp.
Referenced by labels(), redraw_everything(), scroll(), and set_zoom().
events::generic_event display::_scroll_event [mutable, protected] |
Event raised when the map is being scrolled.
Definition at line 408 of file display.hpp.
Referenced by scroll(), and scroll_event().
int display::nextDraw_ [protected] |
Holds the tick count for when the next drawing event is scheduled.
Drawing shouldn't occur before this time.
Definition at line 411 of file display.hpp.
Referenced by draw_wrap().
SDL_Rect display::reportRects_[reports::NUM_REPORTS] [protected] |
Definition at line 414 of file display.hpp.
Referenced by display(), redraw_everything(), and refresh_report().
surface display::reportSurfaces_[reports::NUM_REPORTS] [protected] |
Definition at line 415 of file display.hpp.
Referenced by redraw_everything(), and refresh_report().
reports::report display::reports_[reports::NUM_REPORTS] [protected] |
Definition at line 416 of file display.hpp.
Referenced by redraw_everything(), and refresh_report().
std::map<reports::TYPE, std::string> display::report_ [protected] |
Definition at line 417 of file display.hpp.
Referenced by game_display::draw_report(), get_report_contents(), and set_report_content().
std::vector<gui::button> display::buttons_ [protected] |
Definition at line 418 of file display.hpp.
Referenced by create_buttons(), draw_all_panels(), enable_menu(), find_button(), menu_pressed(), and redraw_everything().
std::set<gamemap::location> display::invalidated_ [protected] |
Definition at line 419 of file display.hpp.
Referenced by game_display::draw(), editor_display::draw(), draw_init(), game_display::invalidate(), invalidate(), and invalidate_all().
std::map<gamemap::location, surface> display::hex_overlay_ [protected] |
Definition at line 420 of file display.hpp.
Referenced by clear_hex_overlay(), game_display::draw(), and set_hex_overlay().
surface display::selected_hex_overlay_ [protected] |
Definition at line 421 of file display.hpp.
Referenced by clear_selected_hex_overlay(), game_display::draw(), editor_display::draw(), and set_selected_hex_overlay().
surface display::mouseover_hex_overlay_ [protected] |
Definition at line 422 of file display.hpp.
Referenced by clear_mouseover_hex_overlay(), game_display::draw(), editor_display::draw(), and set_mouseover_hex_overlay().
gamemap::location display::selectedHex_ [protected] |
Definition at line 423 of file display.hpp.
Referenced by game_display::draw(), editor_display::draw(), game_display::draw_report(), game_display::highlight_hex(), select_hex(), and selected_hex().
gamemap::location display::mouseoverHex_ [protected] |
Definition at line 424 of file display.hpp.
Referenced by game_display::draw(), editor_display::draw(), game_display::draw_report(), game_display::highlight_hex(), highlight_hex(), and mouseover_hex().
std::set<gamemap::location> display::highlighted_locations_ [protected] |
Definition at line 425 of file display.hpp.
Referenced by add_highlighted_loc(), clear_highlighted_locs(), editor_display::draw(), and remove_highlighted_loc().
CKey display::keys_ [protected] |
tdrawing_buffer display::drawing_buffer_ [protected] |
Definition at line 524 of file display.hpp.
Referenced by drawing_buffer_add(), drawing_buffer_clear(), and drawing_buffer_commit().
bool display::map_screenshot_ [protected] |
Used to indicate to drawing funtions that we are doing a map screenshot.
Definition at line 565 of file display.hpp.
Referenced by get_screen_surface(), map_area(), map_outside_area(), and screenshot().
int display::fps_handle_ [private] |
Handle for the label which displays frames per second.
Definition at line 569 of file display.hpp.
Referenced by update_display().
bool display::idle_anim_ [private] |
double display::idle_anim_rate_ [private] |
Definition at line 572 of file display.hpp.
Referenced by idle_anim_rate(), and set_idle_anim_rate().
surface display::map_screenshot_surf_ [private] |
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |