Skip to content

Commit

Permalink
Fixed cinematics align, fixed Android back button
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Jan 26, 2024
1 parent 8db9055 commit 59c3b1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Jazz2/UI/Cinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,16 @@ namespace Jazz2::UI
frameSize = Vector2f(viewSize.X, viewSize.X * ratio);
}

Vector2f frameOffset = (viewSize.As<float>() - frameSize) * 0.5f;
frameOffset.X = std::round(frameOffset.X);
frameOffset.Y = std::round(frameOffset.Y);

auto* instanceBlock = _renderCommand.material().uniformBlock(Material::InstanceBlockName);
instanceBlock->uniform(Material::TexRectUniformName)->setFloatValue(1.0f, 0.0f, 1.0f, 0.0f);
instanceBlock->uniform(Material::SpriteSizeUniformName)->setFloatVector(frameSize.Data());
instanceBlock->uniform(Material::ColorUniformName)->setFloatVector(Colorf::White.Data());

_renderCommand.setTransformation(Matrix4x4f::Translation(0.0f, 0.0f, 0.0f));
_renderCommand.setTransformation(Matrix4x4f::Translation(frameOffset.X, frameOffset.Y, 0.0f));
_renderCommand.material().setTexture(*_owner->_texture);

renderQueue.addCommand(&_renderCommand);
Expand Down
5 changes: 5 additions & 0 deletions Sources/Jazz2/UI/ControlScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ namespace Jazz2::UI
normalizedLength = std::clamp(normalizedLength, 0.0f, 1.0f);
result.Movement.Y = std::copysign(normalizedLength, result.Movement.Y);

// Allow native Android back button as menu key
if (PreferencesCache::UseNativeBackButton && pressedKeys[(uint32_t)KeySym::BACK]) {
result.PressedActions |= (1 << (int32_t)PlayerActions::Menu);
}

return result;
}

Expand Down
1 change: 1 addition & 0 deletions Sources/project.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
</provides>

<releases>
<release version="2.5.0" date="2024-01-26"/>
<release version="2.4.1" date="2023-12-28"/>
<release version="2.4.0" date="2023-12-19"/>
<release version="2.3.0" date="2023-11-26"/>
Expand Down

0 comments on commit 59c3b1c

Please sign in to comment.