Package tripleplay.ui.bgs
Class Scale9Background
java.lang.Object
tripleplay.ui.Background
tripleplay.ui.bgs.Scale9Background
A background constructed by scaling the parts of a source image to fit the target width and
height. Uses
Scale9
.-
Nested Class Summary
Nested classes/interfaces inherited from class tripleplay.ui.Background
Background.Instance
-
Field Summary
Fields inherited from class tripleplay.ui.Background
alpha, BACKGROUND_DEPTH, insets
-
Constructor Summary
ConstructorDescriptionScale9Background
(Tile tile) Creates a new background using the given texture. -
Method Summary
Modifier and TypeMethodDescriptioncorners
(float size) Sets all edges of the source axes to the given value.destScale
(float scale) Sets an overall destination scale for the background.scale9()
Returns the scale 9 instance for mutation.void
setRepeatAlignment
(Style.HAlign horizontalAlignment) Defines how the repeated parts are aligned horizontally when the repeatMode is turned on.void
setRepeatAlignment
(Style.VAlign verticalAlignment) Defines how the repeated parts are aligned vertically when the repeatMode is turned on.void
setRepeatMode
(boolean repeat) Controls wether the the extended parts are scaled or repeated.setTint
(int tint) Sets the tint for this background, asARGB
.xborder
(float xborder) Sets the width of the left and right edges of the source axes to the given value.yborder
(float yborder) Sets the height of the top and bottom edges of the source axes to the given value.
-
Constructor Details
-
Scale9Background
Creates a new background using the given texture. The texture is assumed to be divided into aa 3x3 grid of 9 equal pieces.
-
-
Method Details
-
scale9
Returns the scale 9 instance for mutation. Be sure to finish mutation prior to binding. -
xborder
Sets the width of the left and right edges of the source axes to the given value. NOTE:xborder
may be zero, to indicate that the source image has no left or right pieces, i.e. just three total pieces: top, bottom and center. -
yborder
Sets the height of the top and bottom edges of the source axes to the given value. NOTE:yborder
may be zero, to indicate that the source image has no top or bottom pieces, i.e. just three pieces: left, right and center. -
corners
Sets all edges of the source axes to the given value. Equivalent of callingxborder(border).yborder(border)
. -
destScale
Sets an overall destination scale for the background. When instantiated, the target width and height are divided by this value, and when rendering the layer scale is multiplied by this value. This allows games to use high res images with smaller screen sizes. -
setRepeatMode
public void setRepeatMode(boolean repeat) Controls wether the the extended parts are scaled or repeated.- Parameters:
repeat
- Repeats the extended parts if true otherwise scales them.
-
setTint
Sets the tint for this background, asARGB
.NOTE: this will overwrite any value configured via
Background.alpha
. Either include your desired alpha in the high bits oftint
or setBackground.alpha
after calling this method.NOTE: the RGB components of a layer's tint only work on GL-based backends. It is not possible to tint layers using the HTML5 canvas and Flash backends.
-
setRepeatAlignment
Defines how the repeated parts are aligned horizontally when the repeatMode is turned on. By default the repeated parts are aligned to the left border and left corners respectively.- Parameters:
horizontalAlignment
- Only left or right alignment are supported.
-
setRepeatAlignment
Defines how the repeated parts are aligned vertically when the repeatMode is turned on. By default the repeated parts are aligned to the top border and top corners respectively.- Parameters:
verticalAlignment
- Only top or bottom alignment are supported.
-