summaryrefslogtreecommitdiffhomepage
path: root/config/menus/main.lua
blob: ae2cef2d5733bd03204219dd4d1c90147df36a9b (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
local menu, background = ...

local Button = require "not.Button"
local Header = require "not.Header"
local Element = require "not.Element"

local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
local bx = width/2-29

local awesometwo = love.graphics.newImage("assets/two.png")

if background == nil or not background:is(require "not.MenuBackground") then
	background = require "not.MenuBackground"(menu)
end

-- Wait, only here?
if musicPlayer:getCurrentTrack() ~= "menu.ogg" then
	musicPlayer:setTrack("menu.ogg")
	musicPlayer:play()
end

return {
	background,
	Button(menu)
		:setText("Start")
		:setPosition(bx, 80)
		:set("active", function (self)
				self.parent:open("host")
			end)
	,
	Button(menu)
		:setText("Join")
		:setPosition(bx, 96)
		:set("isEnabled", function (self)
				return false
			end)
	,
	Button(menu)
		:setText("Settings")
		:setPosition(bx, 112)
		:set("active", function (self)
				self.parent:open("settings")
			end)
	,
	Button(menu)
		:setText("Credits")
		:setPosition(bx, 128)
		:set("active", function (self)
				self.parent:open("credits")
			end)
	,
	Button(menu)
		:setText("Exit")
		:setPosition(bx, 144)
		:set("active", love.event.quit)
	,
	Element(menu)
		:setPosition(width/2, 15)
		:set("draw", function (self, scale) 
				local x,y = self:getPosition()
				love.graphics.setColor(255, 255, 255, 255)
				love.graphics.setFont(Bold)
				love.graphics.draw(awesometwo, x*scale, y*scale, 0, scale, scale, 35)
			end)
	,
	Header(menu)
		:setText("Roflnauts")
		:setPosition(width/2,40)
	,
}