style(2048): center grid vertically and space out the header
This commit is contained in:
+10
-7
@@ -170,18 +170,21 @@ end
|
||||
|
||||
local function render()
|
||||
local width, height = gui.width(), gui.height()
|
||||
local top = 86
|
||||
local gap = 8
|
||||
local headerBottom = 132
|
||||
local hintsTop = height - 56
|
||||
local gap = 10
|
||||
local size = math.min(
|
||||
math.floor((width - 48 - gap * (SIZE - 1)) / SIZE),
|
||||
math.floor((height - top - 80 - gap * (SIZE - 1)) / SIZE))
|
||||
math.floor((width - 32 - gap * (SIZE - 1)) / SIZE),
|
||||
math.floor((hintsTop - headerBottom - gap * (SIZE - 1)) / SIZE))
|
||||
local gridWidth = size * SIZE + gap * (SIZE - 1)
|
||||
local gridHeight = size * SIZE + gap * (SIZE - 1)
|
||||
local startX = math.floor((width - gridWidth) / 2)
|
||||
local top = headerBottom + math.floor((hintsTop - headerBottom - gridHeight) / 2)
|
||||
|
||||
gui.clear()
|
||||
gui.drawCenteredText(FONT_NOTOSANS_16, 16, "2048", COLOR_BLACK, STYLE_BOLD)
|
||||
gui.drawCenteredText(FONT_SMALL, 46, "Score " .. score .. " Best " .. best, COLOR_BLACK, STYLE_REGULAR)
|
||||
gui.drawCenteredText(FONT_SMALL, 64, message, COLOR_BLACK, STYLE_REGULAR)
|
||||
gui.drawCenteredText(FONT_NOTOSANS_16, 24, "2048", COLOR_BLACK, STYLE_BOLD)
|
||||
gui.drawCenteredText(FONT_NOTOSANS_14, 66, "Score " .. score .. " Best " .. best, COLOR_BLACK, STYLE_BOLD)
|
||||
gui.drawCenteredText(FONT_SMALL, 100, message, COLOR_BLACK, STYLE_REGULAR)
|
||||
|
||||
for row = 1, SIZE do
|
||||
for column = 1, SIZE do
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
XTEINK-MANIFEST|1
|
||||
main.lua|6324|da9bc8bbe2153eb8ba85e295dbe5e4ec9f4b0c8df57c2fc3eec5ed2dc185bba1
|
||||
main.lua|6518|49329e48f3f670a562c47c551d6e09783591302f4eb7ae0e89033eecb838a115
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
XTEINK-CATALOG|1
|
||||
2048|Slide and merge tiles to reach 2048|apps/2048/manifest.txt|97|44ea59e862e09bb4ed034fc3fe9c280a13bb814bd6cc16670482bb3e34db0180
|
||||
2048|Slide and merge tiles to reach 2048|apps/2048/manifest.txt|97|7cc1eee488186698bf294a649fe850164af23e32aaee1cd86754555e282bce04
|
||||
AppStore|Install apps from public Xteink repositories|apps/AppStore/manifest.txt|192|2eb608b92de6bdeff4fc8ed447b9319f45c0d79d5d73b14db1ab5a92f91e42d4
|
||||
BinaryKeyboard|Two-button recursive keyboard experiment|apps/BinaryKeyboard/manifest.txt|97|893867dba0ae2725caca1eb56375c98c4dd00d351134aa129698c51f97e25690
|
||||
HomeAssistant|Home Assistant status cards|apps/HomeAssistant/manifest.txt|177|b38ca49804444fd383a505ce9c51680ad9b7443950d682ca1b9ef3047bff98a5
|
||||
|
||||
Reference in New Issue
Block a user