Skip to content

Commit

Permalink
add user music volume to options
Browse files Browse the repository at this point in the history
add larger power bar to driving range when using steam deck
  • Loading branch information
fallahn committed Jul 11, 2023
1 parent b743c32 commit b2d263f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions samples/golf/buildnumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef BUILD_NUMBER_H_
#define BUILD_NUMBER_H_

#define BUILDNUMBER 684
#define BUILDNUMBER_STR "684"
#define BUILDNUMBER 685
#define BUILDNUMBER_STR "685"

#endif /* BUILD_NUMBER_H_ */
19 changes: 16 additions & 3 deletions samples/golf/src/golf/DrivingStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,17 @@ void DrivingState::createUI()
{
auto& [dir, currTime] = e.getComponent<cro::Callback>().getUserData<std::pair<std::int32_t, float>>();

#ifdef USE_GNS
const float ScaleMultiplier = Social::isSteamdeck() ? 2.f : 1.f;
#else
const float ScaleMultiplier = 1.f;
#endif

if (dir == 0)
{
//grow
currTime = std::min(1.f, currTime + dt);
const float scale = cro::Util::Easing::easeOutElastic(currTime);
const float scale = cro::Util::Easing::easeOutElastic(currTime) * ScaleMultiplier;

e.getComponent<cro::Transform>().setScale({ scale, scale });

Expand All @@ -546,9 +552,9 @@ void DrivingState::createUI()
{
//shrink
currTime = std::max(0.f, currTime - (dt * 2.f));
const float scale = cro::Util::Easing::easeOutBack(currTime);
const float scale = cro::Util::Easing::easeOutBack(currTime) * ScaleMultiplier;

e.getComponent<cro::Transform>().setScale({ scale, 1.f });
e.getComponent<cro::Transform>().setScale({ scale, ScaleMultiplier });

if (currTime == 0)
{
Expand Down Expand Up @@ -838,6 +844,13 @@ void DrivingState::createUI()

//relocate the power bar
auto uiPos = glm::vec2(uiSize.x / 2.f, UIBarHeight / 2.f);
#ifdef USE_GNS
if (Social::isSteamdeck())
{
uiPos.y *= 2.f;
spinEnt.getComponent<cro::Transform>().move({ 0.f, 32.f, 0.f });
}
#endif
rootNode.getComponent<cro::Transform>().setPosition(uiPos);
};

Expand Down
2 changes: 1 addition & 1 deletion samples/golf/src/golf/GolfStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ void GolfState::buildUI()
{
//shrink
currTime = std::max(0.f, currTime - (dt * 2.f));
const float scale = cro::Util::Easing::easeOutBack(currTime * ScaleMultiplier);
const float scale = cro::Util::Easing::easeOutBack(currTime) * ScaleMultiplier;

e.getComponent<cro::Transform>().setScale({ scale, ScaleMultiplier });

Expand Down
3 changes: 2 additions & 1 deletion samples/golf/src/golf/OptionsState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ namespace
"Menu Volume",
"Voice Volume",
"Vehicle Volume",
"Environment"
"Environment",
"User Music"
};
//generally static vars would be a bad idea, but in this case
//a static index value will remember the last channel between
Expand Down

0 comments on commit b2d263f

Please sign in to comment.