Skip to content

Commit

Permalink
added safeArea constants
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdugne committed May 31, 2020
1 parent 3ae08ae commit 9cfa42c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ stds.cherry = {
'string',
'table',
'unpack',
'FULL_W',
'FULL_H',
'W',
'H'
'H',
'TOP',
'BOTTOM'
}
}

Expand Down
2 changes: 1 addition & 1 deletion cherry/components/background.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Background:init(options)
)

if (options.color) then
self.bg = display.newRect(W / 2, H / 2, W, H)
self.bg = display.newRect(FULL_W / 2, FULL_H / 2, FULL_W, FULL_H)
self.bg:setFillColor(colorize(options.color))
else
local lightImage = options.light
Expand Down
15 changes: 13 additions & 2 deletions cherry/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ _G.Router = require 'cherry.core.router'

--------------------------------------------------------------------------------

_G.W = display.contentWidth
_G.H = display.contentHeight
_G.FULL_W = display.contentWidth
_G.FULL_H = display.contentHeight

_G.W = display.safeActualContentWidth
_G.H = display.safeActualContentHeight

_G.TOP = display.safeScreenOriginY
_G.BOTTOM = display.safeScreenOriginY + display.safeActualContentHeight

-- local safeArea = display.newRect(W / 2, TOP + H / 2, W, H)
-- local colorize = require 'cherry.libs.colorize'
-- safeArea:setFillColor(colorize('#fff'))
-- safeArea.alpha = 0.2

--------------------------------------------------------------------------------
-- https://docs.coronalabs.com/tutorial/media/extendAnchors/index.html#extending-anchor-points-1
Expand Down

0 comments on commit 9cfa42c

Please sign in to comment.