Skip to content

Commit

Permalink
Merge pull request #457 from ASleepyCat/skin-func
Browse files Browse the repository at this point in the history
Use separate function to calculate console rotation offset
  • Loading branch information
Drewol authored Apr 22, 2021
2 parents 91cc9f1 + 5d229eb commit 2b867fa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/skins/Default/scripts/gameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,18 @@ end
-- -------------------------------------------------------------------------- --
-- GetCritLineCenteringOffset: --
-- Utility function which returns the magnitude of an offset to center the --
-- crit line on the screen based on its position and rotation. --
-- crit line on the screen based on its rotation. --
function GetCritLineCenteringOffset()
return gameplay.critLine.xOffset * 10
end
-- -------------------------------------------------------------------------- --
-- GetConsoleCenteringOffset: --
-- Utility function which returns the magnitude of an offset to center the --
-- console on the screen based on its position and rotation. --
function GetConsoleCenteringOffset()
return (resx / 2 - gameplay.critLine.x) * (5 / 6)
end
-- -------------------------------------------------------------------------- --
-- render_crit_base: --
-- Called after rendering the highway and playable objects, but before --
-- the built-in hit effects. --
Expand Down Expand Up @@ -594,13 +601,13 @@ function render_crit_overlay(deltaTime)

-- Figure out how to offset the center of the crit line to remain
-- centered on the players screen.
local xOffset = resx / 2 - gameplay.critLine.x
local xOffset = GetConsoleCenteringOffset()

-- When in portrait, we can draw the console at the bottom
if portrait then
-- We're going to make temporary modifications to the transform
gfx.Save()
gfx.Translate(xOffset * 0.85, 0)
gfx.Translate(xOffset, 0)

local bfw, bfh = gfx.ImageSize(bottomFill)

Expand Down

0 comments on commit 2b867fa

Please sign in to comment.