Module SafeWord
SafeWord is an overscan detection library for LÖVE.
Info:
- Copyright: 2015
- License: zlib/libpng
- Author: Josef N Patoprsty
Functions
safeword.new (init) | Instansiate a new instance of SafeWord. |
safeword:draw () | Main draw function
This is the main draw function that one would add to love.draw . |
safeword:getModes () | Get the available modes in SafeWord |
safeword:setPreset (mode) | Set the current mode in SafeWord. |
safeword:getActionX () | Get the calculated X coordinate of the action safe area. |
safeword:getActionY () | Get the calculated Y coordinate of the action safe area. |
safeword:getActionWidth () | Get the calculated width of the action safe area. |
safeword:getActionHeight () | Get the calculated height of the action safe area. |
safeword:getTitleX () | Get the calculated X coordinate of the title safe area. |
safeword:getTitleY () | Get the calculated Y coordinate of the title safe area. |
safeword:getTitleWidth () | Get the calculated width of the title safe area. |
safeword:getTitleHeight () | Get the calculated height of the title safe area. |
safeword:getHorizontalAction () | Get the currently set horizontal action safe area percentage. |
safeword:setHorizontalAction (val) | Set the current horizontal action safe area percentage. |
safeword:getHorizontalTitle () | Get the currently set horizontal title safe area percentage. |
safeword:setHorizontalTitle (val) | Set the current horizontal title safe area percentage. |
safeword:getVerticalAction () | Get the currently set vertical action safe area percentage. |
safeword:setVerticalAction (val) | Set the current vertical action safe area percentage. |
safeword:getVerticalTitle () | Get the currently set vertical title safe area percentage. |
safeword:setVerticalTitle (val) | Set the current vertical title safe area percentage. |
Functions
- safeword.new (init)
-
Instansiate a new instance of SafeWord.
Some Examples:
sw = safeword.new()
sw = safeword.new({
horizontalAction = 0.03,
verticalAction = 0.03,
})
sw = safeword.new{
horizontalAction = 0.03,
verticalAction = 0.03,
horizontalTitle = 0.07,
verticalTitle = 0.07,
}Parameters:
- init
Optional A table containing initial values for easy usage. Available
overrides:
horizontalAction
,horizontalTitle
,verticalAction
andverticalTitle
.
Returns:
-
Table returns the safeword class table.
- init
Optional A table containing initial values for easy usage. Available
overrides:
- safeword:draw ()
-
Main draw function
This is the main draw function that one would add to
love.draw
. - safeword:getModes ()
-
Get the available modes in SafeWord
Returns:
-
Table of strings with acronyms.
Example:
{OUYA = "OUYA SDK Example", XBOX = "XBOX Example" }
- safeword:setPreset (mode)
-
Set the current mode in SafeWord.
For maintainence reasons, please avoid using the string literal when using
this library. Indices will be maintained, but string literals are subject to
change.
Example:
sw = safeword.new()
local foomode = sw:getModes().OUYA
sw:setMode(foomode)Parameters:
- mode Optional the mode that you would like set.
- safeword:getActionX ()
- Get the calculated X coordinate of the action safe area.
- safeword:getActionY ()
- Get the calculated Y coordinate of the action safe area.
- safeword:getActionWidth ()
- Get the calculated width of the action safe area.
- safeword:getActionHeight ()
- Get the calculated height of the action safe area.
- safeword:getTitleX ()
- Get the calculated X coordinate of the title safe area.
- safeword:getTitleY ()
- Get the calculated Y coordinate of the title safe area.
- safeword:getTitleWidth ()
- Get the calculated width of the title safe area.
- safeword:getTitleHeight ()
- Get the calculated height of the title safe area.
- safeword:getHorizontalAction ()
-
Get the currently set horizontal action safe area percentage.
Returns:
-
Float The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:setHorizontalAction (val)
-
Set the current horizontal action safe area percentage.
Parameters:
- val The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:getHorizontalTitle ()
-
Get the currently set horizontal title safe area percentage.
Returns:
-
Float The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:setHorizontalTitle (val)
-
Set the current horizontal title safe area percentage.
Parameters:
- val The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:getVerticalAction ()
-
Get the currently set vertical action safe area percentage.
Returns:
-
Float The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:setVerticalAction (val)
-
Set the current vertical action safe area percentage.
Parameters:
- val The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:getVerticalTitle ()
-
Get the currently set vertical title safe area percentage.
Returns:
-
Float The percent represented mathematically (e.g. 0.01 is 1%)
- safeword:setVerticalTitle (val)
-
Set the current vertical title safe area percentage.
Parameters:
- val The percent represented mathematically (e.g. 0.01 is 1%)