-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
54 lines (39 loc) · 1.81 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
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Löve theTemplate GNU GPLv3 @Doyousketch2
require 'libs.globals'
require 'libs.maths'
require 'libs.state_manager'
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- initial love .load() function, individual gamestates simply use load() to initialize.
function Lo .load()
print('Löve app begin: ' ..title )
for a = 1, #arg do -- 'arg' is a list of all the args, so iterate through it.
local ar = arg[a]
if ar ~= '.' then -- dot is used when loading in Linux, so we'll skip it.
if ar == '-h' or ar == '-help' then
print( title ..' by Doyousketch2 for Love2D\n' )
eve .quit()
else -- do something here if certain args are passed. just prints 'em for demonstration.
print('arg ' ..a ..': ' ..ar )
end -- if ar ==
end -- if ar ~= '.'
end -- for arg
-- disable antialiasing, so pixels remain crisp while zooming, used for pixel art
gra .setDefaultFilter( 'nearest', 'nearest', 0 )
-- initialize random numbers, otherwise Lua defaults to same numbers each time ?!?
-- Love gen differs from Lua, it comes premixed love2d.org/wiki/love.run
math.randomseed( os.time() ); random(); random(); random()
gra .setBackgroundColor( cBlue )
gra .setColor( ltBlue )
gra .setLineWidth( pad *2 )
smallFont = gra .newFont( style, smallFontSize )
mediumFont = gra .newFont( style, mediumFontSize )
largeFont = gra .newFont( style, largeFontSize )
gra .setFont( mediumFont )
loadState( 'intro' )
end -- Lo .load()
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Lo .quit() -- do stuff before exit, autosave, say goodbye...
print( 'Löve app exit: ' ..title )
end -- Lo .quit()
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~