diff --git a/char.lua b/char.lua index 3193d70..5c25e4d 100644 --- a/char.lua +++ b/char.lua @@ -412,4 +412,4 @@ for _,pack in next,L do end end -return L +return L \ No newline at end of file diff --git a/funcs.lua b/funcs.lua index f25cb05..8460c72 100644 --- a/funcs.lua +++ b/funcs.lua @@ -143,6 +143,15 @@ function drawText(text, x, y, size, orientation, color) love.graphics.printf(text, x, y, size*2, orientation, nil, 0.5) end +function drawBoldText(text, x, y, size, orientation, color) + if color == nil then color = {1, 1, 1, 1} end + love.graphics.setFont(FONT_bold) + love.graphics.setColor(0, 0, 0, 0.8) + love.graphics.printf(text, x+1, y+1, size*2, orientation, nil, 0.50) + love.graphics.setColor(color) + love.graphics.printf(text, x, y, size*2, orientation, nil, 0.5) +end + function drawBigText(text, x, y, size, orientation, color) if color == nil then color = {1, 1, 1, 1} end love.graphics.setFont(FONT_big) diff --git a/game/gamemode.lua b/game/gamemode.lua index d020942..8d667fc 100644 --- a/game/gamemode.lua +++ b/game/gamemode.lua @@ -922,23 +922,23 @@ end function GameMode:drawInputDisplay(left, top) if self.replay_inputs[self.frames] ~= nil then - drawText("+", left+10, top+8, 1000, "left") - drawText(CHAR.key.down , left+10, top+18, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['down']),1,1-boolToInt(self.replay_inputs[self.frames]['down']),1}) - drawText(CHAR.key.left , left , top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['left']),1,1-boolToInt(self.replay_inputs[self.frames]['left']),1}) - drawText(CHAR.key.right, left+20, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['right']),1,1-boolToInt(self.replay_inputs[self.frames]['right']),1}) - drawText("L", left+35, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1}) - drawText("R", left+50, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1}) - drawText("L", left+65, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1}) - drawText("R", left+80, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1}) + drawText("•", left+7.5, top+ 8, 1000, "left") + drawText(CHAR.key.down , left+ 5, top+18, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['down']),1,1-boolToInt(self.replay_inputs[self.frames]['down']),1}) + drawText(CHAR.key.left , left- 5, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['left']),1,1-boolToInt(self.replay_inputs[self.frames]['left']),1}) + drawText(CHAR.key.right, left+ 15, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['right']),1,1-boolToInt(self.replay_inputs[self.frames]['right']),1}) + drawText("L", left+ 35, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1}) + drawText("R", left+ 50, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1}) + drawText("L", left+ 65, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1}) + drawText("R", left+ 80, top+ 8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1}) else - drawText("+", left+10, top+8, 1000, "left") - drawText(CHAR.key.down , left+10, top+18, 1000) - drawText(CHAR.key.left , left , top+ 8, 1000) - drawText(CHAR.key.right, left+20, top+ 8, 1000) - drawText("L", left+35, top+8, 1000, "left") - drawText("R", left+50, top+8, 1000, "left") - drawText("L", left+65, top+8, 1000, "left") - drawText("R", left+80, top+8, 1000, "left") + drawText("•" , left+7.5, top+ 8, 1000, "left") + drawText(CHAR.key.down , left+ 5, top+18, 1000) + drawText(CHAR.key.left , left- 5, top+ 8, 1000) + drawText(CHAR.key.right, left+ 15, top+ 8, 1000) + drawText("L" , left+ 35, top+ 8, 1000, "left") + drawText("R" , left+ 50, top+ 8, 1000, "left") + drawText("L" , left+ 65, top+ 8, 1000, "left") + drawText("R" , left+ 80, top+ 8, 1000, "left") end end @@ -992,7 +992,7 @@ function GameMode:drawScoringInfo() love.graphics.rectangle("fill", 68, 270, 140, 190, 10, 10) love.graphics.setColor(0.05,0.05,0.05,1) love.graphics.rectangle("fill", 65, 267, 140, 190, 10, 10) - drawText(string.format("Replay in progress\n\n\n\n\n\n\n\n\n%s", formatTime(self.frames)), 70, 275, 1000, "left") + drawBoldText(string.format("Replay in progress\n\n\n\n\n\n\n\n\n\n%s", formatTime(self.frames)), 70, 275, 1000, "left") drawBigText(string.format("%s", self.grade), 100, 143, 1000, "left") self:drawInputDisplay(103,185) elseif not PENTO_MODE then diff --git a/load.lua b/load.lua index c3dec1d..774b58e 100644 --- a/load.lua +++ b/load.lua @@ -1,9 +1,11 @@ -- Fonts -FONT_tromi = love.graphics.newFont('res/fonts/MplusCodeLatin50-Regular.otf', 28) -FONT_big = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 56) - -FONT_tromi:setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 28)) -FONT_big :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 56)) +FONT_tromi = love.graphics.newFont('res/fonts/MplusCodeLatin50-Regular.otf', 26) +FONT_bold = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 26) +FONT_big = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 54) +-- Icons +FONT_tromi:setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 26)) +FONT_bold :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 26)) +FONT_big :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 54)) CHAR = require("char") local font_height = FONT_tromi:getHeight() * 0.5 @@ -19,7 +21,7 @@ BUTTON = require "libs.simple-button" BUTTON.setDefaultOption{ draw = function(self) local need_big_font = (self.font == FONT_big) - + love.graphics.setColor(self.backgroundColor) love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r) @@ -35,22 +37,19 @@ BUTTON.setDefaultOption{ local lineAmount do - local _, t - if need_big_font then - _, t = FONT_big:getWrap(text, (self.w - 5) * 2) - else - _, t = FONT_tromi:getWrap(text, (self.w - 5) * 2) - end + local _, t = self.font:getWrap(text, (self.w - 5) * 2) lineAmount = #t end - + local _font_height = need_big_font and font_big_height or font_height - + local textHeight = _font_height * (lineAmount * 0.5) local textPos = self.y + (self.h * 0.5) - textHeight - if need_big_font then + if self.font == FONT_big then drawBigText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor) + elseif self.font == FONT_bold then + drawBoldText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor) else drawText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor) end diff --git a/scene/input_config.lua b/scene/input_config.lua index d1ee2a1..974d570 100644 --- a/scene/input_config.lua +++ b/scene/input_config.lua @@ -47,7 +47,7 @@ local function updateButtonList(self) if not SETTINGS.firstTime then menu_screens[4] = TitleScene buttonList[4] = BUTTON.new{ - text = "⌂", font = FONT_big, + text = CHAR.icon.home, font = FONT_big, x = 75, y = 280, w = 40, h = 40, codeWhenReleased = function() if self.menu_state ~= 4 then diff --git a/scene/replay.lua b/scene/replay.lua index 2be99b8..2a4e6de 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -4,37 +4,37 @@ ReplaySelectScene.title = "Replay" local replay_list local buttonList = { BUTTON.new{ - text = "↑\nUP", font = FONT_big, + text = CHAR.key.up.."\nUP", font = FONT_big, x = 425, y = 80, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "up"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "up"} end }, BUTTON.new{ - text = "↓\nDOWN", font = FONT_big, + text = CHAR.key.down.."\nDOWN", font = FONT_big, x = 425, y = 240, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "down"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "down"} end }, BUTTON.new{ - text = "▶\nPLAY", font = FONT_big, + text = CHAR.icon.play.."\nPLAY", font = FONT_big, x = 345, y = 160, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "menu_decide"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "menu_decide"} end }, BUTTON.new{ - text = "⌂\nHOME", font = FONT_big, + text = CHAR.icon.home.."\nHOME", font = FONT_big, x = 505, y = 160, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "menu_back"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "menu_back"} end }, BUTTON.new{ - text = CHAR.icon.export.."\nCOPY", font = FONT_big, + text = CHAR.icon.export.."\nEXP.", font = FONT_big, x = 345, y = 320, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "rotate_left"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "rotate_left"} end }, BUTTON.new{ - text = CHAR.icon.import.."\nPASTE", font = FONT_big, + text = CHAR.icon.import.."\nIMP.", font = FONT_big, x = 505, y = 320, w = 80, h = 80, codeWhenPressed = function() SCENE:onInputPress {input = "rotate_right"} end, codeWhenReleased = function() SCENE:onInputRelease{input = "rotate_right"} end diff --git a/scene/replay_test.lua b/scene/replay_test.lua index b77c659..00ae5ee 100644 --- a/scene/replay_test.lua +++ b/scene/replay_test.lua @@ -44,8 +44,8 @@ function ReplayTestScene:render() end -function ReplayTestScene:onInputRelease() - SCENE = ReplayTestScene() +function ReplayTestScene:onInputPress() + SCENE = ReplaySelectScene() end return ReplayTestScene \ No newline at end of file