resources/sceneabout.lua

changeset 0
bba7a2a225f6
equal deleted inserted replaced
-1:000000000000 0:49fab89918bb
1 -- Top of scene
2 --print('This is a new scene!')
3
4 -- Initiate scene management
5 local sceneloc = director:createScene()
6 sceneloc.name = 'Scene: About'
7
8 -- Constants calculated
9 local dsw = director.displayWidth
10 local dsh = director.displayHeight
11
12 -- Fonts created
13 local fontArial = director:createFont('fonts/Arial-96pt_bold.fnt')
14 local fontSegoe = director:createFont('fonts/SegoeUI-64pt_bold.fnt')
15
16 function sceneloc:setUp(event)
17 dbg.print('sceneloc:setUp')
18
19 ---- Cancel playing streams
20 --audio:stopStream()
21
22 -- Print background
23 local rectBack = director:createRectangle({
24 x=0, y=0,
25 w=dsw, h=dsh,
26 strokeWidth=0,
27 color={10, 74, 134}, alpha=1})
28
29 -- Initialize heading labels
30 local labTitle = director:createLabel({
31 x=0, y=-fontArial.height*1.5/6,
32 hAlignment='centre', vAlignment='top',
33 font=fontArial,
34 text='Astrokaat Information',
35 color={0xe0, 0xe0, 0xff}
36 })
37
38 -- Initialize heading buttons
39 local butBack = director:createSprite(fontSegoe.height, dsh-fontArial.height*1.5/4, 'images/butback1.png')
40 butBack.yAnchor = 1
41 butBack.xScale = .8
42 butBack.yScale = .8
43
44 -- Initialize body text labels
45 local rectAlph = director:createRectangle(fontSegoe.height, fontSegoe.height, dsw - fontSegoe.height * 2, dsh - fontArial.height * 2.25)
46 rectAlph.color = color.black
47 rectAlph.color.a = 64
48 local labCont = director:createLabel({
49 x=fontSegoe.height*2, y=-fontSegoe.height*3.25,
50 w=dsw-fontSegoe.height*3, h=0,
51 hAlignment='left', vAlignment='top',
52 font=fontSegoe,
53 text='Astrokaat - Space feline arcade game 0.7\nAstrokaat is a game where food is eaten and obstacles are avoided in a race against time.\n\nCopyright 2013 Michael Schloh von Bennewitz,\nThis software is made with Marmalade and distributed under the terms EUPL version 1.1'
54 })
55
56 -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical
57 local transoptl = {transitionType = 'slideInL', transitionTime = 0.5}
58 local transoptr = {transitionType = 'slideInR', transitionTime = 0.5}
59 local transoptt = {transitionType = 'slideInT', transitionTime = 0.5}
60 local transoptb = {transitionType = 'slideInB', transitionTime = 0.5}
61
62 -- Implement event handlers
63 function labCont:touch(event)
64 if event.phase == 'began' then
65 if browser:isAvailable() then
66 browser:launchURL('http://otpwcalc.europalab.com/')
67 end
68 end
69 return true
70 end
71 labCont:addEventListener('touch', labCont)
72
73 function butBack:touch(event)
74 if event.phase == 'began' then
75 director:moveToScene(table.remove(nodeLastscene), table.remove(nodeLasttrans))
76 end
77 return true
78 end
79 butBack:addEventListener('touch', butBack)
80 end
81
82 function sceneloc:tearDown(event)
83 dbg.print('sceneloc:tearDown')
84 --self.releaseResources()
85 --self.<obj-here> = self.<obj-here>:removeFromParent()
86 --self.obj0:removeFromParent()
87 --self.obj1:removeFromParent()
88 --self.obj0 = nil
89 --self.obj1 = nil
90 end
91
92 function sceneloc:enterPreTransition(event)
93 dbg.print('sceneloc:enterPreTransition')
94 end
95
96 function sceneloc:enterPostTransition(event)
97 dbg.print('sceneloc:enterPostTransition')
98 end
99
100 function sceneloc:exitPreTransition(event)
101 dbg.print('sceneloc:exitPreTransition')
102 end
103
104 function sceneloc:exitPostTransition(event)
105 dbg.print('sceneloc:exitPostTransition')
106 end
107
108 sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition',
109 'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc)
110
111 return sceneloc
112

mercurial