summaryrefslogtreecommitdiff
path: root/client/main.lua
blob: db4b6bf15777f4f5b1737d8e9d908d0fbfb5ae90 (plain)
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
local gamescene = require"game"

local current_scene
local function switch_scene(newscene)
	if current_scene.quit then current_scene.quit() end
	current_scene = newscene
	if newscene.load then newscene.load() end
end


local big_font = love.graphics.newFont(72)
local normal_font = love.graphics.getFont()

local titlescene = {}
function titlescene.draw()
	love.graphics.clear(1,1,1)
	love.graphics.origin()
	love.graphics.setColor(0,0,0)
	love.graphics.setFont(big_font)
	love.graphics.print("hexagon emulator",30,30)

	love.graphics.setFont(normal_font)
	love.graphics.print("press <enter> to start",40,120)
end
local evilscene
function titlescene.keypressed(k,s,r)
	if k=="return" then
		switch_scene(gamescene)
	end
end


current_scene=titlescene

for _,f in ipairs{
	"update",
	"draw",
	"keypressed",
	"textinput",
	"wheelmoved",
	"quit",
} do
	love[f] = function(...)
		local x = current_scene[f]
		if x then return x(...) end
	end
end