mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 23:32:12 +00:00
Added hide() to class arrow. (whiteboard)
This commit is contained in:
parent
2e94d061c6
commit
8f8e133474
@ -33,19 +33,30 @@ static lg::log_domain log_arrows("arrows");
|
||||
|
||||
#define SCREEN ((display*)resources::screen)
|
||||
|
||||
arrow::arrow()
|
||||
arrow::arrow(bool hidden)
|
||||
: layer_(display::LAYER_ARROWS)
|
||||
, color_("red")
|
||||
, style_(STYLE_STANDARD)
|
||||
, path_()
|
||||
, previous_path_()
|
||||
, symbols_map_()
|
||||
, hidden_(true)
|
||||
{
|
||||
resources::screen->add_arrow(*this);
|
||||
if(!hidden)
|
||||
show();
|
||||
}
|
||||
|
||||
arrow::~arrow()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void arrow::hide()
|
||||
{
|
||||
if(hidden_)
|
||||
return;
|
||||
hidden_ = true;
|
||||
|
||||
if (SCREEN)
|
||||
{
|
||||
invalidate_arrow_path(path_);
|
||||
@ -53,15 +64,28 @@ arrow::~arrow()
|
||||
}
|
||||
}
|
||||
|
||||
void arrow::show()
|
||||
{
|
||||
if(!hidden_)
|
||||
return;
|
||||
hidden_ = false;
|
||||
|
||||
if(SCREEN)
|
||||
SCREEN->add_arrow(*this);
|
||||
}
|
||||
|
||||
void arrow::set_path(arrow_path_t const& path)
|
||||
{
|
||||
if (valid_path(path))
|
||||
{
|
||||
previous_path_ = path_;
|
||||
path_ = path;
|
||||
invalidate_arrow_path(previous_path_);
|
||||
update_symbols();
|
||||
notify_arrow_changed();
|
||||
if(!hidden_)
|
||||
{
|
||||
invalidate_arrow_path(previous_path_);
|
||||
notify_arrow_changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,13 @@ class arrow {
|
||||
|
||||
public:
|
||||
|
||||
arrow();
|
||||
arrow(bool hidden = false);
|
||||
virtual ~arrow();
|
||||
|
||||
///Sets the arrow's visibility
|
||||
void hide();
|
||||
void show();
|
||||
|
||||
virtual void set_path(arrow_path_t const& path);
|
||||
|
||||
///invalidates and clears the present path, forgets the previous path, clears the symbols map
|
||||
@ -97,5 +101,7 @@ protected:
|
||||
|
||||
typedef std::map<map_location, image::locator> arrow_symbols_map_t;
|
||||
arrow_symbols_map_t symbols_map_;
|
||||
|
||||
bool hidden_;
|
||||
};
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user