Wed, 31 Jul 2013 19:28:00 +0200
Flush prograss with initial commit.
michael@0 | 1 | -- Initiate scene management |
michael@0 | 2 | local sceneloc = director:createScene() |
michael@0 | 3 | sceneloc.name = 'Scene: About' |
michael@0 | 4 | |
michael@0 | 5 | -- Constants calculated |
michael@0 | 6 | local dsw = director.displayWidth |
michael@0 | 7 | local dsh = director.displayHeight |
michael@0 | 8 | |
michael@0 | 9 | -- Fonts created |
michael@0 | 10 | local fontarial = director:createFont('fonts/Arial-96pt_bold.fnt') |
michael@0 | 11 | local fontklein = director:createFont('fonts/SegoeUI-64pt_smbld.fnt') |
michael@0 | 12 | |
michael@0 | 13 | function sceneloc:setUp(event) |
michael@0 | 14 | dbg.print('sceneloc:setUp') |
michael@0 | 15 | |
michael@0 | 16 | -- Print background |
michael@0 | 17 | local imgback = director:createSprite(0, 0, 'textures/skynorm.png') |
michael@0 | 18 | imgback.xScale = dsw / imgback.w |
michael@0 | 19 | imgback.yScale = (dsh - fontarial.height * 1.5) / imgback.h |
michael@0 | 20 | |
michael@0 | 21 | -- Heading labels |
michael@0 | 22 | local labtitle = director:createLabel({ |
michael@0 | 23 | x=0, y=-fontarial.height*1.5/6, |
michael@0 | 24 | hAlignment='centre', vAlignment='top', |
michael@0 | 25 | font=fontarial, |
michael@0 | 26 | text='About', |
michael@0 | 27 | color={0xe0, 0xe0, 0xff} |
michael@0 | 28 | }) |
michael@0 | 29 | local butback = director:createSprite(0, 0, 'images/butback.png') |
michael@0 | 30 | butback.x = fontarial.height*1.5/2 |
michael@0 | 31 | butback.y = dsh-fontarial.height*1.5/2 |
michael@0 | 32 | butback.xAnchor = 0.5 |
michael@0 | 33 | butback.yAnchor = 0.5 |
michael@0 | 34 | |
michael@0 | 35 | -- Body text labels |
michael@0 | 36 | local rectalph = director:createRectangle(fontklein.height, fontklein.height, dsw - fontklein.height * 2, dsh - fontarial.height * 1.5 - fontklein.height * 2) |
michael@0 | 37 | rectalph.color = color.white |
michael@0 | 38 | rectalph.color.a = 64 |
michael@0 | 39 | local labcont = director:createLabel({ |
michael@0 | 40 | x=fontklein.height*1.5, y=-fontarial.height * 2 - fontklein.height * .5, |
michael@0 | 41 | w=dsw-fontklein.height*3, h=0, |
michael@0 | 42 | hAlignment='left', vAlignment='top', |
michael@0 | 43 | font=fontklein, |
michael@0 | 44 | text='Amalog\n\nAmateur Radio Logbook 0.7\nAmalog stores call records (QSOs) typically logged by amateur radio enthusiasts.\nVisit the Amalog Homepage\n\nCopyright 2012-2013\nMichael Schloh von Bennewitz\nMade with Marmalade SDK\n\nThis software is distributed under the terms of the European Union Public Licence (EUPL) version 1.1' |
michael@0 | 45 | }) |
michael@0 | 46 | |
michael@0 | 47 | -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical |
michael@0 | 48 | local transoptl = {transitionType = 'slideInL', transitionTime = 0.5} |
michael@0 | 49 | |
michael@0 | 50 | function butback:touch(event) |
michael@0 | 51 | if event.phase == 'began' then |
michael@0 | 52 | director:moveToScene(sceneMain, transoptl) |
michael@0 | 53 | end |
michael@0 | 54 | end |
michael@0 | 55 | butback:addEventListener('touch', butback) |
michael@0 | 56 | end |
michael@0 | 57 | |
michael@0 | 58 | function sceneloc:tearDown(event) |
michael@0 | 59 | dbg.print('sceneloc:tearDown') |
michael@0 | 60 | --self.obj0:removeFromParent() |
michael@0 | 61 | --self.obj1:removeFromParent() |
michael@0 | 62 | --self.obj0 = nil |
michael@0 | 63 | --self.obj1 = nil |
michael@0 | 64 | end |
michael@0 | 65 | |
michael@0 | 66 | function sceneloc:enterPreTransition(event) |
michael@0 | 67 | dbg.print('sceneloc:enterPreTransition') |
michael@0 | 68 | end |
michael@0 | 69 | |
michael@0 | 70 | function sceneloc:enterPostTransition(event) |
michael@0 | 71 | dbg.print('sceneloc:enterPostTransition') |
michael@0 | 72 | end |
michael@0 | 73 | |
michael@0 | 74 | function sceneloc:exitPreTransition(event) |
michael@0 | 75 | dbg.print('sceneloc:exitPreTransition') |
michael@0 | 76 | end |
michael@0 | 77 | |
michael@0 | 78 | function sceneloc:exitPostTransition(event) |
michael@0 | 79 | dbg.print('sceneloc:exitPostTransition') |
michael@0 | 80 | end |
michael@0 | 81 | |
michael@0 | 82 | sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition', |
michael@0 | 83 | 'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc) |
michael@0 | 84 | |
michael@0 | 85 | return sceneloc |