michael@0: -- Top of scene michael@0: --print('This is a new scene!') michael@0: michael@0: -- Initiate scene management michael@0: local sceneloc = director:createScene() michael@0: sceneloc.name = 'Scene: About' michael@0: michael@0: -- Constants calculated michael@0: local dsw = director.displayWidth michael@0: local dsh = director.displayHeight michael@0: michael@0: -- Fonts created michael@0: local fontArial = director:createFont('fonts/Arial-96pt_bold.fnt') michael@0: local fontSegoe = director:createFont('fonts/SegoeUI-64pt_bold.fnt') michael@0: michael@0: function sceneloc:setUp(event) michael@0: dbg.print('sceneloc:setUp') michael@0: michael@0: ---- Cancel playing streams michael@0: --audio:stopStream() michael@0: michael@0: -- Print background michael@0: local rectBack = director:createRectangle({ michael@0: x=0, y=0, michael@0: w=dsw, h=dsh, michael@0: strokeWidth=0, michael@0: color={10, 74, 134}, alpha=1}) michael@0: michael@0: -- Initialize heading labels michael@0: local labTitle = director:createLabel({ michael@0: x=0, y=-fontArial.height*1.5/6, michael@0: hAlignment='centre', vAlignment='top', michael@0: font=fontArial, michael@0: text='Astrokaat Information', michael@0: color={0xe0, 0xe0, 0xff} michael@0: }) michael@0: michael@0: -- Initialize heading buttons michael@0: local butBack = director:createSprite(fontSegoe.height, dsh-fontArial.height*1.5/4, 'images/butback1.png') michael@0: butBack.yAnchor = 1 michael@0: butBack.xScale = .8 michael@0: butBack.yScale = .8 michael@0: michael@0: -- Initialize body text labels michael@0: local rectAlph = director:createRectangle(fontSegoe.height, fontSegoe.height, dsw - fontSegoe.height * 2, dsh - fontArial.height * 2.25) michael@0: rectAlph.color = color.black michael@0: rectAlph.color.a = 64 michael@0: local labCont = director:createLabel({ michael@0: x=fontSegoe.height*2, y=-fontSegoe.height*3.25, michael@0: w=dsw-fontSegoe.height*3, h=0, michael@0: hAlignment='left', vAlignment='top', michael@0: font=fontSegoe, michael@0: 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' michael@0: }) michael@0: michael@0: -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical michael@0: local transoptl = {transitionType = 'slideInL', transitionTime = 0.5} michael@0: local transoptr = {transitionType = 'slideInR', transitionTime = 0.5} michael@0: local transoptt = {transitionType = 'slideInT', transitionTime = 0.5} michael@0: local transoptb = {transitionType = 'slideInB', transitionTime = 0.5} michael@0: michael@0: -- Implement event handlers michael@0: function labCont:touch(event) michael@0: if event.phase == 'began' then michael@0: if browser:isAvailable() then michael@0: browser:launchURL('http://otpwcalc.europalab.com/') michael@0: end michael@0: end michael@0: return true michael@0: end michael@0: labCont:addEventListener('touch', labCont) michael@0: michael@0: function butBack:touch(event) michael@0: if event.phase == 'began' then michael@0: director:moveToScene(table.remove(nodeLastscene), table.remove(nodeLasttrans)) michael@0: end michael@0: return true michael@0: end michael@0: butBack:addEventListener('touch', butBack) michael@0: end michael@0: michael@0: function sceneloc:tearDown(event) michael@0: dbg.print('sceneloc:tearDown') michael@0: --self.releaseResources() michael@0: --self. = self.:removeFromParent() michael@0: --self.obj0:removeFromParent() michael@0: --self.obj1:removeFromParent() michael@0: --self.obj0 = nil michael@0: --self.obj1 = nil michael@0: end michael@0: michael@0: function sceneloc:enterPreTransition(event) michael@0: dbg.print('sceneloc:enterPreTransition') michael@0: end michael@0: michael@0: function sceneloc:enterPostTransition(event) michael@0: dbg.print('sceneloc:enterPostTransition') michael@0: end michael@0: michael@0: function sceneloc:exitPreTransition(event) michael@0: dbg.print('sceneloc:exitPreTransition') michael@0: end michael@0: michael@0: function sceneloc:exitPostTransition(event) michael@0: dbg.print('sceneloc:exitPostTransition') michael@0: end michael@0: michael@0: sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition', michael@0: 'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc) michael@0: michael@0: return sceneloc michael@0: