public class UiContainer extends UiElement implements com.badlogic.gdx.InputProcessor
update(float)
,
interpolate(float)
and render(Graphics)
must be called by
your GameContainer
effects, styleId, visibility, zIndex
Constructor and Description |
---|
UiContainer(GameContainer gc,
com.badlogic.gdx.assets.AssetManager assetManager)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Container container)
Adds a
Container to this UiContainer |
void |
addScreenSizeListener(ScreenSizeListener listener)
Adds a
ScreenSizeListener to listen for ScreenSize change |
void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
void |
clearActiveNavigation()
Clears the current
Navigatable being navigated |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
int |
getHeight()
Returns the height of the
UiContainer |
InputSource |
getLastInputSource()
Returns the last
InputSource the UiContainer detected |
UiTheme |
getTheme()
Returns the
UiTheme currently applied to this UiContainer |
int |
getWidth()
Returns the width of the
UiContainer |
void |
interpolate(float alpha)
Interpolates all
UiElement s |
boolean |
isThemeApplied()
Returns if a
UiTheme has been applied to thi UiContainer |
boolean |
keyDown(int keycode) |
boolean |
keyTyped(char character) |
boolean |
keyUp(int keycode) |
boolean |
mouseMoved(int screenX,
int screenY) |
void |
remove(Container container)
Removes a
Container from this UiContainer |
void |
removeScreenSizeListener(ScreenSizeListener listener)
Removes a
ScreenSizeListener from this UiContainer |
void |
render(Graphics g)
Renders all visible
UiElement s |
boolean |
scrolled(int amount) |
void |
set(int width,
int height)
Sets the width and height of the
UiContainer |
void |
setActiveNavigation(Navigatable activeNavigation)
Sets the current
Navigatable for UI navigation |
void |
setScale(float scaleX,
float scaleY)
Sets the
Graphics scaling during rendering. |
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setTheme(UiTheme theme)
Sets the current
UiTheme for this UiContainer |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithRenderNode()
Syncs data between the
UiElement and RenderNode |
boolean |
touchDown(int screenX,
int screenY,
int pointer,
int button) |
boolean |
touchDragged(int screenX,
int screenY,
int pointer) |
boolean |
touchUp(int screenX,
int screenY,
int pointer,
int button) |
void |
update(float delta)
Updates all
UiElement s |
addEffectListener, addHoverListener, applyEffect, equals, getElementById, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeEffectListener, removeHoverListener, setDebugEnabled
public UiContainer(GameContainer gc, com.badlogic.gdx.assets.AssetManager assetManager)
gc
- Your game's GameContainer
assetManager
- The AssetManager
for the gamepublic void update(float delta)
UiElement
sdelta
- The time since the last frame (in seconds)public void interpolate(float alpha)
UiElement
salpha
- The interpolation alphapublic void render(Graphics g)
UiElement
sg
- The Graphics
contextpublic void add(Container container)
Container
to this UiContainer
container
- The Container
to addpublic void remove(Container container)
Container
from this UiContainer
container
- The Container
to removepublic void attach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
for this element to a parent
RenderNode
attach
in class UiElement
parentRenderNode
- The parent RenderNode
to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
from a parent
RenderNode
detach
in class UiElement
parentRenderNode
- The parent RenderNode
to detach frompublic void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class UiElement
visibility
- The Visibility
to setpublic void syncWithRenderNode()
UiElement
UiElement
and RenderNode
syncWithRenderNode
in class UiElement
public void addScreenSizeListener(ScreenSizeListener listener)
ScreenSizeListener
to listen for ScreenSize
changelistener
- The ScreenSizeListener
to addpublic void removeScreenSizeListener(ScreenSizeListener listener)
ScreenSizeListener
from this UiContainer
listener
- The ScreenSizeListener
to removepublic boolean isThemeApplied()
UiTheme
has been applied to thi UiContainer
UiTheme
has been appliedpublic UiTheme getTheme()
UiTheme
currently applied to this UiContainer
UiTheme
has been appliedpublic void setTheme(UiTheme theme)
UiTheme
for this UiContainer
theme
- The UiTheme
to applypublic void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class UiElement
styleId
- The style id to setpublic boolean touchDown(int screenX, int screenY, int pointer, int button)
touchDown
in interface com.badlogic.gdx.InputProcessor
public boolean touchUp(int screenX, int screenY, int pointer, int button)
touchUp
in interface com.badlogic.gdx.InputProcessor
public boolean touchDragged(int screenX, int screenY, int pointer)
touchDragged
in interface com.badlogic.gdx.InputProcessor
public boolean mouseMoved(int screenX, int screenY)
mouseMoved
in interface com.badlogic.gdx.InputProcessor
public boolean scrolled(int amount)
scrolled
in interface com.badlogic.gdx.InputProcessor
public boolean keyTyped(char character)
keyTyped
in interface com.badlogic.gdx.InputProcessor
public boolean keyDown(int keycode)
keyDown
in interface com.badlogic.gdx.InputProcessor
public boolean keyUp(int keycode)
keyUp
in interface com.badlogic.gdx.InputProcessor
public void setActiveNavigation(Navigatable activeNavigation)
Navigatable
for UI navigationactiveNavigation
- The current Navigatable
being navigatedpublic void clearActiveNavigation()
Navigatable
being navigatedpublic int getWidth()
UiContainer
public int getHeight()
UiContainer
public void set(int width, int height)
UiContainer
width
- The width in pixelsheight
- The height in pixelspublic void setScale(float scaleX, float scaleY)
Graphics
scaling during rendering. Mouse/touch
coordinates will be scaled accordingly.scaleX
- Scaling along the X axisscaleY
- Scaling along the Y axispublic InputSource getLastInputSource()
InputSource
the UiContainer
detected