refactor dimensions to display

This commit is contained in:
Hersi 2024-02-02 02:50:48 +01:00
parent 8be5205e90
commit c1aecb7ca9
31 changed files with 327 additions and 412 deletions

View File

@ -1,37 +0,0 @@
---Member lookup helper function
---@param key string
---@param bases any
---@return any
local function search(key, bases)
for _, base in ipairs(bases) do
local v = base[key] -- try `i'-th superclass
if v then return v end
end
end
---Create polimorphic class
---@generic BaseT, T
---@param cls T # class metatable
---@param params? table # initial parameters
---@param ... BaseT # base class metatables (if any)
---@return T # class instance
function CreateInstance(cls, params, ...)
params = params or {}
local nargs = select("#", ...)
local vargs = { select(1, ...) }
cls.__index = cls
if nargs == 1 then
-- single inheritance
local base = vargs[1]
setmetatable(cls, {__index = base})
params = base.new(params)
elseif nargs > 1 then
-- multiple inheritance (note: slow(er) member lookup)
setmetatable(cls, {__index = function(t, k) return search(k, vargs) end})
for _, base in ipairs(vargs) do
params = base.new(params)
end
end
setmetatable(params, cls)
return params
end

View File

@ -1,10 +1,10 @@
local VolforceWindow = require('components.volforceWindow')
local Dimensions = require 'scripts.graphics.dimensions';
local Display = require 'scripts.graphics.display';
do
local resx, resy = game.GetResolution();
Dimensions.updateResolution(resx / resy);
Display.updateResolution(resx / resy);
end
local Banner = require('gameplay.banner')
@ -33,7 +33,7 @@ local score = 0;
function render(deltaTime)
local resx, resy = game.GetResolution();
Dimensions.updateResolution(resx / resy);
Display.updateResolution(resx / resy);
Banner.render(deltaTime, users, gameplay.user_id);

View File

@ -1,5 +1,5 @@
local Dimensions = require 'scripts.graphics.dimensions'
local Display = require 'scripts.graphics.display'
local consoleBaseImage = gfx.CreateSkinImage("gameplay/console/base.png", 0)
@ -12,7 +12,7 @@ local render = function (deltaTime, critLineCenterX, critLineCenterY, critLineRo
return
end
Dimensions.setUpTransforms(
Display.setUpTransforms(
critLineCenterX,
critLineCenterY,
critLineRotation

View File

@ -1,5 +1,5 @@
local Dimensions = require 'scripts.graphics.dimensions'
local Display = require 'scripts.graphics.display'
local blackGradientImage = gfx.CreateSkinImage('gameplay/crit_line/black_gradient.png', 0)
@ -84,7 +84,7 @@ local drawCursors = function (centerX, centerY,cursors)
end
local renderBase = function (deltaTime, centerX, centerY, rotation, cursors)
scale, isLandscape = Dimensions.setUpTransforms(centerX, centerY, rotation)
scale, isLandscape = Display.setUpTransforms(centerX, centerY, rotation)
gfx.BeginPath()
gfx.FillColor(0, 0, 0, 192)

View File

@ -1,7 +1,7 @@
require 'common.globals'
local Dimensions = require 'scripts.graphics.dimensions'
local Display = require 'scripts.graphics.display'
local Animation = require 'scripts.graphics.frameanimation'
@ -37,7 +37,7 @@ local function setupLaneTransform(lanePosition, critCenterX, critCenterY)
local critLine = gameplay.critLine;
local x = critCenterX + (critLine.line.x2 - critLine.line.x1) * lanePosition;
local y = critCenterY + (critLine.line.y2 - critLine.line.y1) * lanePosition;
Dimensions.setUpTransforms(x, y, -critLine.rotation);
Display.setUpTransforms(x, y, -critLine.rotation);
end
function HitFX.render(deltaTime, critCenterX, critCenterY, critRotation, cursors)

View File

@ -1,179 +1,136 @@
local resx, resy = game.GetResolution()
local desw, desh = 1080,1920;
local scale = 1;
local Display = require("scripts.graphics.display")
local BAR_ALPHA = 191;
---@class Background
local Background = {
-- Images
local FOOTER_HEIGHT = 128
local footerY = desh - FOOTER_HEIGHT;
bgBaseImage = gfx.CreateSkinImage("components/background/bg.png", 0),
dotsOverlayImage = gfx.CreateSkinImage("components/background/dots.png", 0),
-- Images
local bgBaseImage = gfx.CreateSkinImage("components/background/bg.png", 0);
local dotsOverlayImage = gfx.CreateSkinImage("components/background/dots.png", 0);
valkRasisImage = gfx.CreateSkinImage("components/background/rasis_panel.png", 0),
valkGraceImage = gfx.CreateSkinImage("components/background/grace_panel.png", 0),
local valkRasisImage = gfx.CreateSkinImage("components/background/rasis_panel.png", 0);
local valkGraceImage = gfx.CreateSkinImage("components/background/grace_panel.png", 0);
mainRingImage = gfx.CreateSkinImage("components/background/main_ring.png", 0),
local mainRingImage = gfx.CreateSkinImage("components/background/main_ring.png", 0);
blueFlareImage = gfx.CreateSkinImage("components/background/blue_flare.png", 0),
pinkFlareImage = gfx.CreateSkinImage("components/background/pink_flare.png", 0),
local blueFlareImage = gfx.CreateSkinImage("components/background/blue_flare.png", 0);
local pinkFlareImage = gfx.CreateSkinImage("components/background/pink_flare.png", 0);
hexagonImages = {
gfx.CreateSkinImage("components/background/hex1.png", 0),
gfx.CreateSkinImage("components/background/hex2.png", 0),
gfx.CreateSkinImage("components/background/hex3.png", 0)
},
local hexagonImages = {
gfx.CreateSkinImage("components/background/hex1.png", 0),
gfx.CreateSkinImage("components/background/hex2.png", 0),
gfx.CreateSkinImage("components/background/hex3.png", 0)
-- Animation related
animationProgress = 0
}
-- Animation related
local transitionRotateScale = 0;
function Background:drawValkyrie(spinProgressionScale, valkImage)
local w = 1390 * 0.7
local h = 3356 * 0.7
local piProgression = spinProgressionScale * 2 * math.pi
local distanceScaleMultiplier = 0.3 + 0.7 * ((1 + math.sin(piProgression)) / 2)
function resetLayoutInformation()
resx, resy = game.GetResolution()
desw = 1080
desh = 1920
scale = resx / desw
end
local xScale = math.sin(piProgression) * distanceScaleMultiplier;
local yScale = 1 * distanceScaleMultiplier
local drawValkyrie = function (spinProgressionScale, valkImage)
gfx.Save()
gfx.BeginPath()
local w = 1390*0.7;
local h = 3356*0.7
local piProgression = spinProgressionScale*2*math.pi
local xTranslate = math.sin(piProgression + 2) * 0.6 * Display.design.width + 0.3 * Display.design.width
local yTranslate = (1 - distanceScaleMultiplier) * Display.design.height * 0.4
gfx.Translate(xTranslate, yTranslate)
local distanceScaleMultiplier = 0.3 + 0.7*((1+math.sin(piProgression))/2)
local xScale = math.sin(piProgression)*distanceScaleMultiplier;
local yScale = 1*distanceScaleMultiplier
gfx.Translate(math.sin(piProgression+2)*0.6*desw+0.3*desw, (1-distanceScaleMultiplier)*desh*0.4) -- -math.sin(piProgression+2)*0.1*desh+desh*0.1
-- gfx.Scale(xScale, yScale)
gfx.SkewY(
(
1 +
math.sin(
piProgression +
0.5 *
math.pi
)
) / 2
* -0.3)
-- gfx.Scale(xScale, yScale)
gfx.SkewY((1 + math.sin(piProgression + 0.5 * math.pi)) / 2 * -0.3)
--gfx.SkewX(-math.sin(piProgression)*0.2)
gfx.ImageRect(0, 0, w*xScale, h*yScale, valkImage, 0.5, 0);
gfx.Restore()
gfx.ImageRect(0, 0, w * xScale, h * yScale, valkImage, 0.5, 0);
gfx.Restore()
-- ===================== Draw the inner one
gfx.Save()
gfx.BeginPath()
local w = 1390*0.7;
local h = 3356*0.7
local piProgression = spinProgressionScale*2*math.pi
xTranslate = math.sin(piProgression + 2) * 0.57 * Display.design.width + 0.3 * Display.design.width
yTranslate = (1 - distanceScaleMultiplier) * Display.design.height * 0.4
gfx.Translate(xTranslate, yTranslate)
local distanceScaleMultiplier = 0.3 + 0.7*((1+math.sin(piProgression))/2)
local xScale = math.sin(piProgression)*distanceScaleMultiplier;
local yScale = 1*distanceScaleMultiplier
gfx.Translate(math.sin(piProgression+2)*0.57*desw+0.3*desw, (1-distanceScaleMultiplier)*desh*0.4) -- -math.sin(piProgression+2)*0.1*desh+desh*0.1
-- gfx.Scale(xScale, yScale)
gfx.SkewY(
(
1 +
math.sin(
piProgression +
0.5 *
math.pi
)
) / 2
* -0.3)
-- gfx.Scale(xScale, yScale)
gfx.SkewY((1 + math.sin(piProgression + 0.5 * math.pi)) / 2 * -0.3)
--gfx.SkewX(-math.sin(piProgression)*0.2)
gfx.ImageRect(0, 0, w*xScale, h*yScale, valkImage, 0.5, 0);
gfx.Restore()
gfx.ImageRect(0, 0, w * xScale, h * yScale, valkImage, 0.5, 0);
gfx.Restore()
end
local drawValkyries = function ()
function Background:drawValkyries()
gfx.Save()
gfx.BeginPath()
local piProgression = transitionRotateScale*2*math.pi
gfx.Rotate(-0.3)
drawValkyrie(transitionRotateScale, valkRasisImage)
self:drawValkyrie(self.animationProgress, self.valkRasisImage)
self:drawValkyrie(self.animationProgress + 0.25, self.valkGraceImage)
self:drawValkyrie(self.animationProgress + 0.50, self.valkRasisImage)
self:drawValkyrie(self.animationProgress + 0.75, self.valkGraceImage)
drawValkyrie(transitionRotateScale+0.25, valkGraceImage)
drawValkyrie(transitionRotateScale+0.5, valkRasisImage)
drawValkyrie(transitionRotateScale+0.75, valkGraceImage)
gfx.Restore()
end
local drawRings = function ()
function Background:drawRings()
gfx.Save()
gfx.BeginPath()
gfx.SkewX(-0.95)
gfx.Translate(675,225)
gfx.Translate(675, 225)
gfx.Rotate(-transitionRotateScale*2*math.pi);
gfx.Translate(-200,-200)
gfx.Rotate(-self.animationProgress * 2 * math.pi);
gfx.Translate(-200, -200)
gfx.ImageRect(0, 0, 400, 400, mainRingImage, 0.5, 0);
gfx.ImageRect(0, 0, 400, 400, self.mainRingImage, 0.5, 0);
gfx.Restore()
end
local drawHexagons = function ()
gfx.BeginPath()
gfx.ImageRect(0, 0, desw, desh, hexagonImages[1], 1, 0);
gfx.ImageRect(0, 0, desw, desh, hexagonImages[2], 1, 0);
gfx.ImageRect(0, 0, desw, desh, hexagonImages[3], 1, 0);
end
local drawFlares = function ()
gfx.BeginPath()
gfx.ImageRect(0, 0, desw, desh, blueFlareImage, 1, 0);
gfx.ImageRect(0, 0, desw, desh, pinkFlareImage, 1, 0);
function Background:drawHexagons()
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.hexagonImages[1], 1, 0);
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.hexagonImages[2], 1, 0);
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.hexagonImages[3], 1, 0);
end
local drawBackground = function ()
gfx.BeginPath();
gfx.ImageRect(0, 0, desw, desh, bgBaseImage, 1, 0);
drawRings();
drawHexagons();
drawFlares();
drawValkyries();
gfx.BeginPath();
gfx.ImageRect(0, 0, desw, desh, dotsOverlayImage, 1, 0);
function Background:drawFlares()
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.blueFlareImage, 1, 0);
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.pinkFlareImage, 1, 0);
end
local progressTransitions = function (deltaTime)
transitionRotateScale = transitionRotateScale + deltaTime / 20;
if (transitionRotateScale > 1) then
transitionRotateScale = 0;
function Background:render()
gfx.Save()
gfx.ResetTransform()
Display.transformToScreenSpace()
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.bgBaseImage, 1, 0);
self:drawRings();
self:drawHexagons();
self:drawFlares();
self:drawValkyries();
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, self.dotsOverlayImage, 1, 0);
gfx.Restore()
end
function Background:update(deltaTime)
Display.updateResolution()
self.animationProgress = self.animationProgress + deltaTime / 20;
if (self.animationProgress > 1) then
self.animationProgress = 0;
end
end
local draw = function (deltaTime)
gfx.Save()
-- resetLayoutInformation()
-- gfx.Scale(scale, scale)
drawBackground();
progressTransitions(deltaTime);
gfx.Restore()
end
return {
draw = draw
};
Background = Background
}

View File

@ -1,64 +0,0 @@
local difficultyLabelImages = {
gfx.CreateSkinImage("diff/1 novice.png", 0),
gfx.CreateSkinImage("diff/2 advanced.png", 0),
gfx.CreateSkinImage("diff/3 exhaust.png", 0),
gfx.CreateSkinImage("diff/4 maximum.png", 0),
gfx.CreateSkinImage("diff/5 infinite.png", 0),
gfx.CreateSkinImage("diff/6 gravity.png", 0),
gfx.CreateSkinImage("diff/7 heavenly.png", 0),
gfx.CreateSkinImage("diff/8 vivid.png", 0)
}
local difficultyLabelTexts = {
"NOV",
"ADV",
"EXH",
"MXM",
"INF",
"GRV",
"HVN",
"VVD"
}
function render(deltatime, x, y, scale, diff, level)
gfx.Save()
gfx.Translate(x,y);
gfx.Scale(scale,scale)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.BeginPath();
gfx.ImageRect(0, 0, 140, 31 ,
difficultyLabelImages[diff] or
difficultyLabelImages[4], 1, 0);
gfx.FontSize(24)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(level, 120, 16);
gfx.FontSize(22)
gfx.Scale(1.2,1); -- Make the diff text more W I D E
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(difficultyLabelTexts[diff], 18, 17);
-- -- Draw volforce badge
-- gfx.BeginPath();
-- gfx.ImageRect(x, y, 42, 42, volforceBadgeImage, 1, 0);
-- -- Draw volforce label
-- gfx.FontSize(11)
-- gfx.Text('VOLFORCE', x + 47, y + 14);
gfx.ResetTransform()
gfx.Restore()
end
return {
render = render
}

View File

@ -0,0 +1,62 @@
local DiffRect = {
DIFF_BG = {
gfx.CreateSkinImage("diff/1 novice.png", 0),
gfx.CreateSkinImage("diff/2 advanced.png", 0),
gfx.CreateSkinImage("diff/3 exhaust.png", 0),
gfx.CreateSkinImage("diff/4 maximum.png", 0),
gfx.CreateSkinImage("diff/5 infinite.png", 0),
gfx.CreateSkinImage("diff/6 gravity.png", 0),
gfx.CreateSkinImage("diff/7 heavenly.png", 0),
gfx.CreateSkinImage("diff/8 vivid.png", 0)
},
DIFF_TXT = {
"NOV",
"ADV",
"EXH",
"MXM",
"INF",
"GRV",
"HVN",
"VVD"
}
}
function DiffRect.render(deltatime, x, y, scale, diff, level)
gfx.Save()
gfx.Translate(x, y);
gfx.Scale(scale, scale)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.BeginPath();
gfx.ImageRect(0, 0, 140, 31, DiffRect.DIFF_BG[diff] or DiffRect.DIFF_BG[4], 1, 0);
gfx.FontSize(24)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(level, 120, 16);
gfx.FontSize(22)
gfx.Scale(1.2, 1); -- Make the diff text more W I D E
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(DiffRect.DIFF_TXT[diff], 18, 17);
-- -- Draw volforce badge
-- gfx.BeginPath();
-- gfx.ImageRect(x, y, 42, 42, volforceBadgeImage, 1, 0);
-- -- Draw volforce label
-- gfx.FontSize(11)
-- gfx.Text('VOLFORCE', x + 47, y + 14);
gfx.ResetTransform()
gfx.Restore()
end
return {
DiffRect = DiffRect
}

View File

@ -1,23 +1,23 @@
local dimtable = {
local Display = {
design = {width = 1080, height = 1920},
screen = {width = nil, height = nil},
view = {width = nil, height = nil},
ratio = {landscapeUW = 21 / 9, landscapeWide = 16 / 9, landscapeStd = 4 / 3, portrait = 9 / 16},
}
dimtable.transformToScreenSpace = function()
gfx.Translate((dimtable.screen.width - dimtable.view.width) / 2, 0);
gfx.Scale(dimtable.view.width / dimtable.design.width, dimtable.view.height / dimtable.design.height);
gfx.Scissor(0, 0, dimtable.design.width, dimtable.design.height);
function Display.transformToScreenSpace()
gfx.Translate((Display.screen.width - Display.view.width) / 2, 0);
gfx.Scale(Display.view.width / Display.design.width, Display.view.height / Display.design.height);
gfx.Scissor(0, 0, Display.design.width, Display.design.height);
end
dimtable.updateResolution = function(ratio)
if not ratio then ratio = dimtable.ratio.portrait end
function Display.updateResolution(ratio)
if not ratio then ratio = Display.ratio.portrait end
local screenWidth, screenHeight = game.GetResolution()
if screenWidth ~= dimtable.screen.width or screenHeight ~= dimtable.screen.height then
dimtable.screen.width, dimtable.screen.height = screenWidth, screenHeight
dimtable.view.width, dimtable.view.height = ratio * dimtable.screen.height, dimtable.screen.height
if screenWidth ~= Display.screen.width or screenHeight ~= Display.screen.height then
Display.screen.width, Display.screen.height = screenWidth, screenHeight
Display.view.width, Display.view.height = ratio * Display.screen.height, Display.screen.height
end
end
@ -27,14 +27,14 @@ end
---@param offsetX? number Viewport offset from the left side (defaults to the portrait viewport offset)
---@param offsetY? number Viewport offset from the top side (defaults to 0)
---@return number, number
dimtable.toViewSpace = function(screenX, screenY, offsetX, offsetY)
offsetX = offsetX or (dimtable.screen.width - dimtable.view.width) / 2
function Display.toViewSpace(screenX, screenY, offsetX, offsetY)
offsetX = offsetX or (Display.screen.width - Display.view.width) / 2
offsetY = offsetY or 0
local viewX, viewY, scaleX, scaleY
scaleX = dimtable.design.width / dimtable.view.width
scaleY = dimtable.design.height / dimtable.view.height
scaleX = Display.design.width / Display.view.width
scaleY = Display.design.height / Display.view.height
viewX = (screenX - offsetX) * scaleX
viewY = (screenY - offsetY) * scaleY
@ -47,9 +47,9 @@ end
---@param y number
---@param rotation number
---@return number, boolean # The scale applied to the transform and the current landscape state
function dimtable.setUpTransforms(x, y, rotation)
local scale = dimtable.screen.width / dimtable.view.width;
local isLandscape = dimtable.view.width > dimtable.view.height;
function Display.setUpTransforms(x, y, rotation)
local scale = Display.screen.width / Display.view.width;
local isLandscape = Display.view.width > Display.view.height;
gfx.ResetTransform();
gfx.Translate(x, y);
@ -59,4 +59,4 @@ function dimtable.setUpTransforms(x, y, rotation)
return scale, isLandscape;
end
return dimtable
return Display

View File

@ -1,10 +1,10 @@
local version = require("common.version")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local BAR_ALPHA = 191
local FOOTER_HEIGHT = 128
local footerY = Dim.design.height - FOOTER_HEIGHT
local footerY = Display.design.height - FOOTER_HEIGHT
-- Images
local footerRightImage = gfx.CreateSkinImage("components/bars/footer_right.png", 0)
@ -20,11 +20,11 @@ local function set() end
local function drawFooter()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, footerY, Dim.design.width, FOOTER_HEIGHT)
gfx.Rect(0, footerY, Display.design.width, FOOTER_HEIGHT)
gfx.Fill()
gfx.BeginPath()
gfx.ImageRect(Dim.design.width - 275, footerY - 25, 328 * 0.85, 188 * 0.85, footerRightImage, 1, 0)
gfx.ImageRect(Display.design.width - 275, footerY - 25, 328 * 0.85, 188 * 0.85, footerRightImage, 1, 0)
gfx.BeginPath()
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
@ -39,7 +39,7 @@ local function progressTransitions(deltaTime)
if (entryTransitionScale > 1) then entryTransitionScale = 1 end
entryTransitionFooterYOffset = FOOTER_HEIGHT * (1 - entryTransitionScale)
footerY = Dim.design.height - FOOTER_HEIGHT + entryTransitionFooterYOffset
footerY = Display.design.height - FOOTER_HEIGHT + entryTransitionFooterYOffset
end
local function draw(deltaTime, params)
@ -51,9 +51,9 @@ local function draw(deltaTime, params)
gfx.ResetTransform()
Dim.updateResolution()
Display.updateResolution()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
gfx.LoadSkinFont("NotoSans-Regular.ttf")

View File

@ -1,4 +1,4 @@
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local BAR_ALPHA = 191
@ -13,12 +13,12 @@ local headerTitleImage = gfx.CreateSkinImage("challenge_select/skill_analyzer.pn
local function drawHeader()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, 0, Dim.design.width, HEADER_HEIGHT)
gfx.Rect(0, 0, Display.design.width, HEADER_HEIGHT)
gfx.Fill()
gfx.ClosePath()
local headerImageWidth, headerImageHeight = gfx.ImageSize(headerTitleImage)
gfx.ImageRect((Dim.design.width - headerImageWidth) / 2, (HEADER_HEIGHT - headerImageHeight) / 2 - 12, -- asset png is not centered on the y axis
gfx.ImageRect((Display.design.width - headerImageWidth) / 2, (HEADER_HEIGHT - headerImageHeight) / 2 - 12, -- asset png is not centered on the y axis
headerImageWidth, headerImageHeight, headerTitleImage, 1, 0)
end
@ -43,9 +43,9 @@ local function draw(deltatime)
gfx.ResetTransform()
Dim.updateResolution()
Display.updateResolution()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
gfx.LoadSkinFont("NotoSans-Regular.ttf")

View File

@ -1,5 +1,5 @@
require "common.globals"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
local BAR_ALPHA = 191
@ -7,12 +7,12 @@ local HEADER_HEIGHT = 100
local titleImage = Image.new("titlescreen/title.png")
titleImage.centered = true
titleImage:setPosition(Dim.design.width / 2, HEADER_HEIGHT / 2)
titleImage:setPosition(Display.design.width / 2, HEADER_HEIGHT / 2)
local function drawHeader()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, 0, Dim.design.width, HEADER_HEIGHT)
gfx.Rect(0, 0, Display.design.width, HEADER_HEIGHT)
gfx.Fill()
titleImage:render()
@ -23,7 +23,7 @@ local function draw()
gfx.ResetTransform()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
drawHeader()

View File

@ -1,4 +1,4 @@
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local BAR_ALPHA = 191
@ -14,7 +14,7 @@ local headerGlowTitleImage = gfx.CreateSkinImage("song_select/header/title_glow.
local drawHeader = function()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, 0, Dim.design.width, HEADER_HEIGHT)
gfx.Rect(0, 0, Display.design.width, HEADER_HEIGHT)
gfx.Fill()
gfx.ClosePath()
@ -43,9 +43,9 @@ local draw = function(deltatime)
gfx.ResetTransform()
Dim.updateResolution()
Display.updateResolution()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
gfx.LoadSkinFont("NotoSans-Regular.ttf")

View File

@ -1,4 +1,4 @@
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local backgroundImage = gfx.CreateSkinImage("bg_pattern.png", gfx.IMAGE_REPEATX | gfx.IMAGE_REPEATY)
local bgImageWidth, bgImageHeight = gfx.ImageSize(backgroundImage)
@ -11,7 +11,7 @@ function render()
gfx.ResetTransform()
gfx.BeginPath()
gfx.Rect(0, 0, Dim.screen.width, Dim.screen.height)
gfx.Rect(0, 0, Display.screen.width, Display.screen.height)
gfx.FillPaint(gfx.ImagePattern(0, 0, bgImageWidth, bgImageHeight, patternAngle, backgroundImage, patternAlpha))
gfx.Fill()

View File

@ -1,5 +1,5 @@
local Easing = require('scripts.core.libb.easing')
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local SongSelectHeader = require('components.headers.songSelectHeader')
local Footer = require('components.footer')
@ -398,9 +398,9 @@ render = function(deltaTime, shown)
game.SetSkinSetting('_songWheelActiveFolderLabel', getFolderData(filters.folder[selectedFolder]).label)
game.SetSkinSetting('_songWheelActiveSubFolderLabel', getFolderData(filters.level[selectedLevel]).label)
Dim.updateResolution()
Display.updateResolution()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
gfx.GlobalAlpha(1)

View File

@ -1,7 +1,7 @@
local Charting = require('common.charting')
local Easing = require('scripts.core.libb.easing')
local Background = require('components.background')
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local Wallpaper = require("components.wallpaper")
local common = require('common.util')
local Sound = require("common.sound")
@ -1104,11 +1104,11 @@ render = function (deltaTime)
Sound.stopMusic()
Dim.updateResolution()
Display.updateResolution()
Wallpaper.render()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
draw_songwheel(deltaTime)

View File

@ -1,6 +1,6 @@
require "common.globals"
local Common = require "common.util"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Wallpaper = require "components.wallpaper"
local PageView = require "api.page.pageview"
@ -130,11 +130,11 @@ end
function render(deltaTime)
handleKnobs()
Dim.updateResolution()
Display.updateResolution()
Wallpaper.render()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
pageView:render(deltaTime)
end

View File

@ -1,7 +1,7 @@
require "common.globals"
require "common.class"
require "common.filereader"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Version = require "common.version"
local PageManager = require "api.page.pagemanager"
@ -114,7 +114,7 @@ end
function BootPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(0, 0, 0)
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end

View File

@ -1,5 +1,5 @@
require("common.class")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local Page = require("api.page.page")
local CheckUpdateField = require("titlescreen.boot.checkupdatefield")
local DialogField = require("titlescreen.boot.dialogfield")
@ -18,8 +18,8 @@ function CheckUpdatePage.new(params)
local width = DialogField.DEFAULT_WIDTH
local height = DialogField.DEFAULT_HEIGHT
local posX = (Dim.design.width - width) / 2
local posY = (Dim.design.height - height) / 2
local posX = (Display.design.width - width) / 2
local posY = (Display.design.height - height) / 2
self._updateDialogField = DialogField.new{
posX = posX,
posY = posY,
@ -87,7 +87,7 @@ end
function CheckUpdatePage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(0, 0, 0)
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end

View File

@ -1,11 +1,15 @@
require("common.globals")
require("common.class")
---@class Page
---@field content Field[]
---@field viewHandler nil|PageView
local Page = {
__name = "Page",
---Event callback on page initialization
onInit = function () end,
---Event callback on page invalidation
---@param reason? any # reason for the invalidation
onInvalidation = function (reason) end,
}
---Create a new Page instance
@ -19,7 +23,7 @@ function Page.new(params)
params.content = params.content or {}
params.viewHandler = params.viewHandler or nil
return CreateInstance(Page, params)
return params
end
---Initialize Page
@ -59,13 +63,6 @@ function Page:handleKnobInput(knob, delta) end
---@param button integer
function Page:handleMouseInput(x, y, button) end
---Event callback on page initialization
function Page:onInit() end
---Event callback on page invalidation
---@param reason? any # reason for the invalidation
function Page:onInvalidation(reason) end
---@param deltaTime number # frametime in seconds
function Page:drawBackground(deltaTime) end

View File

@ -1,5 +1,5 @@
require("common.class")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local Field = require("api.page.field")
---@class ServiceField: Field
@ -33,7 +33,7 @@ function ServiceField.new(params)
local h = ServiceField.FONT_SIZE + ServiceField.MARGIN[2] + ServiceField.MARGIN[4]
params.aabbH = params.aabbH or h
params.aabbW = params.aabbW or Dim.design.width --:shrug:
params.aabbW = params.aabbW or Display.design.width --:shrug:
params.label = params.label or "<UNDEFINED>"
params.value = params.value or nil

View File

@ -1,5 +1,5 @@
require("common.class")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local Util = require("common.util")
local Page = require("api.page.page")
local ServiceField = require("api.page.servicefield")
@ -102,7 +102,7 @@ end
function ServicePage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(0, 0, 0)
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
@ -110,8 +110,8 @@ end
function ServicePage:drawContent(deltaTime)
gfx.Save()
gfx.Translate(self.PADDING[1], self.PADDING[2])
local contentW = Dim.design.width - self.PADDING[1] - self.PADDING[3]
local contentH = Dim.design.height - self.PADDING[2] - self.PADDING[4]
local contentW = Display.design.width - self.PADDING[1] - self.PADDING[3]
local contentH = Display.design.height - self.PADDING[2] - self.PADDING[4]
gfx.Scissor(0, 0, contentW, contentH)
Page.drawContent(self, deltaTime)
gfx.Restore()
@ -127,10 +127,10 @@ function ServicePage:drawHeader(deltaTime)
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER | gfx.TEXT_ALIGN_TOP)
if type(self.title) == "table" then
for index, line in ipairs(self.title) do
gfx.Text(line, Dim.design.width / 2, (index-1) * lineHeight)
gfx.Text(line, Display.design.width / 2, (index-1) * lineHeight)
end
elseif type(self.title) == "string" then
gfx.Text(self.title, Dim.design.width / 2, 0)
gfx.Text(self.title, Display.design.width / 2, 0)
end
end
@ -147,10 +147,10 @@ function ServicePage:drawFooter(deltaTime)
if type(footer) == "table" then
local yFooterBase = -#footer * lineHeight
for index, line in ipairs(footer) do
gfx.Text(line, Dim.design.width / 2, yFooterBase + (index-1) * lineHeight)
gfx.Text(line, Display.design.width / 2, yFooterBase + (index-1) * lineHeight)
end
elseif type(footer) == "string" then
gfx.Text(footer, Dim.design.width / 2, 0)
gfx.Text(footer, Display.design.width / 2, 0)
end
end
@ -162,7 +162,7 @@ function ServicePage:drawForeground(deltaTime)
gfx.Restore()
gfx.Save()
gfx.Translate(0, Dim.design.height - self.PAGE_PADDING[4])
gfx.Translate(0, Display.design.height - self.PAGE_PADDING[4])
self:drawFooter(deltaTime)
gfx.Restore()
end

View File

@ -4,7 +4,7 @@ require "common.class"
local Footer = require("components.footer")
local Wallpaper = require("components.wallpaper")
local Background = require("components.background")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local lang = require("language")
local util = require("common.util")
@ -94,44 +94,44 @@ local buttons = {
local miscButtons = {
upArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight + 4,
x = Display.design.width - 265,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight + 4,
w = 64,
h = 36
},
downArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + buttonHeight / 2 + 28,
x = Display.design.width - 265,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + buttonHeight / 2 + 28,
w = 64,
h = 36
},
mainButton = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight / 2 - 28,
x = Display.design.width - 512,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight / 2 - 28,
w = 505,
h = 196
},
upButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight,
x = Display.design.width - 512,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight,
w = 1026 / 2,
h = 257 / 2
},
upButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight * 2,
x = Display.design.width - 512,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight * 2,
w = 1026 / 2,
h = 257 / 2
},
downButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + 10,
x = Display.design.width - 512,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + 10,
w = 1026 / 2,
h = 257 / 2
},
downButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + buttonHeight + 10,
x = Display.design.width - 512,
y = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + buttonHeight + 10,
w = 1026 / 2,
h = 257 / 2
},
@ -232,32 +232,32 @@ local function draw_buttons()
getCorrectedButtonIndex(cursorIndex, 2),
}
local yBase = Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER
local yBase = Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER
local centerButtonY = yBase - buttonHeight / 2 - 28 -- to fit with the selector bg
local marginFromDesHCenter = 128
if scrollingUp then
draw_button(buttons[indexes[5]], Dim.design.width - 512, yBase - marginFromDesHCenter - buttonHeight * 3, false,
draw_button(buttons[indexes[5]], Display.design.width - 512, yBase - marginFromDesHCenter - buttonHeight * 3, false,
0) -- Placeholder for fadeout transition
end
draw_button(buttons[indexes[1]], Dim.design.width - 512, yBase - marginFromDesHCenter - buttonHeight * 2, false, 1)
draw_button(buttons[indexes[2]], Dim.design.width - 512, yBase - marginFromDesHCenter - buttonHeight, false, 2)
draw_button(buttons[indexes[1]], Display.design.width - 512, yBase - marginFromDesHCenter - buttonHeight * 2, false, 1)
draw_button(buttons[indexes[2]], Display.design.width - 512, yBase - marginFromDesHCenter - buttonHeight, false, 2)
draw_button(buttons[indexes[3]], Dim.design.width - 512, centerButtonY, true) -- The main selected center button
draw_button(buttons[indexes[3]], Display.design.width - 512, centerButtonY, true) -- The main selected center button
if scrollingUp then
draw_button(buttons[indexes[3]], Dim.design.width - 512, yBase + marginFromDesHCenter - buttonHeight, false, 3) -- Placeholder for transition that goes to the bottom
draw_button(buttons[indexes[3]], Display.design.width - 512, yBase + marginFromDesHCenter - buttonHeight, false, 3) -- Placeholder for transition that goes to the bottom
else
draw_button(buttons[indexes[3]], Dim.design.width - 512, centerButtonY, false, 3) -- Placeholder for transition that goes to the top
draw_button(buttons[indexes[3]], Display.design.width - 512, centerButtonY, false, 3) -- Placeholder for transition that goes to the top
end
draw_button(buttons[indexes[4]], Dim.design.width - 512, yBase + marginFromDesHCenter + 10, false, 4)
draw_button(buttons[indexes[5]], Dim.design.width - 512, yBase + marginFromDesHCenter + buttonHeight + 10, false, 5)
draw_button(buttons[indexes[4]], Display.design.width - 512, yBase + marginFromDesHCenter + 10, false, 4)
draw_button(buttons[indexes[5]], Display.design.width - 512, yBase + marginFromDesHCenter + buttonHeight + 10, false, 5)
if not scrollingUp then
draw_button(buttons[indexes[1]], Dim.design.width - 512, yBase + marginFromDesHCenter + buttonHeight * 2, false,
draw_button(buttons[indexes[1]], Display.design.width - 512, yBase + marginFromDesHCenter + buttonHeight * 2, false,
6)
end
end
@ -277,16 +277,16 @@ local function drawTexts()
-- Description
gfx.FillColor(255, 255, 255, math.floor(scrollTransitionScale * 255))
gfx.BeginPath()
gfx.DrawLabel(resources.labels.selectorDescriptionLabel, 64, Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 52)
gfx.DrawLabel(resources.labels.selectorDescriptionLabel, 64, Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 52)
-- Legend on the selector
gfx.FillColor(217, 177, 126)
gfx.BeginPath()
gfx.DrawLabel(resources.labels.selectorLegendScrollLabel, 118, Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56)
gfx.DrawLabel(resources.labels.selectorLegendScrollLabel, 118, Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56)
gfx.BeginPath()
gfx.DrawLabel(resources.labels.selectorLegendSelectLabel, 360, Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56)
gfx.DrawLabel(resources.labels.selectorLegendSelectLabel, 360, Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56)
gfx.FillColor(255, 255, 255)
end
@ -294,11 +294,11 @@ end
local function drawHeader()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
gfx.Rect(0, 0, Dim.design.width, HEADER_HEIGHT)
gfx.Rect(0, 0, Display.design.width, HEADER_HEIGHT)
gfx.Fill()
gfx.ClosePath()
gfx.ImageRect(Dim.design.width / 2 - 200, HEADER_HEIGHT / 2 - 20, 400, 40, resources.images.headerTitleImage, 1, 0)
gfx.ImageRect(Display.design.width / 2 - 200, HEADER_HEIGHT / 2 - 20, 400, 40, resources.images.headerTitleImage, 1, 0)
end
local function draw_titlescreen(deltaTime)
@ -316,23 +316,23 @@ local function draw_titlescreen(deltaTime)
if (idolAnimTransitionScale > 1) then idolAnimTransitionScale = 1 end
gfx.BeginPath()
gfx.ImageRect(0, 0, Dim.design.width, Dim.design.height, resources.anims.idolAnimation, 1, 0)
gfx.ImageRect(0, 0, Display.design.width, Display.design.height, resources.anims.idolAnimation, 1, 0)
gfx.GlobalAlpha(1)
end
-- Draw selector background
gfx.BeginPath()
gfx.ImageRect(0, (Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER) - 280 / 2, 1079, 280, resources.images.selectorBgImage, 1,
gfx.ImageRect(0, (Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER) - 280 / 2, 1079, 280, resources.images.selectorBgImage, 1,
0)
buttonY = (Dim.design.height / 2) - 2 * (257 + 5)
buttonY = (Display.design.height / 2) - 2 * (257 + 5)
draw_buttons()
drawTexts()
-- Draw the arrows around the selected button
gfx.BeginPath()
gfx.ImageRect(Dim.design.width - 512, Dim.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight - 8,
gfx.ImageRect(Display.design.width - 512, Display.design.height / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight - 8,
501, 300, resources.images.selectorArrowsImage, 1, 0)
-- Draw top and bottom bars
@ -365,11 +365,11 @@ local function render(deltaTime)
game.SetSkinSetting("_currentScreen", "title")
Dim.updateResolution()
Display.updateResolution()
Wallpaper.render()
Dim.transformToScreenSpace()
Display.transformToScreenSpace()
tickTransitions(deltaTime)
@ -422,7 +422,7 @@ local function onButtonPressed(button)
end
local function onMousePressed(button)
local mousePosX, mousePosY = Dim.toViewSpace(game.GetMousePos())
local mousePosX, mousePosY = Display.toViewSpace(game.GetMousePos())
local changeIndex = 0
if button ~= 0 then
@ -487,8 +487,8 @@ local MainMenuPage = {
ANIM = {
idolAnimation = Animation.new("crew/anim/" .. crew, {
fps = 30, loop = true,
centered = true, x = Dim.design.width / 2, y = Dim.design.height / 2,
width = Dim.design.width, height = Dim.design.height,
centered = true, x = Display.design.width / 2, y = Display.design.height / 2,
width = Display.design.width, height = Display.design.height,
})
},
AUDIO = {

View File

@ -1,6 +1,6 @@
require "common.class"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Lang = require "language"
@ -88,44 +88,44 @@ function ModeSelectPage.new(params)
local miscButtons = {
upArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight + 4,
x = Display.design.width - 265,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight + 4,
w = 64,
h = 36
},
downArrow = {
x = Dim.design.width - 265,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + buttonHeight / 2 + 28,
x = Display.design.width - 265,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + buttonHeight / 2 + 28,
w = 64,
h = 36
},
mainButton = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight / 2 - 28,
x = Display.design.width - 512,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight / 2 - 28,
w = 505,
h = 196
},
upButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight,
x = Display.design.width - 512,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight,
w = 1026 / 2,
h = 257 / 2
},
upButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight * 2,
x = Display.design.width - 512,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER - 128 - buttonHeight * 2,
w = 1026 / 2,
h = 257 / 2
},
downButton1 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + 10,
x = Display.design.width - 512,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + 10,
w = 1026 / 2,
h = 257 / 2
},
downButton2 = {
x = Dim.design.width - 512,
y = Dim.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + buttonHeight + 10,
x = Display.design.width - 512,
y = Display.design.height / 2 + self.SELECTOR_BAR_OFFSET_FROM_CENTER + 128 + buttonHeight + 10,
w = 1026 / 2,
h = 257 / 2
},

View File

@ -1,5 +1,5 @@
require("common.class")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
local ServicePage = require("api.page.servicepage")
---@class ScreenCheckPage: ServicePage
@ -44,13 +44,13 @@ end
function ScreenCheckPage:drawBackground(deltaTime)
--background fill
gfx.BeginPath()
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.FillColor(table.unpack(self.BG_COLOR))
gfx.Fill()
--draw square array
gfx.BeginPath()
local squareSize = Dim.design.width / self.SQUARE_COUNT[1] - 2 * self.STROKE_WIDTH
local squareSize = Display.design.width / self.SQUARE_COUNT[1] - 2 * self.STROKE_WIDTH
local squareSpacing = 2 * self.STROKE_WIDTH
for j = 0, self.SQUARE_COUNT[2] - 1 do
local posY = self.STROKE_WIDTH + j * (squareSize + squareSpacing)
@ -69,32 +69,32 @@ function ScreenCheckPage:drawBackground(deltaTime)
gfx.BeginPath()
--frame
gfx.Rect(self.STROKE_WIDTH / 2, self.STROKE_WIDTH / 2,
Dim.design.width - self.STROKE_WIDTH, Dim.design.height - self.STROKE_WIDTH)
Display.design.width - self.STROKE_WIDTH, Display.design.height - self.STROKE_WIDTH)
--center lines
gfx.MoveTo(Dim.design.width / 2, 0)
gfx.LineTo(Dim.design.width / 2, Dim.design.height)
gfx.MoveTo(0, Dim.design.height / 2)
gfx.LineTo(Dim.design.width, Dim.design.height / 2)
gfx.MoveTo(Display.design.width / 2, 0)
gfx.LineTo(Display.design.width / 2, Display.design.height)
gfx.MoveTo(0, Display.design.height / 2)
gfx.LineTo(Display.design.width, Display.design.height / 2)
--corners
local cornerW = Dim.design.width * 4 / 18
local cornerH = Dim.design.height * 4 / 32
local cornerW = Display.design.width * 4 / 18
local cornerH = Display.design.height * 4 / 32
gfx.MoveTo(0, cornerH)
gfx.LineTo(cornerW, cornerH)
gfx.LineTo(cornerW, 0)
gfx.MoveTo(Dim.design.width - cornerW, 0)
gfx.LineTo(Dim.design.width - cornerW, cornerH)
gfx.LineTo(Dim.design.width, cornerH)
gfx.MoveTo(0, Dim.design.height - cornerH)
gfx.LineTo(cornerW, Dim.design.height - cornerH)
gfx.LineTo(cornerW, Dim.design.height)
gfx.MoveTo(Dim.design.width - cornerW, Dim.design.height)
gfx.LineTo(Dim.design.width - cornerW, Dim.design.height - cornerH)
gfx.LineTo(Dim.design.width, Dim.design.height - cornerH)
gfx.MoveTo(Display.design.width - cornerW, 0)
gfx.LineTo(Display.design.width - cornerW, cornerH)
gfx.LineTo(Display.design.width, cornerH)
gfx.MoveTo(0, Display.design.height - cornerH)
gfx.LineTo(cornerW, Display.design.height - cornerH)
gfx.LineTo(cornerW, Display.design.height)
gfx.MoveTo(Display.design.width - cornerW, Display.design.height)
gfx.LineTo(Display.design.width - cornerW, Display.design.height - cornerH)
gfx.LineTo(Display.design.width, Display.design.height - cornerH)
--center square
local centerX = Dim.design.width * 4 / 18
local centerY = Dim.design.height * 11 / 32
local centerW = Dim.design.width * 10 / 18
local centerH = Dim.design.height * 10 / 32
local centerX = Display.design.width * 4 / 18
local centerY = Display.design.height * 11 / 32
local centerW = Display.design.width * 10 / 18
local centerH = Display.design.height * 10 / 32
gfx.Rect(centerX, centerY, centerW, centerH)
gfx.StrokeColor(table.unpack(self.STROKE_COLOR))
gfx.StrokeWidth(self.STROKE_WIDTH)

View File

@ -1,5 +1,5 @@
local Util = require("common.util")
local Dim = require("scripts.graphics.dimensions")
local Display = require("scripts.graphics.display")
require "common.globals"
require "common.class"
@ -112,7 +112,7 @@ function SplashPage:fadeTransition(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(fillColor))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
self.__fadeTimer = self.__fadeTimer + deltaTime
@ -121,7 +121,7 @@ end
function SplashPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
@ -145,7 +145,7 @@ function SplashPage:drawForeground(deltaTime)
gfx.FillColor(table.unpack(textFillColor))
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(28)
gfx.Text("Press START to skip...", 10, Dim.design.height - 10)
gfx.Text("Press START to skip...", 10, Display.design.height - 10)
end
return SplashPage

View File

@ -1,7 +1,7 @@
require "common.globals"
require "common.class"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
@ -37,13 +37,13 @@ end
function CreditsPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
function CreditsPage:drawContent(deltaTime)
local x = (Dim.design.width - self.logo_img.width) / 2
local y = (Dim.design.height - self.logo_img.height) / 2
local x = (Display.design.width - self.logo_img.width) / 2
local y = (Display.design.height - self.logo_img.height) / 2
self.logo_img:setPosition(x, y)

View File

@ -1,6 +1,6 @@
require "common.globals"
require "common.class"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
local AudioSample = require "api.audiosample"
@ -43,13 +43,13 @@ end
function KShootManiaPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
function KShootManiaPage:drawContent(deltaTime)
local x = (Dim.design.width - self.logo_img.width) / 2
local y = (Dim.design.height - self.logo_img.height) / 2
local x = (Display.design.width - self.logo_img.width) / 2
local y = (Display.design.height - self.logo_img.height) / 2
self.logo_img:setPosition(x, y)

View File

@ -1,7 +1,7 @@
require "common.globals"
require "common.class"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
@ -37,13 +37,13 @@ end
function TeamExceedPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
function TeamExceedPage:drawContent(deltaTime)
local x = (Dim.design.width - self.logo_img.width) / 2
local y = (Dim.design.height - self.logo_img.height) / 2
local x = (Display.design.width - self.logo_img.width) / 2
local y = (Display.design.height - self.logo_img.height) / 2
self.logo_img:setPosition(x, y)

View File

@ -1,7 +1,7 @@
require "common.globals"
require "common.class"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
@ -37,13 +37,13 @@ end
function USCPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Rect(0, 0, Display.design.width, Display.design.height)
gfx.Fill()
end
function USCPage:drawContent(deltaTime)
local x = (Dim.design.width - self.logo_img.width) / 2
local y = (Dim.design.height - self.logo_img.height) / 2
local x = (Display.design.width - self.logo_img.width) / 2
local y = (Display.design.height - self.logo_img.height) / 2
self.logo_img:setPosition(x, y)

View File

@ -1,7 +1,7 @@
require "common.globals"
local Version = require "common.version"
local Dim = require "scripts.graphics.dimensions"
local Display = require "scripts.graphics.display"
local Image = require "scripts.graphics.image"
@ -21,7 +21,7 @@ function TitlePage.new(params)
self.background_img = Image.new(self.BACKGROUND_IMG_PATH)
self.background_img:setPosition(0, 0)
self.background_img:setSize(Dim.design.width, Dim.design.height)
self.background_img:setSize(Display.design.width, Display.design.height)
return self
end