Finally have the boss fight rendering into a render texture correctly. The 'flipped' problem was because I didn't call .display() in render.
This commit is contained in:
parent
82a38e5fa1
commit
740e1052fe
6 changed files with 17 additions and 11 deletions
15
boss/ui.cpp
15
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue