raycaster/boss_fight_ui.hpp

50 lines
1.4 KiB
C++

#pragma once
#include "levelmanager.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Font.hpp>
#include "guecs.hpp"
#include "textures.hpp"
#include "components.hpp"
#include <SFML/System/Clock.hpp>
// aspect ratio of art is 3/2 so 1.5
// possible sizes: 900/600; 1620/1080; 1800/1200
// To calculate it do short side * 1.5 so 1080 * 1.5 == 1620
//
// Side panel = 300/1080
namespace gui {
using namespace guecs;
using std::string;
class BossFightUI {
public:
sf::Clock $clock;
int $boss_hp = 10;
bool $boss_hit = false;
sf::Vector2f $scale{0.8, 0.8};
std::string $weapon_hit_sound;
components::Sprite $sprite_config;
components::Sound $sounds;
components::Animation $animation;
GameLevel $level;
components::GameConfig& $config;
std::string $boss_name;
guecs::UI $status;
guecs::UI $overlay;
textures::SpriteTexture $boss_image;
textures::SpriteTexture $boss_background;
BossFightUI(GameLevel level, std::string boss_name);
void init();
void render(sf::RenderWindow& window);
bool mouse(float x, float y);
void bounce_boss(sf::RenderWindow& window);
bool boss_dead() { return $boss_hp < 0; }
void update_level(GameLevel& level);
void configure_sprite();
void configure_background();
void configure_gui();
};
}