Type Function Library display.* Return value various Revision 2017.3060 Keywords defaults, get default, color, graphics, vector objects See also display.setDefault()
Get default display values including default colors for display objects, anchor point defaults, texture wrapping settings, etc.
display.getDefault( key )
String. Specifies the key to get the default value for.
These keys indicate default anchor values and anchor bounds for all display objects.
"anchorX"
— The default anchor alignment along the x direction. Values range between 0
and 1
.
"anchorY"
— The default anchor alignment along the y direction. Values range between 0
and 1
.
A color key indicates which default color value is set.
"background"
— The default color for that the screen is cleared with. Returns multiple values (see example below).
"fillColor"
— The default fill color for vector objects like display.newRect(). Returns multiple values (see example below).
"strokeColor"
— The default stroke color for vector objects like display.newRect(). Returns multiple values (see example below).
"lineColor"
— The default color for line objects like display.newLine(). Returns multiple values (see example below).
"isNativeTextBoxFontSizeScaled"
— The default Boolean value to be assigned to a native text box's object.isFontSizeScaled property when created via the native.newTextBox() function. This is true
by default.
"isNativeTextFieldFontSizeScaled"
— The default Boolean value to be assigned to a native text field's object.isFontSizeScaled property when created via the native.newTextField() function. This is true
by default.
"magTextureFilter"
— The default magnification sampling filter applied whenever an image is loaded by Corona. Values include "linear"
or "nearest"
.
"minTextureFilter"
— The default minification sampling filter applied whenever an image is loaded by Corona. Values include "linear"
or "nearest"
.
"textureWrapX"
— The texture wrap mode along the x direction. Values include "clampToEdge"
, "repeat"
, or "mirroredRepeat"
.
"textureWrapY"
— The texture wrap mode along the y direction. Values include "clampToEdge"
, "repeat"
, or "mirroredRepeat"
.
-- Fill color default values local defaultR, defaultG, defaultB, defaultA = display.getDefault( "fillColor" ) print( defaultR, defaultG, defaultB, defaultA ) -- Default "anchorX" value local defaultAnchorX = display.getDefault( "anchorX" ) print( defaultAnchorX ) -- Default "anchorY" value local defaultAnchorY = display.getDefault( "anchorY" ) print( defaultAnchorY )