+ score panel landscape support
This commit is contained in:
parent
09dc795ee6
commit
01ea812b7f
|
@ -4,6 +4,8 @@ local bgImage = gfx.CreateSkinImage("gameplay/score_panel/bg.png", 0)
|
||||||
local desw = 1080;
|
local desw = 1080;
|
||||||
local desh = 1920;
|
local desh = 1920;
|
||||||
|
|
||||||
|
local isLandscape = false;
|
||||||
|
|
||||||
function load_number_image(path)
|
function load_number_image(path)
|
||||||
local images = {}
|
local images = {}
|
||||||
for i = 0, 9 do
|
for i = 0, 9 do
|
||||||
|
@ -40,15 +42,26 @@ local tickTransitions = function (deltaTime)
|
||||||
end
|
end
|
||||||
|
|
||||||
local render = function (deltaTime, score, maxChain)
|
local render = function (deltaTime, score, maxChain)
|
||||||
tickTransitions(deltaTime)
|
|
||||||
gfx.Save();
|
gfx.Save();
|
||||||
|
|
||||||
local x = desw - 740*0.61; -- WHY IS THERE DIFFERENT SCALING FOR THIS TOO????
|
local resx, resy = game.GetResolution();
|
||||||
local y = 330;
|
isLandscape = resx > resy;
|
||||||
|
|
||||||
|
tickTransitions(deltaTime)
|
||||||
|
|
||||||
|
local x = desw;
|
||||||
|
local y = isLandscape and 0 or 330;
|
||||||
|
|
||||||
|
if (isLandscape) then
|
||||||
|
gfx.Translate(x, 0);
|
||||||
|
x=0
|
||||||
|
|
||||||
|
gfx.Scale(0.7, 0.7);
|
||||||
|
end
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(
|
gfx.ImageRect(
|
||||||
x,
|
x-740*0.61, -- WHY IS THERE DIFFERENT SCALING FOR THIS TOO????
|
||||||
y,
|
y,
|
||||||
740*0.61,
|
740*0.61,
|
||||||
320*0.61,
|
320*0.61,
|
||||||
|
@ -57,8 +70,8 @@ local render = function (deltaTime, score, maxChain)
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
draw_number(x+142, y + 83, 1.0, score/10000, 4, scoreNumbers, true, 0.38, 1.12)
|
draw_number(x-309.4, y + 83, 1.0, score/10000, 4, scoreNumbers, true, 0.38, 1.12)
|
||||||
draw_number(x+338, y + 90, 1.0, score, 4, scoreNumbers, true, 0.28, 1.12)
|
draw_number(x-113.4, y + 90, 1.0, score, 4, scoreNumbers, true, 0.28, 1.12)
|
||||||
|
|
||||||
-- Draw max chain
|
-- Draw max chain
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
|
@ -66,15 +79,8 @@ local render = function (deltaTime, score, maxChain)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.FontSize(30);
|
gfx.FontSize(30);
|
||||||
|
|
||||||
|
|
||||||
-- gfx.FillColor(0,0,0,255);
|
|
||||||
-- gfx.Text(string.format("%04d", maxChain), x+170-2, y+155-2);
|
|
||||||
-- gfx.Text(string.format("%04d", maxChain), x+170-2, y+155+2);
|
|
||||||
-- gfx.Text(string.format("%04d", maxChain), x+170+2, y+155-2);
|
|
||||||
-- gfx.Text(string.format("%04d", maxChain), x+170+2, y+155+2);
|
|
||||||
|
|
||||||
gfx.FillColor(255,255,255,255);
|
gfx.FillColor(255,255,255,255);
|
||||||
gfx.Text(string.format("%04d", maxChain), x+170, y+155);
|
gfx.Text(string.format("%04d", maxChain), x-281.4, y+155);
|
||||||
|
|
||||||
gfx.Restore();
|
gfx.Restore();
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue