Moved the text attaching code to the arena.
This commit is contained in:
parent
f50e713179
commit
0d23cf9537
5 changed files with 43 additions and 15 deletions
22
boss/ui.cpp
22
boss/ui.cpp
|
|
@ -71,14 +71,18 @@ namespace boss {
|
|||
$actions.show_text("stats", status);
|
||||
}
|
||||
|
||||
void UI::render(sf::RenderWindow& window) {
|
||||
$actions.render(window);
|
||||
$combat_ui.render(window);
|
||||
void UI::set_window(sf::RenderWindow* window) {
|
||||
$window = window;
|
||||
}
|
||||
|
||||
void UI::render() {
|
||||
$actions.render(*$window);
|
||||
$combat_ui.render(*$window);
|
||||
|
||||
$arena.render($view_texture);
|
||||
$camera.render($view_texture);
|
||||
$view_texture.display();
|
||||
window.draw($view_sprite);
|
||||
$window->draw($view_sprite);
|
||||
}
|
||||
|
||||
bool UI::mouse(float x, float y, Modifiers mods) {
|
||||
|
|
@ -105,16 +109,12 @@ namespace boss {
|
|||
}
|
||||
|
||||
void UI::damage(const std::string& actor, int amount) {
|
||||
auto& config = $arena.actor_config(actor);
|
||||
|
||||
// BUG: the $arena should really do this
|
||||
if(amount == 0) {
|
||||
$arena.$ui.show_text(config.cell,
|
||||
fmt::format(L"{} MISSED!", guecs::to_wstring(actor)));
|
||||
$arena.attach_text(actor, "MISS!");
|
||||
} else {
|
||||
$arena.$ui.show_text(config.cell,
|
||||
fmt::format(L"{} HIT {}!", guecs::to_wstring(actor), amount));
|
||||
$arena.attach_text(actor, "HIT!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UI::zoom(const std::string &cell_name, double ratio) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue