michael@0: -- Your app starts here! michael@0: --require('mobdebug').start() michael@0: michael@0: -- Deny backlight dimming michael@0: device:setBacklightAlways() michael@0: michael@0: -- Track scene history (for back sequence) michael@0: --local szLasttrans = '' michael@0: --local nodeLastscene michael@0: nodeLastscene = {} michael@0: nodeLasttrans = {} michael@0: michael@0: -- Load scene blocks michael@0: sceneIntro = dofile('sceneintro.lua') michael@0: sceneRules = dofile('scenerules.lua') michael@0: sceneBegin = dofile('scenebegin.lua') michael@0: sceneGover = dofile('scenegover.lua') michael@0: sceneAbout = dofile('sceneabout.lua') michael@0: sceneHelp = dofile('scenehelp.lua') michael@0: michael@0: -- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical michael@0: local transoptl = {transitionType = 'slideInL', transitionTime = 0.5} michael@0: local transoptr = {transitionType = 'slideInR', transitionTime = 0.5} michael@0: local transoptt = {transitionType = 'slideInT', transitionTime = 0.5} michael@0: local transoptb = {transitionType = 'slideInB', transitionTime = 0.5} michael@0: michael@0: -- Implement global event handlers michael@0: function hardkeyPressed(event) michael@0: if event.phase == 'released' then michael@0: if event.keyCode == key.back then michael@0: if nodeLastscene[1] ~= nil then michael@0: director:moveToScene(table.remove(nodeLastscene), table.remove(nodeLasttrans)) michael@0: --return true michael@0: else michael@0: --os.exit(0) michael@0: system.quit() michael@0: end michael@0: end michael@0: end michael@0: end michael@0: system:addEventListener('key', hardkeyPressed) michael@0: michael@0: -- Not sure if this is buggy michael@0: --function getOuttaHere(event) michael@0: -- --os.exit(0) michael@0: -- system.quit() michael@0: --end michael@0: --system:addEventListener('exit', getOuttaHere) michael@0: michael@0: -- Bootstrap initial scene michael@0: director:setCurrentScene(nil) michael@0: director:moveToScene(sceneIntro) michael@0: