-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
82 lines (62 loc) · 2.14 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---@diagnostic disable: duplicate-set-field
local qgui, locale
local hintFont = love.graphics.newFont("font.ttf", 15)
local currentHint = 0
local currentHintedObject
function love.load()
math.randomseed(os.time())
qgui = require("scripts.QGUI")
locale = require("scripts.locale")
G_world = require("classes.World")
G_world = G_world.new(love.graphics.getWidth(), love.graphics.getHeight(), 1000, "yes")
require("scripts.swarmMenuLayout")
qgui.hook()
end
function love.update(dt)
if qgui.getValue("menuButtonSpeed") then
local dt = dt
if qgui.getValue("menuButtonStabilization") then
dt = 0.01
end
G_world:tick(dt*math.floor(qgui.getValue("menuSwitchSpeed"))/10)
end
if currentHint ~= qgui.hl then
local name = (qgui.queue[qgui.hl] or {}).name
qgui.remove("hintPanel")
if locale[name] then
currentHintedObject = name
local _, wrappedtext = hintFont:getWrap(locale[name], 280)
qgui.new{
"hintPanel",
"screen",
fill = true,
w = 300,
h = 20 + #wrappedtext*hintFont:getHeight(),
x = love.graphics.getWidth() - 610,
y = 70,
color = {0, 0.25, 0, 0.75}
}
local oldDraw = qgui.getObject("hintPanel").draw
qgui.getObject("hintPanel").draw = function ()
oldDraw()
love.graphics.setFont(hintFont)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(locale[currentHintedObject] or "", love.graphics.getWidth() - 600, 80, 280, "left")
end
else
currentHintedObject = nil
end
currentHint = qgui.hl
end
if G_world.screamsEnabled ~= qgui.getValue("menuButtonRange") then
G_world:setScreamEnabled(qgui.getValue("menuButtonRange"))
end
end
function love.draw()
G_world:paint()
end
function love.keypressed(key)
if key == "space" then
qgui.getObject("menuButtonSpeed").check = not qgui.getObject("menuButtonSpeed").check
end
end