66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#include "boss/ui.hpp"
|
|
#include "scene.hpp"
|
|
#include "constants.hpp"
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
namespace boss {
|
|
using namespace guecs;
|
|
|
|
UI::UI(components::AnimatedScene& scene, Entity boss_id) :
|
|
$boss_id(boss_id),
|
|
$combat_ui(true),
|
|
$arena(scene)
|
|
{
|
|
}
|
|
|
|
void UI::init() {
|
|
$arena.init();
|
|
|
|
$actions.position(0,0, SCREEN_WIDTH-BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
|
|
$actions.layout(
|
|
"[*(200,400)combat|_]"
|
|
"[_|_]"
|
|
"[_|_]"
|
|
"[_|_]"
|
|
"[*(200,300)stats]"
|
|
"[_]"
|
|
"[_]");
|
|
auto stats = $actions.entity("stats");
|
|
$actions.set<Rectangle>(stats, {});
|
|
$actions.set<Text>(stats, {L"stats"});
|
|
|
|
$actions.init();
|
|
|
|
auto& cell = $actions.cell_for("combat");
|
|
$combat_ui.init(cell.x, cell.y, cell.w, cell.h);
|
|
}
|
|
|
|
void UI::render(sf::RenderWindow& window) {
|
|
$actions.render(window);
|
|
$combat_ui.render(window);
|
|
$arena.render(window);
|
|
}
|
|
|
|
bool UI::mouse(float x, float y, Modifiers mods) {
|
|
return $arena.mouse(x, y, mods)
|
|
|| $combat_ui.mouse(x, y, mods)
|
|
|| $actions.mouse(x, y, mods);
|
|
}
|
|
|
|
void UI::status(const std::wstring& msg) {
|
|
$arena.$ui.show_text("status", msg);
|
|
}
|
|
|
|
void UI::move_actor(const std::string& actor, const std::string& cell_name) {
|
|
$arena.move_actor(actor, cell_name);
|
|
}
|
|
|
|
void UI::animate_actor(const std::string& actor) {
|
|
$arena.animate_actor(actor);
|
|
}
|
|
|
|
void UI::play_animations() {
|
|
$arena.play_animations();
|
|
}
|
|
}
|