-
Notifications
You must be signed in to change notification settings - Fork 0
/
HowToScreen.lua
70 lines (55 loc) · 4.16 KB
/
HowToScreen.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
module(..., package.seeall)
function new()
local localGroup = display.newGroup()
--> This is how we start every single file or "screen" in our folder, except for main.lua
-- and director.lua
--> director.lua is NEVER modified, while only one line in main.lua changes, described in that file
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--import the scrolling classes
local scrollView = require("scrollView")
local svUtil = require("scrollViewUtil")
--set the background image
local background = display.newImage ("splashScreen.png")
localGroup:insert(background)
-- Setup a scrollable content group
local topBoundary = display.screenOriginY
local bottomBoundary = display.screenOriginY
local scrollView = scrollView.new{ top=topBoundary, bottom=bottomBoundary }
local headingText = display.newText("How To Play", 0, 0, native.systemFontBold, 16)
headingText:setTextColor(255, 255, 255)
headingText.x = math.floor(display.contentWidth*0.5)
headingText.y = 48
scrollView:insert(headingText)
-- add some text to the scrolling screen
local howToText = "Hold your finger on the screen to create and erosion. Extra BS ... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris. "
local howToTextObject = svUtil.wrappedText( howToText, 39, 14, native.systemFont) --, {0,0,0} )
scrollView:insert(howToTextObject)
howToTextObject.x = 24
howToTextObject.y = math.floor(headingText.y + headingText.height)
-- Important! Add a background to the scroll view for a proper hit area
local scrollBackground = display.newRect(0, 0, display.contentWidth, scrollView.height+64)
--scrollBackground:setFillColor(255, 255, 255)
scrollBackground:setFillColor(0, 0, 0, 150)
scrollView:insert(1, scrollBackground)
scrollView:addScrollBar()
--localGroup:insert(scrollBackground)
localGroup:insert(scrollView)
local backBtnRelease = function( event )
print("menuScreen")
director:changeScene ("menuscreen")
end
backBtn = ui.newButton{
default = "redBtn.png",
over = "pressedRedBtn.png",
onRelease = backBtnRelease,
text = "Menu",
id = "backBtn"
--emboss = true
}
backBtn.x = display.contentWidth/2; backBtn.y = 440
localGroup:insert(backBtn)
------------------------------------------------------------------------------
------------------------------------------------------------------------------
return localGroup
end