resources/sceneabout.lua

Wed, 31 Jul 2013 19:28:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Jul 2013 19:28:00 +0200
changeset 0
7ff85f7ce3a7
permissions
-rw-r--r--

Flush prograss with initial commit.

     1 -- Initiate scene management
     2 local sceneloc = director:createScene()
     3 sceneloc.name = 'Scene: About'
     5 -- Constants calculated
     6 local dsw = director.displayWidth
     7 local dsh = director.displayHeight
     9 -- Fonts created
    10 local fontarial = director:createFont('fonts/Arial-96pt_bold.fnt')
    11 local fontklein = director:createFont('fonts/SegoeUI-64pt_smbld.fnt')
    13 function sceneloc:setUp(event)
    14     dbg.print('sceneloc:setUp')
    16     -- Print background
    17     local imgback = director:createSprite(0, 0, 'textures/skynorm.png')
    18     imgback.xScale = dsw / imgback.w
    19     imgback.yScale = (dsh - fontarial.height * 1.5) / imgback.h
    21     -- Heading labels
    22     local labtitle = director:createLabel({
    23         x=0, y=-fontarial.height*1.5/6,
    24         hAlignment='centre', vAlignment='top',
    25         font=fontarial,
    26         text='About',
    27         color={0xe0, 0xe0, 0xff}
    28     })
    29     local butback = director:createSprite(0, 0, 'images/butback.png')
    30     butback.x = fontarial.height*1.5/2
    31     butback.y = dsh-fontarial.height*1.5/2
    32     butback.xAnchor = 0.5
    33     butback.yAnchor = 0.5
    35     -- Body text labels
    36     local rectalph = director:createRectangle(fontklein.height, fontklein.height, dsw - fontklein.height * 2, dsh - fontarial.height * 1.5 - fontklein.height * 2)
    37     rectalph.color = color.white
    38     rectalph.color.a = 64
    39     local labcont = director:createLabel({
    40         x=fontklein.height*1.5, y=-fontarial.height * 2 - fontklein.height * .5,
    41         w=dsw-fontklein.height*3, h=0,
    42         hAlignment='left', vAlignment='top',
    43         font=fontklein,
    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'
    45     })
    47     -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical
    48     local transoptl = {transitionType = 'slideInL', transitionTime = 0.5}
    50     function butback:touch(event)
    51         if event.phase == 'began' then
    52             director:moveToScene(sceneMain, transoptl)
    53         end
    54     end
    55     butback:addEventListener('touch', butback)
    56 end
    58 function sceneloc:tearDown(event)
    59     dbg.print('sceneloc:tearDown')
    60     --self.obj0:removeFromParent()
    61     --self.obj1:removeFromParent()
    62     --self.obj0 = nil
    63     --self.obj1 = nil
    64 end
    66 function sceneloc:enterPreTransition(event)
    67     dbg.print('sceneloc:enterPreTransition')
    68 end
    70 function sceneloc:enterPostTransition(event)
    71     dbg.print('sceneloc:enterPostTransition')
    72 end
    74 function sceneloc:exitPreTransition(event)
    75     dbg.print('sceneloc:exitPreTransition')
    76 end
    78 function sceneloc:exitPostTransition(event)
    79     dbg.print('sceneloc:exitPostTransition')
    80 end
    82 sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition',
    83     'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc)
    85 return sceneloc

mercurial