Skip to content

Commit 84f493e

Browse files
committed
Variable name change to lyrics.
1 parent 0393b87 commit 84f493e

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

game/live/lyrics.lua

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ local Luaoop = require("libs.Luaoop")
88
local color = require("color")
99
local MainFont = require("main_font")
1010

11-
local lyrics = Luaoop.class("Livesim2.Lyrics")
11+
---@class Livesim2.Lyrics
12+
local Lyrics = Luaoop.class("Livesim2.Lyrics")
1213
local perZeroThree = 1/0.3
1314

14-
function lyrics:__construct(srt)
15+
function Lyrics:__construct(srt)
1516
local font1, font2 = MainFont.get(24, 16)
1617
local timings = {}
1718

@@ -41,7 +42,8 @@ function lyrics:__construct(srt)
4142
end
4243
end
4344

44-
function lyrics:update(dt)
45+
---@param dt number
46+
function Lyrics:update(dt)
4547
self.elapsedTime = self.elapsedTime + dt
4648

4749
local lyr = self.timings[1]
@@ -67,7 +69,7 @@ function lyrics:update(dt)
6769
end
6870
end
6971

70-
function lyrics:draw()
72+
function Lyrics:draw()
7173
if self.active then
7274
love.graphics.setColor(color.compat(255, 255, 255, self.opacity * perZeroThree))
7375
love.graphics.draw(self.active[3], 6, 590)
@@ -77,4 +79,5 @@ function lyrics:draw()
7779
end
7880
end
7981

80-
return lyrics
82+
---@cast Lyrics +fun(srt):Livesim2.Lyrics
83+
return Lyrics

io_open_wide.lua

+8-3
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,19 @@ end
6161

6262
local open = io.open
6363

64-
function io.open(path, mode)
65-
local pathw = toWideChar(path)
64+
---@param filename string
65+
---@param mode? openmode
66+
---@return file*?
67+
---@return string? errmsg
68+
---@nodiscard
69+
function io.open(filename, mode)
70+
local pathw = toWideChar(filename)
6671
local modew = toWideChar(mode)
6772

6873
local file = assert(open("nul", "rb"))
6974
if ffi.C._wfreopen(pathw, modew, file) == nil then
7075
local msg, errno = select(2, file:close())
71-
return nil, path..": "..msg, errno
76+
return nil, filename..": "..msg, errno
7277
end
7378

7479
return file

util.lua

+13-11
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@ end
1616
local Util = {}
1717

1818
---@param maj number
19-
---@param min number
20-
---@param rev number
21-
---@return "-1" | "0" | "1"
19+
---@param min number?
20+
---@param rev number?
21+
---@return -1 | 0 | 1
2222
function Util.compareLOVEVersion(maj, min, rev)
23-
if love._version_major > maj then
23+
local major, minor, revision = love.getVersion()
24+
if major > maj then
2425
return 1
25-
elseif love._version_major < maj then
26+
elseif major < maj then
2627
return -1
2728
elseif min then
28-
if love._version_minor > min then
29+
if minor > min then
2930
return 1
30-
elseif love._version_minor < min then
31+
elseif minor < min then
3132
return -1
3233
elseif rev then
33-
if love._version_revision > rev then
34+
if revision > rev then
3435
return 1
35-
elseif love._version_revision < rev then
36+
elseif revision < rev then
3637
return -1
3738
end
3839
end
@@ -42,6 +43,7 @@ function Util.compareLOVEVersion(maj, min, rev)
4243
end
4344

4445
local version11 = Util.compareLOVEVersion(11, 0) >= 0
46+
local version12 = Util.compareLOVEVersion(12, 0) >= 0
4547

4648
---@param file string
4749
function Util.basename(file)
@@ -290,7 +292,7 @@ end
290292

291293
function Util.newVideoStream(path)
292294
if hasLVEP then
293-
local s, v = pcall(love.video.newStream, path)
295+
local s, v = pcall(lvep.newStream, path)
294296
if not(s) then
295297
return lvep.newVideoStream(path)
296298
else
@@ -316,7 +318,7 @@ function Util.decompressToData(data, algo)
316318
end
317319
end
318320

319-
if Util.compareLOVEVersion(12, 0) >= 0 then
321+
if version12 then
320322
function Util.stencil11(fn, action, value, keepvalue)
321323
love.graphics.setColorMask(false)
322324
love.graphics.setStencilMode(action, "always", value)

0 commit comments

Comments
 (0)