From 583529fa16abe5e38b1967254e41e3dd11c162e5 Mon Sep 17 00:00:00 2001 From: fallahn Date: Sat, 14 Sep 2024 11:33:10 +0100 Subject: [PATCH] fix ball scale on minimap add animated flag to minimap --- samples/golf/src/golf/GolfStateUI.cpp | 5 +++-- samples/golf/src/golf/MiniBallSystem.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/samples/golf/src/golf/GolfStateUI.cpp b/samples/golf/src/golf/GolfStateUI.cpp index b3ebb5577..807b12587 100644 --- a/samples/golf/src/golf/GolfStateUI.cpp +++ b/samples/golf/src/golf/GolfStateUI.cpp @@ -1768,13 +1768,14 @@ void GolfState::buildUI() entity.getComponent().setOrigin({ 0.5f, -0.5f }); entity.addComponent().setFacing(cro::Drawable2D::Facing::Back); entity.addComponent().ID = CommandID::UI::MiniFlag; - entity.addComponent() = m_sprites[SpriteID::MapFlag]; + entity.addComponent() = m_sprites[SpriteID::MiniFlag/*MapFlag*/]; + entity.addComponent().play(0); entity.addComponent().active = true; entity.getComponent().function = [&, mapEnt](cro::Entity e, float dt) { e.getComponent().setPosition(glm::vec3(m_minimapZoom.toMapCoords(m_holeData[m_currentHole].pin), 0.02f)); - e.getComponent().setScale(((m_minimapZoom.mapScale * 2.f * (1.f + ((m_minimapZoom.zoom - 1.f) * 0.125f))) * 0.75f) * (glm::vec2(1.f) / MapSizeRatio)); + e.getComponent().setScale(((m_minimapZoom.mapScale * 1.8f * (1.f + ((m_minimapZoom.zoom - 1.f) * 0.125f))) * 0.75f) * (glm::vec2(1.f) / MapSizeRatio)); auto miniBounds = mapEnt.getComponent().getWorldTransform() * mapEnt.getComponent().getLocalBounds(); //auto flagBounds = glm::inverse(e.getComponent().getWorldTransform()) * miniBounds; diff --git a/samples/golf/src/golf/MiniBallSystem.cpp b/samples/golf/src/golf/MiniBallSystem.cpp index 04e83850f..9e001c95c 100644 --- a/samples/golf/src/golf/MiniBallSystem.cpp +++ b/samples/golf/src/golf/MiniBallSystem.cpp @@ -99,7 +99,7 @@ void MiniBallSystem::process(float dt) //set scale based on height static constexpr float MaxHeight = 40.f; float scale = 1.f + (position.y / MaxHeight); - entity.getComponent().setScale(glm::vec2(scale) * m_minimapZoom.mapScale); + entity.getComponent().setScale(glm::vec2(scale) * m_minimapZoom.mapScale * 2.f); //or if in bounds of the mini map