More boss fight UI done and a bit of ambient sound working.
This commit is contained in:
parent
64807174c0
commit
a0c0308461
12 changed files with 111 additions and 58 deletions
40
guecs.cpp
40
guecs.cpp
|
@ -118,10 +118,50 @@ namespace guecs {
|
|||
return action_count > 0;
|
||||
}
|
||||
|
||||
void UI::show_sprite(string region, string sprite_name) {
|
||||
auto ent = entity(region);
|
||||
|
||||
if(!has<Sprite>(ent)) {
|
||||
Sprite to_show{sprite_name};
|
||||
auto& cell = cell_for(ent);
|
||||
to_show.init(cell);
|
||||
set<guecs::Sprite>(ent, to_show);
|
||||
}
|
||||
}
|
||||
|
||||
void UI::show_text(string region, string content) {
|
||||
auto ent = entity(region);
|
||||
|
||||
if(auto text = get_if<Textual>(ent)) {
|
||||
text->text->setString(content);
|
||||
} else {
|
||||
auto &cell = cell_for(ent);
|
||||
Textual to_set{content, 20};
|
||||
to_set.init(cell, $font);
|
||||
to_set.text->setFillColor(ColorValue::LIGHT_MID);
|
||||
set<Textual>(ent, to_set);
|
||||
}
|
||||
}
|
||||
|
||||
void UI::show_label(string region, string content) {
|
||||
auto ent = entity(region);
|
||||
|
||||
if(auto text = get_if<Label>(ent)) {
|
||||
text->text->setString(content);
|
||||
} else {
|
||||
auto &cell = cell_for(ent);
|
||||
Label to_set{content, 20};
|
||||
to_set.init(cell, $font);
|
||||
to_set.text->setFillColor(ColorValue::LIGHT_MID);
|
||||
set<Label>(ent, to_set);
|
||||
}
|
||||
}
|
||||
|
||||
Clickable make_action(DinkyECS::World& target, Events::GUI event) {
|
||||
return {[&, event](auto ent, auto data){
|
||||
// remember that ent is passed in from the UI::mouse handler
|
||||
target.send<Events::GUI>(event, ent, data);
|
||||
}};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue