raycaster/boss/ui.hpp

53 lines
1.4 KiB
C++

#pragma once
#include "dinkyecs.hpp"
#include <memory>
#include <SFML/Graphics/RenderWindow.hpp>
#include <guecs/ui.hpp>
#include "textures.hpp"
#include "gui/combat_ui.hpp"
#include "components.hpp"
struct AnimatedFixture {
textures::SpriteTexture st;
components::Animation anim;
std::string cell;
float scale_x;
float scale_y;
float x;
float y;
bool at_mid=false;
sf::Vector2f pos{0,0};
};
namespace boss {
using std::shared_ptr;
using namespace DinkyECS;
using namespace textures;
struct UI {
shared_ptr<World> $world = nullptr;
Entity $boss_id = NONE;
components::BossFight& $scene;
gui::CombatUI $combat_ui;
SpriteTexture $boss_sprite;
SpriteTexture $player_sprite;
SpriteTexture $floor_sprite;
guecs::UI $arena;
guecs::UI $actions;
components::Animation $boss_anim;
sf::Vector2f $boss_pos;
std::vector<AnimatedFixture> $fixtures;
UI(shared_ptr<World> world, Entity boss_id);
void init();
void render(sf::RenderWindow& window);
bool mouse(float x, float y, guecs::Modifiers mods);
void position_sprite(textures::SpriteTexture& st, const std::string& cell_name, float scale_x, float scale_y, bool at_mid, float x_diff=0.0f, float y_diff=0.0f);
void status(const std::wstring& msg);
void move_boss(const std::string& cell_name);
void move_player(const std::string& cell_name);
void play_animations();
};
}