public class UiContainer extends UiElement implements com.badlogic.gdx.InputProcessor
update(float),
interpolate(float) and render(Graphics) must be called by
your GameContainereffects, 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 |
addControllerInput(ControllerUiInput<?> input)
Adds a
ControllerUiInput instance 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 |
boolean |
buttonDown(ControllerUiInput<?> controllerUiInput,
ControllerButton button) |
boolean |
buttonUp(ControllerUiInput<?> controllerUiInput,
ControllerButton button) |
void |
clearActiveNavigation()
Clears the current
Navigatable being navigated |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
static Visibility |
getDefaultVisibility()
Returns the default
Visibility for newly created UiElement objects |
int |
getHeight()
Returns the height of the
UiContainer |
InputSource |
getLastInputSource()
Returns the last
InputSource used on the UiContainer |
UiTheme |
getTheme()
Returns the
UiTheme currently applied to this UiContainer |
int |
getWidth()
Returns the width of the
UiContainer |
void |
interpolate(float alpha)
Interpolates all
UiElements |
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 |
removeControllerInput(ControllerUiInput<?> input)
Removes a
ControllerUiInput instance from this
UiContainer |
void |
removeScreenSizeListener(ScreenSizeListener listener)
Removes a
ScreenSizeListener from this UiContainer |
void |
render(Graphics g)
Renders all visible
UiElements |
boolean |
scrolled(int amount) |
void |
set(int width,
int height)
Sets the width and height of the
UiContainer |
void |
setActionKey(int actionKey)
Sets the key used for triggering actions (i.e.
|
void |
setActiveNavigation(Navigatable activeNavigation)
Sets the current
Navigatable for UI navigation |
static void |
setDefaultVisibility(Visibility defaultVisibility)
Sets the default
Visibility for newly created UiElement objects |
void |
setKeyboardNavigationEnabled(boolean keyboardNavigationEnabled)
Sets if desktop-based games uses keyboard navigation instead of mouse
navigation.
|
void |
setLastInputSource(InputSource lastInputSource)
Sets the last
InputSource used on the UiContainer |
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
UiElements |
addEffectListener, addHoverListener, applyEffect, equals, getElementById, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeEffectListener, removeHoverListener, setDebugEnabledpublic UiContainer(GameContainer gc, com.badlogic.gdx.assets.AssetManager assetManager)
gc - Your game's GameContainerassetManager - The AssetManager for the gamepublic void update(float delta)
UiElementsdelta - The time since the last frame (in seconds)public void interpolate(float alpha)
UiElementsalpha - The interpolation alphapublic void render(Graphics g)
UiElementsg - The Graphics contextpublic void add(Container container)
Container to this UiContainercontainer - The Container to addpublic void remove(Container container)
Container from this UiContainercontainer - The Container to removepublic void attach(ParentRenderNode<?,?> parentRenderNode)
UiElementRenderNode for this element to a parent
RenderNodeattach in class UiElementparentRenderNode - The parent RenderNode to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElementRenderNode from a parent
RenderNodedetach in class UiElementparentRenderNode - The parent RenderNode to detach frompublic void setVisibility(Visibility visibility)
UiElementVisibility of this UiElementsetVisibility in class UiElementvisibility - The Visibility to setpublic void syncWithRenderNode()
UiElementUiElement and RenderNodesyncWithRenderNode in class UiElementpublic void addScreenSizeListener(ScreenSizeListener listener)
ScreenSizeListener to listen for ScreenSize changelistener - The ScreenSizeListener to addpublic void removeScreenSizeListener(ScreenSizeListener listener)
ScreenSizeListener from this UiContainerlistener - The ScreenSizeListener to removepublic boolean isThemeApplied()
UiTheme has been applied to thi UiContainerUiTheme has been appliedpublic UiTheme getTheme()
UiTheme currently applied to this UiContainerUiTheme has been appliedpublic void setTheme(UiTheme theme)
UiTheme for this UiContainertheme - The UiTheme to applypublic void setStyleId(java.lang.String styleId)
UiElementUiElementsetStyleId in class UiElementstyleId - The style id to setpublic boolean touchDown(int screenX,
int screenY,
int pointer,
int button)
touchDown in interface com.badlogic.gdx.InputProcessorpublic boolean touchUp(int screenX,
int screenY,
int pointer,
int button)
touchUp in interface com.badlogic.gdx.InputProcessorpublic boolean touchDragged(int screenX,
int screenY,
int pointer)
touchDragged in interface com.badlogic.gdx.InputProcessorpublic boolean mouseMoved(int screenX,
int screenY)
mouseMoved in interface com.badlogic.gdx.InputProcessorpublic boolean scrolled(int amount)
scrolled in interface com.badlogic.gdx.InputProcessorpublic boolean keyTyped(char character)
keyTyped in interface com.badlogic.gdx.InputProcessorpublic boolean keyDown(int keycode)
keyDown in interface com.badlogic.gdx.InputProcessorpublic boolean keyUp(int keycode)
keyUp in interface com.badlogic.gdx.InputProcessorpublic boolean buttonDown(ControllerUiInput<?> controllerUiInput, ControllerButton button)
public boolean buttonUp(ControllerUiInput<?> controllerUiInput, ControllerButton button)
public void setActiveNavigation(Navigatable activeNavigation)
Navigatable for UI navigationactiveNavigation - The current Navigatable being navigatedpublic void clearActiveNavigation()
Navigatable being navigatedpublic int getWidth()
UiContainerpublic int getHeight()
UiContainerpublic void set(int width,
int height)
UiContainerwidth - 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 used on the UiContainerpublic void setLastInputSource(InputSource lastInputSource)
InputSource used on the UiContainerlastInputSource - The InputSource last usedpublic void addControllerInput(ControllerUiInput<?> input)
ControllerUiInput instance to this UiContainerinput - The instance to addpublic void removeControllerInput(ControllerUiInput<?> input)
ControllerUiInput instance from this
UiContainerinput - The instance to removepublic void setZIndex(int zIndex)
UiElementUiElement. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)public void setActionKey(int actionKey)
actionKey - The Input.Keys valuepublic void setKeyboardNavigationEnabled(boolean keyboardNavigationEnabled)
keyboardNavigationEnabled - True if the desktop-based game should only navigate by keyboardpublic static Visibility getDefaultVisibility()
Visibility for newly created UiElement objectsVisibility value. Visibility.HIDDEN by defaultpublic static void setDefaultVisibility(Visibility defaultVisibility)
Visibility for newly created UiElement objectsdefaultVisibility - The Visibility to set as default