resources/scenehelp.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: Help'
     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='Help',
    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='To start using Amalog now\n    1. Press \'Add\' to add a QSO call entry:\n    2. Enter free text into the add field\n    3. Press \'Okay\' to store the new entry\n    4. Repeat steps 1-3 as appropriate\n\nTo delete a QSO call entry\n    1. Press a entry in the list to highlight\n    2. Press \'Delete\' at the bottom to delete'
    45     })
    46     -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical
    47     local transoptl = {transitionType = 'slideInL', transitionTime = 0.5}
    49     function butback:touch(event)
    50         if event.phase == 'began' then
    51             director:moveToScene(sceneMain, transoptl)
    52         end
    53     end
    54     butback:addEventListener('touch', butback)
    55 end
    57 function sceneloc:tearDown(event)
    58     dbg.print('sceneloc:tearDown')
    59     --self.obj0:removeFromParent()
    60     --self.obj1:removeFromParent()
    61     --self.obj0 = nil
    62     --self.obj1 = nil
    63 end
    65 function sceneloc:enterPreTransition(event)
    66     dbg.print('sceneloc:enterPreTransition')
    67 end
    69 function sceneloc:enterPostTransition(event)
    70     dbg.print('sceneloc:enterPostTransition')
    71 end
    73 function sceneloc:exitPreTransition(event)
    74     dbg.print('sceneloc:exitPreTransition')
    75 end
    77 function sceneloc:exitPostTransition(event)
    78     dbg.print('sceneloc:exitPostTransition')
    79 end
    81 sceneloc:addEventListener({'setUp', 'tearDown', 'enterPreTransition',
    82     'enterPostTransition', 'exitPreTransition', 'exitPostTransition'}, sceneloc)
    84 return sceneloc

mercurial