86 lines
1.8 KiB
Lua
86 lines
1.8 KiB
Lua
|
|
local baseImage = gfx.CreateSkinImage("gameplay/crit_line/base.png", 0)
|
|
local textImage = gfx.CreateSkinImage("gameplay/crit_line/text.png", 0)
|
|
local cursorImage = gfx.CreateSkinImage("gameplay/crit_line/cursor.png", 0)
|
|
|
|
local CRITBAR_W = 1496
|
|
local CRITBAR_H = 348
|
|
|
|
local scale;
|
|
|
|
local isLandscape = false;
|
|
|
|
local setUpTransforms = function (x,y,rotation)
|
|
local resx, resy = game.GetResolution();
|
|
isLandscape = resx > resy;
|
|
|
|
local desw, desh;
|
|
|
|
if (isLandscape) then
|
|
desw = 1920;
|
|
desh = 1080;
|
|
else
|
|
desw = 1080;
|
|
desh = 1920;
|
|
end
|
|
|
|
scale = resx / desw
|
|
|
|
gfx.Translate(x, y)
|
|
gfx.Rotate(rotation)
|
|
gfx.Scale(scale,scale)
|
|
end
|
|
|
|
local drawCursors = function (centerX, centerY,cursors)
|
|
local cursorW = 598*0.2;
|
|
local cursorH = 673*0.2;
|
|
for i = 0, 1, 1 do
|
|
gfx.Save();
|
|
local cursor = cursors[i];
|
|
gfx.BeginPath();
|
|
gfx.SkewX(cursor.skew)
|
|
gfx.ImageRect(
|
|
(cursor.pos *(1/scale) - cursorW/2),
|
|
(-cursorH/2),
|
|
cursorW,
|
|
cursorH,
|
|
cursorImage,
|
|
cursor.alpha,
|
|
0
|
|
);
|
|
gfx.Restore();
|
|
end
|
|
end
|
|
|
|
local renderBase = function (deltaTime, centerX, centerY, rotation, cursors)
|
|
setUpTransforms(centerX, centerY, rotation)
|
|
|
|
gfx.BeginPath()
|
|
gfx.FillColor(0, 0, 0, 192)
|
|
gfx.Rect(-1080/2, 0, 1080, 1080)
|
|
gfx.Fill()
|
|
|
|
gfx.BeginPath();
|
|
gfx.ImageRect(
|
|
-CRITBAR_W/2,
|
|
-CRITBAR_H/2,
|
|
CRITBAR_W,
|
|
CRITBAR_H,
|
|
baseImage,
|
|
1,
|
|
0
|
|
);
|
|
|
|
drawCursors(centerX, centerY, cursors)
|
|
|
|
gfx.ResetTransform()
|
|
end
|
|
|
|
local renderOverlay = function (deltaTime)
|
|
|
|
end
|
|
|
|
return {
|
|
renderBase=renderBase,
|
|
renderOverlay=renderOverlay
|
|
} |