diff --git a/crogine/src/core/App.cpp b/crogine/src/core/App.cpp index 8b603ee8d..469e93a25 100644 --- a/crogine/src/core/App.cpp +++ b/crogine/src/core/App.cpp @@ -66,6 +66,8 @@ void winAbort(int) #include "../audio/AudioRenderer.hpp" #include +#include +#include #ifdef CRO_DEBUG_ #define DEBUG_NO_CONTROLLER @@ -490,7 +492,14 @@ void App::saveScreenshot() //flip row order stbi_flip_vertically_on_write(1); - std::string filename = "screenshot_" + SysTime::dateString() + "_" + SysTime::timeString() + ".png"; + auto d = SysTime::now(); + std::stringstream ss; + ss << std::setw(2) << std::setfill('0') << d.year() << "/" + << std::setw(2) << std::setfill('0') << d.months() << "/" + << d.days(); + + + std::string filename = "screenshot_" + ss.str() + "_" + SysTime::timeString() + ".png"; std::replace(filename.begin(), filename.end(), '/', '_'); std::replace(filename.begin(), filename.end(), ':', '_'); diff --git a/samples/golf/buildnumber.h b/samples/golf/buildnumber.h index d8e5c07d3..628e678b5 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 751 -#define BUILDNUMBER_STR "751" +#define BUILDNUMBER 760 +#define BUILDNUMBER_STR "760" #endif /* BUILD_NUMBER_H_ */ diff --git a/samples/golf/src/golf/DrivingStateUI.cpp b/samples/golf/src/golf/DrivingStateUI.cpp index 321ced905..8fe581bca 100644 --- a/samples/golf/src/golf/DrivingStateUI.cpp +++ b/samples/golf/src/golf/DrivingStateUI.cpp @@ -1993,7 +1993,7 @@ void DrivingState::createSummary() //info text auto infoEnt = m_uiScene.createEntity(); - infoEnt.addComponent().setPosition({ SummaryOffset, SummaryHeight, 0.02f }); + infoEnt.addComponent().setPosition({ /*SummaryOffset*/std::floor(bounds.width / 3.f) - 25.f, SummaryHeight, 0.02f}); infoEnt.addComponent(); infoEnt.addComponent(smallFont).setString("Sample Text\n1\n1\n1\n1\n1\n1\n1\n1"); infoEnt.getComponent().setCharacterSize(InfoTextSize); @@ -2002,7 +2002,7 @@ void DrivingState::createSummary() m_summaryScreen.text01 = infoEnt; infoEnt = m_uiScene.createEntity(); - infoEnt.addComponent().setPosition({ (bounds.width / 2.f) + SummaryOffset, SummaryHeight, 0.02f }); + infoEnt.addComponent().setPosition({ (bounds.width / 2.f) + 18.f/* SummaryOffset*/, SummaryHeight, 0.02f }); infoEnt.addComponent(); infoEnt.addComponent(smallFont).setString("Sample Text\n1\n1\n1\n1\n1\n1\n1\n1"); infoEnt.getComponent().setCharacterSize(InfoTextSize); @@ -2022,74 +2022,6 @@ void DrivingState::createSummary() - //displays the overview map - auto entity = m_uiScene.createEntity(); - entity.addComponent().setPosition({ std::floor(bounds.width / 6.f), 152.f, 0.3f }); - entity.getComponent().setOrigin(RangeSize / 4.f); - entity.addComponent(); - entity.addComponent(m_mapTexture.getTexture()); - bgEntity.getComponent().addChild(entity.getComponent()); - - auto mapEnt = entity; - entity = m_uiScene.createEntity(); - entity.addComponent().setPosition(mapEnt.getComponent().getOrigin()); - entity.addComponent(); - entity.addComponent() = spriteSheet.getSprite("minimap"); - auto border = entity.getComponent().getTextureBounds(); - entity.getComponent().setOrigin({ border.width / 2.f, border.height / 2.f, 0.1f }); - mapEnt.getComponent().addChild(entity.getComponent()); - - cro::SpriteSheet flagSheet; - flagSheet.loadFromFile("assets/golf/sprites/ui.spt", m_resources.textures); - auto flagEnt = m_uiScene.createEntity(); - flagEnt.addComponent().setOrigin({ 0.f, 0.f, -0.1f }); - flagEnt.addComponent(); - flagEnt.addComponent() = flagSheet.getSprite("flag03"); - - flagEnt.addComponent().active = !m_holeData.empty(); - flagEnt.getComponent().setUserData(0.f); - flagEnt.getComponent().function = - [&](cro::Entity e, float dt) - { - static constexpr glm::vec2 Offset(RangeSize / 4.f); - glm::vec2 flagPos(0.f); - - if (m_targetIndex == 0) - { - auto& currTime = e.getComponent().getUserData(); - currTime -= dt; - - if (currTime < 0.f) - { - currTime += 0.5f; - - static std::size_t idx = 0; - idx = (idx + cro::Util::Random::value(1, 3)) % m_holeData.size(); - - auto pos = m_holeData[idx].pin / 2.f; - flagPos = { pos.x, -pos.z }; - - flagPos += Offset; - e.getComponent().setPosition(flagPos); - } - } - else - { - auto pos = m_holeData[m_targetIndex - 1].pin / 2.f; - flagPos = { pos.x, -pos.z }; - - flagPos += Offset; - e.getComponent().setPosition(flagPos); - } - }; - - mapEnt.getComponent().addChild(flagEnt.getComponent()); - - - - - - cro::AudioScape as; as.loadFromFile("assets/golf/sound/menu.xas", m_resources.audio); m_summaryScreen.audioEnt = m_uiScene.createEntity(); @@ -2161,7 +2093,7 @@ void DrivingState::createSummary() auto selectedBounds = spriteSheet.getSprite("yes_highlight").getTextureRect(); auto unselectedBounds = spriteSheet.getSprite("yes_button").getTextureRect(); - entity = m_uiScene.createEntity(); + auto entity = m_uiScene.createEntity(); entity.addComponent().setPosition({ (bounds.width / 2.f) - 22.f, 48.f, 0.2f }); entity.addComponent(); entity.addComponent() = spriteSheet.getSprite("yes_button"); @@ -2541,17 +2473,22 @@ void DrivingState::showMessage(float range) float totalScore = 0.f; std::string summary; - for (auto i = 0; i < std::min(9, scoreCount); ++i) + auto j = 0; + for (j = 0; j < std::min(9, scoreCount); ++j) { - float score = director->getScore(i); + float score = director->getScore(j); std::stringstream s; s.precision(3); - s << "Turn " << i + 1 << ": " << score << "%\n"; + s << "Turn " << j + 1 << ": " << score << "%\n"; summary += s.str(); totalScore += score; } + for (; j < 9; ++j) + { + summary += "Turn " + std::to_string(j) + ": N/A\n"; + } m_summaryScreen.text01.getComponent().setString(summary); summary.clear(); @@ -2569,24 +2506,28 @@ void DrivingState::showMessage(float range) totalScore += score; } - m_summaryScreen.text02.getComponent().setString(summary); + /*m_summaryScreen.text02.getComponent().setString(summary); auto& tx = m_summaryScreen.text01.getComponent(); auto pos = tx.getPosition(); pos.x = SummaryOffset; tx.setPosition(pos); - tx.setOrigin({ 0.f, 0.f }); + tx.setOrigin({ 0.f, 0.f });*/ } else { - auto& tx = m_summaryScreen.text01.getComponent(); - auto pos = tx.getPosition(); - pos.x = 200.f; //TODO this should be half background width - tx.setPosition(pos); - centreText(m_summaryScreen.text01); + for (auto i = 10; i < 19; ++i) + { + summary += "Turn " + std::to_string(i) + ": N/A\n"; + } - m_summaryScreen.text02.getComponent().setString(" "); + //auto& tx = m_summaryScreen.text01.getComponent(); + //auto pos = tx.getPosition(); + //pos.x = 200.f; //TODO this should be half background width + //tx.setPosition(pos); + //centreText(m_summaryScreen.text01); } + m_summaryScreen.text02.getComponent().setString(summary); totalScore /= scoreCount; std::stringstream s;