diff --git a/animation.cpp b/animation.cpp index f0038ec..aea103d 100644 --- a/animation.cpp +++ b/animation.cpp @@ -41,7 +41,6 @@ namespace components { if(playing && current < frames) { float tick = twitching(); - fmt::print("tick: {}\r", tick); if(stationary) { switch(motion) { diff --git a/boss/ui.cpp b/boss/ui.cpp index be0a9f7..5f81ed8 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -8,8 +8,11 @@ namespace boss { UI::UI(components::AnimatedScene& scene, Entity boss_id) : $boss_id(boss_id), $combat_ui(true), - $arena(scene) + $arena(scene), + $view_texture({BOSS_VIEW_WIDTH, BOSS_VIEW_HEIGHT}), + $view_sprite($view_texture.getTexture()) { + $view_sprite.setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); } void UI::init() { @@ -37,13 +40,15 @@ namespace boss { void UI::render(sf::RenderWindow& window) { $actions.render(window); $combat_ui.render(window); - $arena.render(window); + $arena.render($view_texture); + $view_texture.display(); + window.draw($view_sprite); } 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); + // BUG: arena is getting the _window_ coordinates, not the rendertexture + return $combat_ui.mouse(x, y, mods) + || $actions.mouse(x, y, mods) || $arena.mouse(x, y, mods); } void UI::status(const std::wstring& msg) { diff --git a/boss/ui.hpp b/boss/ui.hpp index a1673db..b81515f 100644 --- a/boss/ui.hpp +++ b/boss/ui.hpp @@ -12,6 +12,8 @@ namespace boss { gui::CombatUI $combat_ui; scene::Engine $arena; guecs::UI $actions; + sf::RenderTexture $view_texture; + sf::Sprite $view_sprite; UI(components::AnimatedScene &scene, DinkyECS::Entity boss_id); diff --git a/scene.cpp b/scene.cpp index c7c51be..6700d57 100644 --- a/scene.cpp +++ b/scene.cpp @@ -50,7 +50,7 @@ namespace scene { } void Engine::init() { - $ui.position(SCREEN_WIDTH-BOSS_VIEW_WIDTH,0, BOSS_VIEW_WIDTH, SCREEN_HEIGHT); + $ui.position(0,0, BOSS_VIEW_WIDTH, BOSS_VIEW_HEIGHT); $ui.set($ui.MAIN, {$ui.$parser, guecs::THEME.TRANSPARENT}); auto& background = $ui.get($ui.MAIN); background.set_sprite($scene.background, true); @@ -72,7 +72,7 @@ namespace scene { return $ui.mouse(x, y, mods); } - void Engine::render(sf::RenderWindow& window) { + void Engine::render(sf::RenderTarget& window) { $ui.render(window); for(auto& fixture : $fixtures) { diff --git a/scene.hpp b/scene.hpp index 36239cc..e27fdaf 100644 --- a/scene.hpp +++ b/scene.hpp @@ -35,7 +35,7 @@ namespace scene { Engine(components::AnimatedScene& scene); void init(); - void render(sf::RenderWindow& window); + void render(sf::RenderTarget& 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); diff --git a/wraps/lel-guecs.wrap b/wraps/lel-guecs.wrap index caa2e42..456ef65 100644 --- a/wraps/lel-guecs.wrap +++ b/wraps/lel-guecs.wrap @@ -1,6 +1,6 @@ [wrap-git] -directory=lel-guecs-0.6.0 -url=https://git.learnjsthehardway.com/learn-code-the-hard-way/lel-guecs.git +directory=lel-guecs-0.7.0 +url=https://git.zedshaw.games/games/lel-guecs.git revision=HEAD depth=1 method=meson