V1 update (#1)

This commit is contained in:
Nguyễn Quốc Hưng
2024-06-06 16:01:24 +07:00
committed by Squishy (C6H12O6+NaCl+H2O)
parent 3343d8711b
commit 1d6643448e
30 changed files with 1000 additions and 228 deletions

View File

@@ -1,9 +1,9 @@
local Object = require 'libs.classic'
local bit = require("bit")
local lualzw = require 'libs.lualzw'
local bitser = require 'libs.bitser'
local playedReadySE = false
local hiscore_pos
local Grid = require 'game.grid'
local Randomizer = require 'game.randomizer'
@@ -11,7 +11,9 @@ local Randomizer = require 'game.randomizer'
local GameMode = Object:extend()
function GameMode:new(player_name, input_file, replay_grade)
VCTRL.toggle(MOBILE and not input_file and not SETTINGS.tvMode)
-- VCTRL.toggle(MOBILE and not input_file and not SETTINGS.tvMode)
VCTRL.toggle(true)
VCTRL.reset()
if player_name == nil then self.training = true else self.training = false end
if input_file ~= nil then
@@ -149,7 +151,7 @@ function GameMode:readGradeHistory()
if self.grade > 1 then
local temp_grade = copy(self.grade_history); temp_grade[2] = 0
FILE.write(SAVE_DIR..self.player_name.."_grade_history.sav", temp_grade)
end
end
end
function GameMode:readHiScores()
@@ -979,7 +981,7 @@ function GameMode:drawScoringInfo()
love.graphics.rectangle("fill", 95, 80, 110, 180, 10, 10)
if not PENTO_MODE then drawText("Grade:", 100, 128, 1000, "left") end
-- Line & Level
if self.training or SETTINGS["lines"] then
if self.input_playback or SETTINGS["lines"] then
love.graphics.setColor(0,0,0,0.5)
love.graphics.rectangle("fill", 241, 407, 116, 40, 5, 5) --lines
love.graphics.setColor(0.05,0.05,0.05,1)
@@ -992,7 +994,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)
drawBoldText(string.format("REPLAY IN PROGRESS\n\n\n\n\n\n\n\n\n%s", formatTime(self.frames)), 70, 275, 1000, "left")
drawText(string.format("REPLAY IN PROGRESS\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
@@ -1073,6 +1075,7 @@ end
function GameMode:drawFrame()
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setLineWidth(1)
love.graphics.line(216,80,216,80+(16*self.grid.height))
love.graphics.line(216+(16*self.grid.width),80,216+(16*self.grid.width),80+(16*self.grid.height))
love.graphics.line(216,80+(16*self.grid.height),216+(16*self.grid.width),80+(16*self.grid.height))

View File

@@ -64,7 +64,7 @@ function control_type.button:new(data)
r=data.r or 80, -- size
shape=data.shape or 'circle',
key=data.key or 'X',
iconSize=data.iconSize or 80,
iconSize=data.iconSize or 60,
alpha=data.alpha or 0.75,
quad=virtual_quad[data.key]
},self)
@@ -90,7 +90,7 @@ end
function control_type.button:press(_,_,id)
self.pressed=true
self.lastPressTime=love.timer.getTime()
self.pressing=id
self.pressingID=id
-- love.keypressed(self.key, love.keyboard.getScancodeFromKey(self.key))
SCENE:onInputPress{input=self.key,type="virtual"}
end
@@ -148,6 +148,7 @@ local touches={}
local global_toggle=false
VCTRL={}
VCTRL.focus=nil -- Focusing buttons
VCTRL.hasChanged = false
---@class VCTRL.data
---@field type 'button'
@@ -231,6 +232,13 @@ function VCTRL.draw(forceAlpha)
end
end
function VCTRL.reset()
for _, w in ipairs(VCTRL) do
if w.pressingID then touches[w.pressingID] = nil end
w:reset()
end
end
function VCTRL.exportAll()
local t = {}
for o, k in ipairs(VCTRL) do t[o] = k:export() end