From 58f6ce6e19ea70a8d9dfba687435a8bf588b5edb Mon Sep 17 00:00:00 2001 From: fallahn Date: Mon, 2 Sep 2024 10:11:04 +0100 Subject: [PATCH] tweakages --- samples/golf/src/golf/DrivingState.cpp | 50 ++++++++++----------- samples/golf/src/golf/GameConsts.hpp | 4 +- samples/golf/src/golf/GolfState.cpp | 62 +++++++++++++------------- samples/golf/src/golf/MenuConsts.hpp | 8 ++-- 4 files changed, 63 insertions(+), 61 deletions(-) diff --git a/samples/golf/src/golf/DrivingState.cpp b/samples/golf/src/golf/DrivingState.cpp index 782a29098..ae864f851 100644 --- a/samples/golf/src/golf/DrivingState.cpp +++ b/samples/golf/src/golf/DrivingState.cpp @@ -621,31 +621,31 @@ bool DrivingState::handleEvent(const cro::Event& evt) { pauseGame(); } - else if (evt.type == SDL_WINDOWEVENT) - { - switch (evt.window.event) - { - default: break; - case SDL_WINDOWEVENT_FOCUS_GAINED: - //this needs to be delayed a frame so mouse clicking on the - //open window doesn't get sent to the input parser - { - auto entity = m_uiScene.createEntity(); - entity.addComponent().active = true; - entity.getComponent().function = - [&](cro::Entity e, float) - { - m_inputParser.setSuspended(false); - e.getComponent().active = false; - m_uiScene.destroyEntity(e); - }; - } - break; - case SDL_WINDOWEVENT_FOCUS_LOST: - m_inputParser.setSuspended(true); - break; - } - } + //else if (evt.type == SDL_WINDOWEVENT) + //{ + // switch (evt.window.event) + // { + // default: break; + // case SDL_WINDOWEVENT_FOCUS_GAINED: + // //this needs to be delayed a frame so mouse clicking on the + // //open window doesn't get sent to the input parser + // { + // auto entity = m_uiScene.createEntity(); + // entity.addComponent().active = true; + // entity.getComponent().function = + // [&](cro::Entity e, float) + // { + // m_inputParser.setSuspended(false); + // e.getComponent().active = false; + // m_uiScene.destroyEntity(e); + // }; + // } + // break; + // case SDL_WINDOWEVENT_FOCUS_LOST: + // m_inputParser.setSuspended(true); + // break; + // } + //} #ifdef CRO_DEBUG_ //m_gameScene.getSystem()->handleEvent(evt); diff --git a/samples/golf/src/golf/GameConsts.hpp b/samples/golf/src/golf/GameConsts.hpp index a6b4b7e7d..3e7d74d1b 100644 --- a/samples/golf/src/golf/GameConsts.hpp +++ b/samples/golf/src/golf/GameConsts.hpp @@ -362,8 +362,8 @@ static inline float getWindMultiplier(float ballHeight, float distanceToPin) static constexpr float MinWind = 10.f; static constexpr float MaxWind = 32.f; - static constexpr float MinHeight = 20.f;// 40.f; - static constexpr float MaxHeight = 30.f;// 50.f; + static constexpr float MinHeight = 30.f;// 40.f; + static constexpr float MaxHeight = 50.f;// 50.f; const float HeightMultiplier = std::clamp((ballHeight - MinHeight) / (MaxHeight / MinHeight), 0.f, 1.f); float multiplier = std::clamp((distanceToPin - MinWind) / (MaxWind - MinWind), 0.f, 1.f); diff --git a/samples/golf/src/golf/GolfState.cpp b/samples/golf/src/golf/GolfState.cpp index 0d188af58..cd5447fe4 100644 --- a/samples/golf/src/golf/GolfState.cpp +++ b/samples/golf/src/golf/GolfState.cpp @@ -1063,37 +1063,37 @@ bool GolfState::handleEvent(const cro::Event& evt) } } - else if (evt.type == SDL_WINDOWEVENT) - { - switch (evt.window.event) - { - default: break; - case SDL_WINDOWEVENT_FOCUS_GAINED: - //this needs to be delayed a frame so mouse clicking on the - //open window doesn't get sent to the input parser - if (m_currentPlayer.client == m_sharedData.localConnectionData.connectionID - && !m_sharedData.localConnectionData.playerData[m_currentPlayer.player].isCPU) - { - auto entity = m_uiScene.createEntity(); - entity.addComponent().active = true; - entity.getComponent().function = - [&](cro::Entity e, float) - { - m_inputParser.setSuspended(false); - e.getComponent().active = false; - m_uiScene.destroyEntity(e); - }; - } - break; - case SDL_WINDOWEVENT_FOCUS_LOST: - if (m_currentPlayer.client == m_sharedData.localConnectionData.connectionID - && !m_sharedData.localConnectionData.playerData[m_currentPlayer.player].isCPU) - { - m_inputParser.setSuspended(true); - } - break; - } - } + //else if (evt.type == SDL_WINDOWEVENT) + //{ + // switch (evt.window.event) + // { + // default: break; + // case SDL_WINDOWEVENT_FOCUS_GAINED: + // //this needs to be delayed a frame so mouse clicking on the + // //open window doesn't get sent to the input parser + // if (m_currentPlayer.client == m_sharedData.localConnectionData.connectionID + // && !m_sharedData.localConnectionData.playerData[m_currentPlayer.player].isCPU) + // { + // auto entity = m_uiScene.createEntity(); + // entity.addComponent().active = true; + // entity.getComponent().function = + // [&](cro::Entity e, float) + // { + // m_inputParser.setSuspended(false); + // e.getComponent().active = false; + // m_uiScene.destroyEntity(e); + // }; + // } + // break; + // case SDL_WINDOWEVENT_FOCUS_LOST: + // if (m_currentPlayer.client == m_sharedData.localConnectionData.connectionID + // && !m_sharedData.localConnectionData.playerData[m_currentPlayer.player].isCPU) + // { + // m_inputParser.setSuspended(true); + // } + // break; + // } + //} m_gameScene.forwardEvent(evt); m_skyScene.forwardEvent(evt); diff --git a/samples/golf/src/golf/MenuConsts.hpp b/samples/golf/src/golf/MenuConsts.hpp index 0e6e2c552..7644f308a 100644 --- a/samples/golf/src/golf/MenuConsts.hpp +++ b/samples/golf/src/golf/MenuConsts.hpp @@ -95,12 +95,14 @@ static inline const std::array RuleDescriptions = #ifdef USE_GNS "The player with the fewest total strokes wins.\nSolo or network play scores contribute to the\nmonthly and all time leaderboards.\nContributes to the Club League.\n\nRecommended for solo play or 2+ players.", #else - "The player with the fewest total strokes wins.\nContributes to the Club League.\n\nRecommended for solo play or 2+ players", + "The player with the fewest total strokes wins.\nContributes to the Club League.\n\n\n\nRecommended for solo play or 2+ players", #endif "Stroke play rules, however par is scored at\n2 points, with one extra point awarded for every\nstroke under par. Max strokes are reached when\nthere are no more points available. The player with\nthe most points wins. Contributes to the Club League.\nRecommended for solo play or 2+ players.", "Stableford rules, however one point for every\nstroke over par is deducted instead of reaching\nthe stroke limit. The player with the most points wins.\nContributes to the Club League.\n\nRecommended for solo play or 2+ players.", - "Holes are scored individually by fewest strokes\n and one point is awarded for each hole won.\nThe player with the most points wins.\nGroup mode is ignored.\n\nA head to head round, 2 players only.", - "Holes are scored individually by fewest strokes.\nThe winner of the hole gets the skins pot,\nelse the pot rolls over to the next hole.\nTies are resolved with a sudden death round.\nGroup mode is ignored.\nMinimum 2 players, recommended for 2-4 players.", + "Holes are scored individually by fewest strokes\n and one point is awarded for each hole won.\nThe player with the most points wins.\n\n\nA head to head round, 2 players only.", + "Holes are scored individually by fewest strokes.\nThe winner of the hole gets the skins pot,\nelse the pot rolls over to the next hole.\nTies are resolved with a sudden death round.\n\nMinimum 2 players, recommended for 2-4 players.", + //"Holes are scored individually by fewest strokes\n and one point is awarded for each hole won.\nThe player with the most points wins.\nGroup mode is ignored.\n\nA head to head round, 2 players only.", + //"Holes are scored individually by fewest strokes.\nThe winner of the hole gets the skins pot,\nelse the pot rolls over to the next hole.\nTies are resolved with a sudden death round.\nGroup mode is ignored.\nMinimum 2 players, recommended for 2-4 players.", "Stroke play, but each player must hit the mid-point\ntarget before reaching the green. Not hitting the\ntarget forfeits the hole. Round times are usually\nlonger than average. Par is increased by one\non larger courses.\nRecommended for 2-4 players.", #ifdef USE_GNS "As stroke play, however the number of holes is\nreduced by 33% - 18 holes become 12 and 9 holes\nbecome 6. Ideal for casual games. User courses\nremain unaffected, and scores are omitted from\nthe leaderboards. Contributes to the Club League.\nRecommended for solo play or 2+ players.",