resources/sceneabout.lua

changeset 0
7ff85f7ce3a7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/resources/sceneabout.lua	Wed Jul 31 19:28:00 2013 +0200
     1.3 @@ -0,0 +1,85 @@
     1.4 +-- Initiate scene management
     1.5 +local sceneloc = director:createScene()
     1.6 +sceneloc.name = 'Scene: About'
     1.7 +
     1.8 +-- Constants calculated
     1.9 +local dsw = director.displayWidth
    1.10 +local dsh = director.displayHeight
    1.11 +
    1.12 +-- Fonts created
    1.13 +local fontarial = director:createFont('fonts/Arial-96pt_bold.fnt')
    1.14 +local fontklein = director:createFont('fonts/SegoeUI-64pt_smbld.fnt')
    1.15 +
    1.16 +function sceneloc:setUp(event)
    1.17 +    dbg.print('sceneloc:setUp')
    1.18 +
    1.19 +    -- Print background
    1.20 +    local imgback = director:createSprite(0, 0, 'textures/skynorm.png')
    1.21 +    imgback.xScale = dsw / imgback.w
    1.22 +    imgback.yScale = (dsh - fontarial.height * 1.5) / imgback.h
    1.23 +
    1.24 +    -- Heading labels
    1.25 +    local labtitle = director:createLabel({
    1.26 +        x=0, y=-fontarial.height*1.5/6,
    1.27 +        hAlignment='centre', vAlignment='top',
    1.28 +        font=fontarial,
    1.29 +        text='About',
    1.30 +        color={0xe0, 0xe0, 0xff}
    1.31 +    })
    1.32 +    local butback = director:createSprite(0, 0, 'images/butback.png')
    1.33 +    butback.x = fontarial.height*1.5/2
    1.34 +    butback.y = dsh-fontarial.height*1.5/2
    1.35 +    butback.xAnchor = 0.5
    1.36 +    butback.yAnchor = 0.5
    1.37 +
    1.38 +    -- Body text labels
    1.39 +    local rectalph = director:createRectangle(fontklein.height, fontklein.height, dsw - fontklein.height * 2, dsh - fontarial.height * 1.5 - fontklein.height * 2)
    1.40 +    rectalph.color = color.white
    1.41 +    rectalph.color.a = 64
    1.42 +    local labcont = director:createLabel({
    1.43 +        x=fontklein.height*1.5, y=-fontarial.height * 2 - fontklein.height * .5,
    1.44 +        w=dsw-fontklein.height*3, h=0,
    1.45 +        hAlignment='left', vAlignment='top',
    1.46 +        font=fontklein,
    1.47 +        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'
    1.48 +    })
    1.49 +
    1.50 +    -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical
    1.51 +    local transoptl = {transitionType = 'slideInL', transitionTime = 0.5}
    1.52 +
    1.53 +    function butback:touch(event)
    1.54 +        if event.phase == 'began' then
    1.55 +            director:moveToScene(sceneMain, transoptl)
    1.56 +        end
    1.57 +    end
    1.58 +    butback:addEventListener('touch', butback)
    1.59 +end
    1.60 +
    1.61 +function sceneloc:tearDown(event)
    1.62 +    dbg.print('sceneloc:tearDown')
    1.63 +    --self.obj0:removeFromParent()
    1.64 +    --self.obj1:removeFromParent()
    1.65 +    --self.obj0 = nil
    1.66 +    --self.obj1 = nil
    1.67 +end
    1.68 +
    1.69 +function sceneloc:enterPreTransition(event)
    1.70 +    dbg.print('sceneloc:enterPreTransition')
    1.71 +end
    1.72 +
    1.73 +function sceneloc:enterPostTransition(event)
    1.74 +    dbg.print('sceneloc:enterPostTransition')
    1.75 +end
    1.76 +
    1.77 +function sceneloc:exitPreTransition(event)
    1.78 +    dbg.print('sceneloc:exitPreTransition')
    1.79 +end
    1.80 +
    1.81 +function sceneloc:exitPostTransition(event)
    1.82 +    dbg.print('sceneloc:exitPostTransition')
    1.83 +end
    1.84 +
    1.85 +sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition',
    1.86 +    'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc)
    1.87 +
    1.88 +return sceneloc

mercurial