-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.lua
56 lines (50 loc) · 1.32 KB
/
config.lua
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
-- Author: Lerg - spiralcodestudio.com
-- GitHub: https://github.com/Lerg/smartpixel-config-lua
-- SmartPixel config.lua
-- Uses pixel perfect content scaling when possible
local w, h = display.pixelWidth, display.pixelHeight
local modes = {1, 1.5, 2, 3, 4, 6, 8} -- Scaling factors to try
local contentW, contentH = 320, 480 -- Minimal size your content can fit in
-- Try each mode and find the best one
local _w, _h, _m = w, h, 1
for i = 1, #modes do
local m = modes[i]
local lw, lh = w / m, h / m
if lw < contentW or lh < contentH then
break
else
_w, _h, _m = lw, lh, m
end
end
-- If scaling is not pixel perfect (between 1 and 2) - use letterbox
if _m < 2 then
local scale = math.max(contentW / w, contentH / h)
_w, _h = w * scale, h * scale
end
application = {
content = {
width = _w,
height = _h,
scale = 'letterbox',
fps = 60,
imageSuffix = {
['@2x'] = 1.1,
['@4x'] = 2.1,
}
}
}
-- Uncomment to use the common content scaling
--[[
application = {
content = {
width = 320,
height = 480,
scale = 'letterbox',
fps = 60,
imageSuffix = {
['@2x'] = 1.1,
['@4x'] = 2.1,
}
}
}
--]]