mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 03:18:37 +00:00
Arrows: color parameter now gets used, and set_color() works properly.
This commit is contained in:
parent
85c3494589
commit
1bb82db4be
@ -30,12 +30,9 @@ static lg::log_domain log_arrows("arrows");
|
||||
#define LOG_ARR LOG_STREAM(info, log_arrows)
|
||||
#define DBG_ARR LOG_STREAM(debug, log_arrows)
|
||||
|
||||
arrow::arrow(display* screen): layer_(display::LAYER_ARROWS)
|
||||
arrow::arrow(display* screen)
|
||||
:screen_(screen), layer_(display::LAYER_ARROWS), color_("255,0,0")
|
||||
{
|
||||
screen_ = screen;
|
||||
color_.b = 0;
|
||||
color_.g = 0;
|
||||
color_.r = 0;
|
||||
}
|
||||
|
||||
void arrow::set_path(const arrow_path_t &path)
|
||||
@ -45,7 +42,7 @@ void arrow::set_path(const arrow_path_t &path)
|
||||
update_symbols(previous_path_);
|
||||
}
|
||||
|
||||
void arrow::set_color(const SDL_Color color)
|
||||
void arrow::set_color(const std::string& color)
|
||||
{
|
||||
color_ = color;
|
||||
update_symbols(path_);
|
||||
@ -94,8 +91,7 @@ void arrow::update_symbols(arrow_path_t old_path)
|
||||
|
||||
invalidate_arrow_path(old_path);
|
||||
|
||||
//TODO: use color from the set_color method
|
||||
const std::string mods = "~RC(FF00FF>FF0000)"; //magenta to red
|
||||
const std::string mods = "~RC(FF00FF>"+ color_ + ")"; //magenta to current color
|
||||
|
||||
const std::string dirname = "arrows/";
|
||||
map_location::DIRECTION exit_dir = map_location::NDIRECTIONS;
|
||||
@ -117,6 +113,7 @@ void arrow::update_symbols(arrow_path_t old_path)
|
||||
suffix = "";
|
||||
image_filename = "";
|
||||
begin = end = false;
|
||||
// teleport in if we teleported out last hex
|
||||
teleport_in = teleport_out;
|
||||
teleport_out = false;
|
||||
|
||||
@ -199,14 +196,16 @@ void arrow::invalidate_arrow_path(arrow_path_t path)
|
||||
}
|
||||
}
|
||||
|
||||
void arrow::notify_arrow_changed() {
|
||||
void arrow::notify_arrow_changed()
|
||||
{
|
||||
foreach(arrow_observer* observer, observers_)
|
||||
{
|
||||
observer->arrow_changed(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void arrow::notify_arrow_deleted() {
|
||||
void arrow::notify_arrow_deleted()
|
||||
{
|
||||
foreach(arrow_observer* observer, observers_)
|
||||
{
|
||||
observer->arrow_deleted(*this);
|
||||
|
@ -49,7 +49,12 @@ public:
|
||||
|
||||
virtual void set_path(const arrow_path_t &path);
|
||||
|
||||
void set_color(const SDL_Color color);
|
||||
/**
|
||||
* The string color parameter is in the same format expected by the
|
||||
* image::locator modifiers parameter. Examples: red is "FF0000" or "255,0,0".
|
||||
* Feel free to add another method that accepts an Uint32 as a parameter instead.
|
||||
*/
|
||||
void set_color(const std::string& color);
|
||||
|
||||
void set_layer(const display::tdrawing_layer & layer);
|
||||
|
||||
@ -63,7 +68,7 @@ public:
|
||||
|
||||
void remove_observer(arrow_observer & observer);
|
||||
|
||||
private:
|
||||
protected:
|
||||
//operations
|
||||
|
||||
/**
|
||||
@ -71,6 +76,9 @@ private:
|
||||
*/
|
||||
void update_symbols(arrow_path_t old_path);
|
||||
|
||||
private:
|
||||
//operations
|
||||
|
||||
void invalidate_arrow_path(arrow_path_t path);
|
||||
|
||||
void notify_arrow_changed();
|
||||
@ -84,7 +92,7 @@ private:
|
||||
|
||||
display::tdrawing_layer layer_;
|
||||
|
||||
SDL_Color color_;
|
||||
std::string color_;
|
||||
|
||||
arrow_path_t path_;
|
||||
arrow_path_t previous_path_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user