1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/resources/main.lua Thu Aug 22 19:50:12 2013 +0200 1.3 @@ -0,0 +1,53 @@ 1.4 +-- Your app starts here! 1.5 +--require('mobdebug').start() 1.6 + 1.7 +-- Deny backlight dimming 1.8 +device:setBacklightAlways() 1.9 + 1.10 +-- Track scene history (for back sequence) 1.11 +--local szLasttrans = '' 1.12 +--local nodeLastscene 1.13 +nodeLastscene = {} 1.14 +nodeLasttrans = {} 1.15 + 1.16 +-- Load scene blocks 1.17 +sceneIntro = dofile('sceneintro.lua') 1.18 +sceneRules = dofile('scenerules.lua') 1.19 +sceneBegin = dofile('scenebegin.lua') 1.20 +sceneGover = dofile('scenegover.lua') 1.21 +sceneAbout = dofile('sceneabout.lua') 1.22 +sceneHelp = dofile('scenehelp.lua') 1.23 + 1.24 +-- Good transitions: slideInL/R, shrinkGrow, crossFade, fadeTR/BL, pageTurn, progressVertical 1.25 +local transoptl = {transitionType = 'slideInL', transitionTime = 0.5} 1.26 +local transoptr = {transitionType = 'slideInR', transitionTime = 0.5} 1.27 +local transoptt = {transitionType = 'slideInT', transitionTime = 0.5} 1.28 +local transoptb = {transitionType = 'slideInB', transitionTime = 0.5} 1.29 + 1.30 +-- Implement global event handlers 1.31 +function hardkeyPressed(event) 1.32 + if event.phase == 'released' then 1.33 + if event.keyCode == key.back then 1.34 + if nodeLastscene[1] ~= nil then 1.35 + director:moveToScene(table.remove(nodeLastscene), table.remove(nodeLasttrans)) 1.36 + --return true 1.37 + else 1.38 + --os.exit(0) 1.39 + system.quit() 1.40 + end 1.41 + end 1.42 + end 1.43 +end 1.44 +system:addEventListener('key', hardkeyPressed) 1.45 + 1.46 +-- Not sure if this is buggy 1.47 +--function getOuttaHere(event) 1.48 +-- --os.exit(0) 1.49 +-- system.quit() 1.50 +--end 1.51 +--system:addEventListener('exit', getOuttaHere) 1.52 + 1.53 +-- Bootstrap initial scene 1.54 +director:setCurrentScene(nil) 1.55 +director:moveToScene(sceneIntro) 1.56 +