forked from DanS2D/Solar2D-WidgetExtension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
35 lines (29 loc) · 753 Bytes
/
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
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
}}}