diff --git a/samples/golf/buildnumber.h b/samples/golf/buildnumber.h index 0d6976ec6..dadd83dac 100644 --- a/samples/golf/buildnumber.h +++ b/samples/golf/buildnumber.h @@ -3,7 +3,7 @@ #ifndef BUILD_NUMBER_H_ #define BUILD_NUMBER_H_ -#define BUILDNUMBER 986 -#define BUILDNUMBER_STR "986" +#define BUILDNUMBER 993 +#define BUILDNUMBER_STR "993" #endif /* BUILD_NUMBER_H_ */ diff --git a/samples/golf/src/golf/CommandIDs.hpp b/samples/golf/src/golf/CommandIDs.hpp index 03855554f..08729daa0 100644 --- a/samples/golf/src/golf/CommandIDs.hpp +++ b/samples/golf/src/golf/CommandIDs.hpp @@ -81,7 +81,8 @@ struct CommandID final WaitMessage = 0x200000, FastForward = 0x400000, WindHidden = 0x800000, //I can't think of a better name - basically when the wind indicator is hidden during putting - WindEffect = 0x1000000 + WindEffect = 0x1000000, + PuttPower = 0x2000000 }; }; diff --git a/samples/golf/src/golf/GolfState.cpp b/samples/golf/src/golf/GolfState.cpp index a40b39f6d..610f303a5 100644 --- a/samples/golf/src/golf/GolfState.cpp +++ b/samples/golf/src/golf/GolfState.cpp @@ -1182,6 +1182,29 @@ void GolfState::handleMessage(const cro::Message& msg) }; m_uiScene.getSystem()->sendCommand(cmd); + cmd.targetFlags = CommandID::UI::PuttPower; + cmd.action = [&](cro::Entity e, float) + { + if (m_currentPlayer.client == m_sharedData.clientConnection.connectionID) + { + auto club = getClub(); + if (club == ClubID::Putter) + { + auto str = Clubs[ClubID::Putter].getName(m_sharedData.imperialMeasurements, m_distanceToHole); + e.getComponent().setString(str.substr(str.find_last_of(' ') + 1)); + } + else + { + e.getComponent().setString(" "); + } + } + else + { + e.getComponent().setString(" "); + } + }; + m_uiScene.getSystem()->sendCommand(cmd); + //hide wind indicator if club is less than min wind distance to hole cmd.targetFlags = CommandID::UI::WindHidden; cmd.action = [&](cro::Entity e, float) @@ -1416,6 +1439,29 @@ void GolfState::handleMessage(const cro::Message& msg) }; m_uiScene.getSystem()->sendCommand(cmd); + cmd.targetFlags = CommandID::UI::PuttPower; + cmd.action = [&](cro::Entity e, float) + { + if (m_currentPlayer.client == m_sharedData.clientConnection.connectionID) + { + auto club = getClub(); + if (club == ClubID::Putter) + { + auto str = Clubs[ClubID::Putter].getName(m_sharedData.imperialMeasurements, m_distanceToHole); + e.getComponent().setString(str.substr(str.find_last_of(' ') + 1)); + } + else + { + e.getComponent().setString(" "); + } + } + else + { + e.getComponent().setString(" "); + } + }; + m_uiScene.getSystem()->sendCommand(cmd); + cmd.targetFlags = CommandID::UI::PinDistance; cmd.action = [&](cro::Entity e, float) diff --git a/samples/golf/src/golf/GolfStateUI.cpp b/samples/golf/src/golf/GolfStateUI.cpp index 3bec66e75..f81fdc134 100644 --- a/samples/golf/src/golf/GolfStateUI.cpp +++ b/samples/golf/src/golf/GolfStateUI.cpp @@ -728,9 +728,18 @@ void GolfState::buildUI() bounds = entity.getComponent().getTextureBounds(); entity.getComponent().setOrigin(glm::vec3(bounds.width / 2.f, bounds.height / 2.f, -0.05f)); rootNode.getComponent().addChild(entity.getComponent()); + auto barEnt = entity; + + const auto& smallFont = m_sharedData.sharedResources->fonts.get(FontID::Info); + entity = m_uiScene.createEntity(); + entity.addComponent().setPosition({ bounds.width + 2.f, 12.f, 0.f }); + entity.addComponent(); + entity.addComponent(smallFont).setFillColour(TextNormalColour); + entity.getComponent().setCharacterSize(InfoTextSize); + entity.addComponent().ID = CommandID::UI::PuttPower; + barEnt.getComponent().addChild(entity.getComponent()); //power bar - auto barEnt = entity; const auto BarCentre = bounds.width / 2.f; const auto BarWidth = bounds.width - 8.f; const auto BarHeight = bounds.height; diff --git a/samples/golf/src/golf/MenuCreation.cpp b/samples/golf/src/golf/MenuCreation.cpp index 95d86120a..2cea74f09 100644 --- a/samples/golf/src/golf/MenuCreation.cpp +++ b/samples/golf/src/golf/MenuCreation.cpp @@ -2385,7 +2385,7 @@ void MenuState::createLobbyMenu(cro::Entity parent, std::uint32_t mouseEnter, st //continue message messageEnt.getComponent().setFillColour(cro::Colour::Transparent); - messageTitleEnt.getComponent().setString("Ready?"); + messageTitleEnt.getComponent().setString("Start Game?"); centreText(messageTitleEnt); } m_audioEnts[AudioID::Back].getComponent().play();