resources/main.lua

Thu, 22 Aug 2013 19:50:12 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Aug 2013 19:50:12 +0200
changeset 0
bba7a2a225f6
permissions
-rw-r--r--

Flush progress with initial commit, improve application.

     1 -- Your app starts here!
     2 --require('mobdebug').start()
     4 -- Deny backlight dimming
     5 device:setBacklightAlways()
     7 -- Track scene history (for back sequence)
     8 --local szLasttrans = ''
     9 --local nodeLastscene
    10 nodeLastscene = {}
    11 nodeLasttrans = {}
    13 -- Load scene blocks
    14 sceneIntro = dofile('sceneintro.lua')
    15 sceneRules = dofile('scenerules.lua')
    16 sceneBegin = dofile('scenebegin.lua')
    17 sceneGover = dofile('scenegover.lua')
    18 sceneAbout = dofile('sceneabout.lua')
    19 sceneHelp  = dofile('scenehelp.lua')
    21 -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical
    22 local transoptl = {transitionType = 'slideInL', transitionTime = 0.5}
    23 local transoptr = {transitionType = 'slideInR', transitionTime = 0.5}
    24 local transoptt = {transitionType = 'slideInT', transitionTime = 0.5}
    25 local transoptb = {transitionType = 'slideInB', transitionTime = 0.5}
    27 -- Implement global event handlers
    28 function hardkeyPressed(event)
    29     if event.phase == 'released' then
    30         if event.keyCode == key.back then
    31             if nodeLastscene[1] ~= nil then
    32                 director:moveToScene(table.remove(nodeLastscene), table.remove(nodeLasttrans))
    33                 --return true
    34             else
    35                 --os.exit(0)
    36                 system.quit()
    37             end
    38         end
    39     end
    40 end
    41 system:addEventListener('key', hardkeyPressed)
    43 -- Not sure if this is buggy
    44 --function getOuttaHere(event)
    45 --    --os.exit(0)
    46 --    system.quit()
    47 --end
    48 --system:addEventListener('exit', getOuttaHere)
    50 -- Bootstrap initial scene
    51 director:setCurrentScene(nil)
    52 director:moveToScene(sceneIntro)

mercurial