-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
104 lines (84 loc) · 2.94 KB
/
main.lua
File metadata and controls
104 lines (84 loc) · 2.94 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
-- main.lua
-- require 'Strict'
local pprint = require 'pprint'
local composer = require 'composer'
local GameState = require 'GameState'
function _G.trace(...)
if system.getInfo('environment') == 'simulator' then
local lst = {...}
if #lst == 1 and type(lst[1]) == 'table' then
pprint(lst[1]) -- doesn't take varargs
else
print(...)
end
end
end
if system.getInfo('platform') == 'win32' or system.getInfo('environment') == 'simulator' then
print('_VERSION', _VERSION)
print('screenOrigin', display.screenOriginX, display.screenOriginY)
print('safeAreaInsets', display.getSafeAreaInsets())
print('content', display.contentWidth, display.contentHeight)
print('actualContent', display.actualContentWidth, display.actualContentHeight)
print('safeActualContent', display.safeActualContentWidth, display.safeActualContentHeight)
print('viewableContent', display.viewableContentWidth, display.viewableContentHeight)
print('pixelWidth/Height', display.pixelWidth, display.pixelHeight)
-- print('maxTextureSize', system.getInfo('maxTextureSize'))
print('platformName', system.getInfo('platformName'))
print('architectureInfo', system.getInfo('architectureInfo'))
print('model', system.getInfo('model'))
-- print('androidDisplayApproximateDpi', system.getInfo('androidDisplayApproximateDpi'))
end
--[[
_G.onTablet = system.getInfo('model') == 'iPad'
if not _G.onTablet then
local approximateDpi = system.getInfo('androidDisplayApproximateDpi')
if approximateDpi then
local width = display.pixelWidth / approximateDpi
local height = display.pixelHeight / approximateDpi
if width > 4.5 and height > 7 then
_G.onTablet = true
end
end
end
]]
native.setProperty('windowTitleText', 'Mycelium Loops') -- Win32
-- math.randomseed(os.time())
_G.MYCELIUM_SOUNDS = {
tap = audio.loadSound('assets/sound56.wav'),
section = audio.loadSound('assets/sound63.wav'),
complete = audio.loadSound('assets/complete.wav'),
locked = audio.loadSound('assets/sound61.wav'),
}
if not _G.table.find then
function _G.table.find(tbl, fn)
for _,v in ipairs(tbl) do
if fn(v) then
return v
end
end
return nil
end
end
-- print('table find', type(table.find))
if not _G.table.filter then
_G.table.filter = function(t, filterIter)
local out = {}
for k, v in pairs(t) do
if filterIter(v, k, t) then table.insert(out, v) end
end
return out
end
end
-- print('table filter', type(table.filter))
_G.gameState = GameState.new()
-- _G.antialiasImageSheet = graphics.newImageSheet("antialias.png", {width=5, height=5, numFrames=1, sheetContentWidth=5, sheetContentHeight=5})
-- _G.antialiasPaint = {
-- type = 'image',
-- sheet = _G.antialiasImageSheet,
-- frame = 1,
-- -- filename = system.pathForFile('antialias.png', system.ResourceDirectory)
-- }
composer.gotoScene('Splash', {effect='fade', params={scene='Mycelium'}})
-- for k,v in pairs( _G ) do
-- print( k , v )
-- end