Moved the animated scene into its own system for better development.
This commit is contained in:
parent
49c9702041
commit
4f39f2a504
7 changed files with 209 additions and 159 deletions
34
boss/ui.hpp
34
boss/ui.hpp
|
|
@ -1,49 +1,23 @@
|
|||
#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"
|
||||
#include <unordered_map>
|
||||
|
||||
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};
|
||||
};
|
||||
#include "scene.hpp"
|
||||
|
||||
namespace boss {
|
||||
using std::shared_ptr;
|
||||
using namespace DinkyECS;
|
||||
using namespace textures;
|
||||
|
||||
struct UI {
|
||||
shared_ptr<World> $world = nullptr;
|
||||
Entity $boss_id = NONE;
|
||||
components::AnimatedScene $scene;
|
||||
DinkyECS::Entity $boss_id = DinkyECS::NONE;
|
||||
gui::CombatUI $combat_ui;
|
||||
SpriteTexture $floor_sprite;
|
||||
guecs::UI $arena;
|
||||
scene::Engine $arena;
|
||||
guecs::UI $actions;
|
||||
|
||||
std::unordered_map<std::string, int> $actor_name_ids;
|
||||
std::vector<AnimatedFixture> $fixtures;
|
||||
std::vector<AnimatedFixture> $actors;
|
||||
|
||||
UI(shared_ptr<World> world, Entity boss_id);
|
||||
UI(components::AnimatedScene &scene, DinkyECS::Entity boss_id);
|
||||
|
||||
void init();
|
||||
void render(sf::RenderWindow& window);
|
||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||
sf::Vector2f 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_actor(const std::string& actor, const std::string& cell_name);
|
||||
void animate_actor(const std::string& actor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue