-------------------------------------------------------------------------------- -- Copyright (c) 2009 Andreas Rozek -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"),to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is fur- -- nished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA- -- BILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- Additionally, any modifications to the original Software must be clearly -- marked in a way, that the original author will never be considered as the -- author of these modifications! -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Display Elements -- -------------------------------------------------------------------------------- SplashScreen = display.newImage("Default.png", 0,0); TorchScreen = display.newImage("TorchScreen.jpg", 0,0); TorchScreen.alpha = 0; -------------------------------------------------------------------------------- -- Event Handlers -- -------------------------------------------------------------------------------- StartUpListener = { enterFrame = function (Event) if (system.getTimer() > 2000) then -- wait 2 sec.s before proceeding transition.to( SplashScreen, { time = 1000, alpha = 0, onComplete = function () SplashScreen.isVisible = false; end } ); transition.to(TorchScreen, {time = 1000, alpha = 1}); Runtime:removeEventListener("enterFrame", StartUpListener); end; end }; Runtime:addEventListener("enterFrame", StartUpListener); Runtime:addEventListener( "system", function (Event) if (Event.type == "applicationStart") then system.setIdleTimer(false); -- disable the idle timer return true; end; if (Event.type == "applicationSuspend") then system.setIdleTimer(true); -- enable idle timer while program in bg return true; end; if (Event.type == "applicationResume") then system.setIdleTimer(false); -- disable idle timer while program in fg return true; end; if (Event.type == "applicationExit") then system.setIdleTimer(true); -- enable idle timer on exit return true; end; end );