|
|
@ -5,9 +5,10 @@ |
|
|
|
namespace gui { |
|
|
|
namespace gui { |
|
|
|
using namespace guecs; |
|
|
|
using namespace guecs; |
|
|
|
|
|
|
|
|
|
|
|
BossFightUI::BossFightUI(DinkyECS::World& world, std::string boss_name) |
|
|
|
BossFightUI::BossFightUI(shared_ptr<DinkyECS::World> world, DinkyECS::Entity boss_id) |
|
|
|
: $config(world.get_the<components::GameConfig>()), |
|
|
|
: $world(world), |
|
|
|
$boss_name(boss_name) |
|
|
|
$boss_id(boss_id), |
|
|
|
|
|
|
|
$config(world->get_the<components::GameConfig>()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$status.position(0, 0, BOSS_VIEW_X, SCREEN_HEIGHT); |
|
|
|
$status.position(0, 0, BOSS_VIEW_X, SCREEN_HEIGHT); |
|
|
|
$status.layout( |
|
|
|
$status.layout( |
|
|
@ -24,15 +25,13 @@ namespace gui { |
|
|
|
"[overlay_9|overlay_10|overlay_12]" |
|
|
|
"[overlay_9|overlay_10|overlay_12]" |
|
|
|
"[overlay_13|overlay_14|overlay_16]"); |
|
|
|
"[overlay_13|overlay_14|overlay_16]"); |
|
|
|
|
|
|
|
|
|
|
|
$sounds = components::get<components::Sound>($config.bosses[boss_name]); |
|
|
|
$sounds = $world->get<components::Sound>($boss_id); |
|
|
|
$combat = components::get<components::Combat>($config.bosses[boss_name]); |
|
|
|
$combat = $world->get<components::Combat>($boss_id); |
|
|
|
$weapon_hit_sound = $config.bosses[$boss_name]["weapon_sound"]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BossFightUI::configure_sprite() { |
|
|
|
void BossFightUI::configure_sprite() { |
|
|
|
auto& boss = $config.bosses[$boss_name]; |
|
|
|
$sprite_config = $world->get<components::Sprite>($boss_id); |
|
|
|
$sprite_config = components::get<components::Sprite>(boss); |
|
|
|
$animation = $world->get<components::Animation>($boss_id); |
|
|
|
$animation = components::get<components::Animation>(boss); |
|
|
|
|
|
|
|
$animation.texture_width = $sprite_config.width; |
|
|
|
$animation.texture_width = $sprite_config.width; |
|
|
|
|
|
|
|
|
|
|
|
$boss_image = textures::get($sprite_config.name); |
|
|
|
$boss_image = textures::get($sprite_config.name); |
|
|
@ -48,8 +47,10 @@ namespace gui { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BossFightUI::configure_background() { |
|
|
|
void BossFightUI::configure_background() { |
|
|
|
auto& boss = $config.bosses[$boss_name]; |
|
|
|
// FIX ME
|
|
|
|
$boss_background = textures::get(boss["background"]); |
|
|
|
// auto& config = $world->get_the<components::GameConfig>();
|
|
|
|
|
|
|
|
std::string boss_bg = "boss_fight_background"; |
|
|
|
|
|
|
|
$boss_background = textures::get(boss_bg); |
|
|
|
$boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); |
|
|
|
$boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); |
|
|
|
$status.world().set_the<Background>({$status.$parser}); |
|
|
|
$status.world().set_the<Background>({$status.$parser}); |
|
|
|
} |
|
|
|
} |
|
|
@ -96,10 +97,6 @@ namespace gui { |
|
|
|
sound::play($sounds.attack); |
|
|
|
sound::play($sounds.attack); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!sound::playing($weapon_hit_sound) && $animation.subframe > 1.2 && $animation.subframe < 1.5) { |
|
|
|
|
|
|
|
sound::play($weapon_hit_sound); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$boss_image.sprite->setTextureRect(frame_rect); |
|
|
|
$boss_image.sprite->setTextureRect(frame_rect); |
|
|
|
window.draw(*$boss_image.sprite); |
|
|
|
window.draw(*$boss_image.sprite); |
|
|
|
} |
|
|
|
} |
|
|
|