-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathmain.lua
More file actions
60 lines (48 loc) · 1.69 KB
/
main.lua
File metadata and controls
60 lines (48 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--[[
This is the main.lua file. It executes first and in this demo
is sole purpose is to set some initial visual settings and
then you execute our game or menu scene via composer.
Composer is the official scene (screen) creation and management
library in Corona SDK. This library provides developers with an
easy way to create and transition between individual scenes.
https://docs.coronalabs.com/api/library/composer/index.html
-- ]]
local composer = require( "composer" )
-- Removes status bar on iOS
display.setStatusBar( display.HiddenStatusBar )
-- Removes bottom bar on Android
if system.getInfo( "androidApiLevel" ) and system.getInfo( "androidApiLevel" ) < 19 then
native.setProperty( "androidSystemUiVisibility", "lowProfile" )
else
native.setProperty( "androidSystemUiVisibility", "immersiveSticky" )
end
-- are we running on a simulator?
local isSimulator = "simulator" == system.getInfo( "environment" )
-- if we are load our visual monitor that let's a press of the "F"
-- key show our frame rate and memory usage
if isSimulator then
-- show FPS
local visualMonitor = require( "com.ponywolf.visualMonitor" )
local visMon = visualMonitor:new()
visMon.isVisible = false
-- show/hide physics
local function debugKeys( event )
local phase = event.phase
local key = event.keyName
if phase == "up" then
if key == "p" then
physics.show = not physics.show
if physics.show then
physics.setDrawMode( "hybrid" )
else
physics.setDrawMode( "normal" )
end
elseif key == "f" then
visMon.isVisible = not visMon.isVisible
end
end
end
Runtime:addEventListener( "key", debugKeys )
end
-- go to menu screen
composer.gotoScene( "scene.menu", { params={ } } )