-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.lua
34 lines (30 loc) · 1.11 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
--instance of unite class either client or server
--maybe not so pretty to make it global, but for this example it'll do
--you can try implement it your own way:)
serverlink = nil
transition = SceneManager.flipWithFade
font = TTFont.new("tahoma.ttf", 24);
--function for creating menu buttons
menuButton = function(image1, image2, container, current, all)
local newButton = Button.new(Bitmap.new(Texture.new(image1)), Bitmap.new(Texture.new(image2)))
local startHeight = (current-1)*(container:getHeight())/all + (((container:getHeight())/all)-newButton:getHeight())/2 + application:getContentHeight()/16
newButton:setPosition((application:getContentWidth()-newButton:getWidth())/2, startHeight)
return newButton;
end
--define scenes
sceneManager = SceneManager.new({
--start scene
["start"] = start,
--starting server
["new_server"] = new_server,
--listening to servers
["join_server"] = join_server,
--drawing together
["draw"] = draw,
--some desription scene
["about"] = about
})
--add manager to stage
stage:addChild(sceneManager)
--start start scene
sceneManager:changeScene("start", 1, transition, easing.outBack)