Arrows destined to be drawn on the map. More...
#include <arrow.hpp>
Public Member Functions | |
arrow (const arrow &)=delete | |
arrow & | operator= (const arrow &)=delete |
arrow (bool hidden=false) | |
virtual | ~arrow () |
void | hide () |
Sets the arrow's visibility. More... | |
void | show () |
virtual void | set_path (const arrow_path_t &path) |
virtual void | reset () |
invalidates and clears the present path, forgets the previous path, clears the symbols map More... | |
virtual void | set_color (const std::string &color) |
The string color parameter is in the same format expected by the image::locator modifiers parameter. More... | |
virtual std::string | get_color () const |
std::string | get_style () const |
The style is simply the name of a subdirectory under images/arrows, that holds an alternate copy of the arrow graphics. More... | |
void | set_style (const std::string &style) |
const arrow_path_t & | get_path () const |
const arrow_path_t & | get_previous_path () const |
bool | path_contains (const map_location &hex) const |
virtual void | draw_hex (const map_location &hex) |
virtual void | notify_arrow_changed () |
Static Public Member Functions | |
static bool | valid_path (const arrow_path_t &path) |
Checks that the path is not of length 0 or 1. More... | |
static void | invalidate_arrow_path (const arrow_path_t &path) |
Invalidates every hex along the given path. More... | |
Static Public Attributes | |
static const std::string | STYLE_STANDARD = "standard" |
If you add more styles, you should look at move::update_arrow_style() More... | |
static const std::string | STYLE_HIGHLIGHTED = "highlighted" |
static const std::string | STYLE_FOCUS = "focus" |
static const std::string | STYLE_FOCUS_INVALID = "focus_invalid" |
Protected Types | |
typedef std::map< map_location, image::locator > | arrow_symbols_map_t |
Protected Member Functions | |
virtual void | update_symbols () |
Calculate the symbols to place along the arrow path. More... | |
Protected Attributes | |
display::drawing_layer | layer_ |
std::string | color_ |
std::string | style_ |
represents the subdirectory that holds images for this arrow style More... | |
arrow_path_t | path_ |
arrow_path_t | previous_path_ |
arrow_symbols_map_t | symbols_map_ |
bool | hidden_ |
Arrows destined to be drawn on the map.
Created for the whiteboard system.
|
protected |
|
delete |
|
virtual |
Definition at line 136 of file arrow.cpp.
References image::get_image(), display::get_location_x(), display::get_location_y(), display::get_singleton(), layer_, path_contains(), display::render_image(), image::SCALED_TO_ZOOM, and symbols_map_.
Referenced by display::draw_hex().
|
inlinevirtual |
const arrow_path_t & arrow::get_path | ( | ) | const |
Definition at line 120 of file arrow.cpp.
References path_.
Referenced by display::add_arrow(), display::remove_arrow(), and display::update_arrow().
const arrow_path_t & arrow::get_previous_path | ( | ) | const |
Definition at line 125 of file arrow.cpp.
References previous_path_.
Referenced by display::update_arrow().
|
inline |
The style is simply the name of a subdirectory under images/arrows, that holds an alternate copy of the arrow graphics.
If it doesn't exist or has missing images, you'll get "under construction" symbols instead of arrow graphics.
Definition at line 63 of file arrow.hpp.
References set_style(), style, and style_.
void arrow::hide | ( | ) |
Sets the arrow's visibility.
Definition at line 49 of file arrow.cpp.
References display::get_singleton(), hidden_, invalidate_arrow_path(), and path_.
Referenced by ~arrow().
|
static |
Invalidates every hex along the given path.
Definition at line 284 of file arrow.cpp.
References display::get_singleton().
Referenced by hide(), reset(), set_path(), and update_symbols().
|
virtual |
Definition at line 293 of file arrow.cpp.
References display::get_singleton().
Referenced by reset(), and set_path().
bool arrow::path_contains | ( | const map_location & | hex | ) | const |
Definition at line 130 of file arrow.cpp.
References gui2::contains(), and symbols_map_.
Referenced by draw_hex().
|
virtual |
invalidates and clears the present path, forgets the previous path, clears the symbols map
Definition at line 87 of file arrow.cpp.
References invalidate_arrow_path(), notify_arrow_changed(), path_, previous_path_, and symbols_map_.
|
virtual |
The string color parameter is in the same format expected by the image::locator modifiers parameter.
Examples: red is "red" or "FF0000" or "255,0,0". Feel free to add another method that accepts an uint32_t as a parameter instead.
Definition at line 97 of file arrow.cpp.
References color_, path_, STYLE_FOCUS, STYLE_FOCUS_INVALID, STYLE_HIGHLIGHTED, STYLE_STANDARD, update_symbols(), and valid_path().
|
virtual |
Definition at line 72 of file arrow.cpp.
References hidden_, invalidate_arrow_path(), notify_arrow_changed(), game_config::path, path_, previous_path_, update_symbols(), and valid_path().
void arrow::set_style | ( | const std::string & | style | ) |
Definition at line 111 of file arrow.cpp.
References path_, style, style_, update_symbols(), and valid_path().
Referenced by get_style().
void arrow::show | ( | ) |
Definition at line 61 of file arrow.cpp.
References display::get_singleton(), and hidden_.
Referenced by arrow().
|
protectedvirtual |
Calculate the symbols to place along the arrow path.
Invalidates every hex along the path.
Definition at line 154 of file arrow.cpp.
References color_, ERR_ARR, invalidate_arrow_path(), game_config::images::missing, map_location::NDIRECTIONS, path_, editor::start(), style_, symbols_map_, tiles_adjacent(), valid_path(), map_location::write_direction(), and WRN_ARR.
Referenced by set_color(), set_path(), and set_style().
|
static |
Checks that the path is not of length 0 or 1.
Definition at line 146 of file arrow.cpp.
Referenced by wb::manager::save_temp_move(), set_color(), set_path(), set_style(), and update_symbols().
|
protected |
Definition at line 95 of file arrow.hpp.
Referenced by get_color(), set_color(), and update_symbols().
|
protected |
Definition at line 105 of file arrow.hpp.
Referenced by hide(), set_path(), and show().
|
protected |
Definition at line 93 of file arrow.hpp.
Referenced by draw_hex().
|
protected |
Definition at line 99 of file arrow.hpp.
Referenced by get_path(), hide(), reset(), set_color(), set_path(), set_style(), and update_symbols().
|
protected |
Definition at line 100 of file arrow.hpp.
Referenced by get_previous_path(), reset(), and set_path().
|
protected |
represents the subdirectory that holds images for this arrow style
Definition at line 97 of file arrow.hpp.
Referenced by get_style(), set_style(), and update_symbols().
|
static |
Definition at line 68 of file arrow.hpp.
Referenced by wb::move::init(), set_color(), and wb::move::update_arrow_style().
|
static |
Definition at line 69 of file arrow.hpp.
Referenced by wb::move::init(), set_color(), and wb::move::update_arrow_style().
|
static |
Definition at line 67 of file arrow.hpp.
Referenced by wb::manager::create_temp_move(), wb::move::init(), set_color(), and wb::move::update_arrow_style().
|
static |
If you add more styles, you should look at move::update_arrow_style()
Definition at line 66 of file arrow.hpp.
Referenced by wb::move::init(), wb::move::move(), set_color(), and wb::move::update_arrow_style().
|
protected |
Definition at line 103 of file arrow.hpp.
Referenced by draw_hex(), path_contains(), reset(), and update_symbols().