Package com.nevergarden.myna.display
Class Stage
- java.lang.Object
-
- com.nevergarden.myna.events.EventDispatcher
-
- com.nevergarden.myna.display.DisplayObject
-
- com.nevergarden.myna.display.DisplayObjectContainer
-
- com.nevergarden.myna.display.Stage
-
- All Implemented Interfaces:
Drawable
public class Stage extends DisplayObjectContainer
Root of the display tree. Display objects added to stage can only be rendered, every Myna instance has one Stage connected to it which can be replaced by another stage on demand.
-
-
Field Summary
-
Fields inherited from class com.nevergarden.myna.display.DisplayObjectContainer
children
-
Fields inherited from class com.nevergarden.myna.display.DisplayObject
parent, pivot, position, rotation, scale, transform
-
Fields inherited from class com.nevergarden.myna.events.EventDispatcher
eventListeners
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAll()
Traverse the tree for every drawable to create render tree.void
drawAll()
Called by renderer to draw all the drawables in this stage.Color
getColor()
Gets current background color.boolean
getRequiresRedraw()
A method that indicates if the hierarchy has changed or not so the frame should be redrawn.View
getView()
Gets current view of the stage.protected void
recalculateMatrix()
Recalculates the matrix with it's current transformations.void
resizeAll()
Resizes every object in the hierarchy to fit the new stage size.void
setColor(Color color)
Sets Background Colorvoid
setHeight(int newHeight)
Sets height of stage.void
setRequiresRedraw(boolean requiresRedraw)
Forces a redraw if true is set.void
setSize(int newWidth, int newHeight)
Sets size of stagevoid
setView(View view)
Sets a new View for this stage.void
setWidth(int newWidth)
Sets width of stage.-
Methods inherited from class com.nevergarden.myna.display.DisplayObjectContainer
addChild, addChildAt, contains, getChildAt, getChildIndex, getChildren, getChildrenCount, getParent, removeChild, removeChildAt, removeChildren, setParent, swapChildren, swapChildrenAt
-
Methods inherited from class com.nevergarden.myna.display.DisplayObject
draw, getPosition, removeFromParent, rotate, setLocalX, setLocalY, setPivot, setPivotX, setPivotY, setPosition, setRotation, setScale, setScaleX, setScaleY
-
Methods inherited from class com.nevergarden.myna.events.EventDispatcher
addEventListener, dispatchEvent, dispatchEventWith, dispatchEventWith, dispose, hasEventListener, invokeEvent, removeEventListener, removeEventListeners
-
-
-
-
Method Detail
-
getRequiresRedraw
public boolean getRequiresRedraw()
A method that indicates if the hierarchy has changed or not so the frame should be redrawn.
-
setRequiresRedraw
public void setRequiresRedraw(boolean requiresRedraw)
Forces a redraw if true is set.
-
resizeAll
public void resizeAll()
Resizes every object in the hierarchy to fit the new stage size.
-
addAll
public void addAll()
Traverse the tree for every drawable to create render tree.
-
drawAll
public void drawAll()
Called by renderer to draw all the drawables in this stage.
-
getColor
public Color getColor()
Gets current background color.- Returns:
- Current Background Color
-
setColor
public void setColor(Color color)
Sets Background Color- Parameters:
color
- color to set
-
setWidth
public void setWidth(int newWidth)
Sets width of stage.
-
setHeight
public void setHeight(int newHeight)
Sets height of stage.
-
setSize
public void setSize(int newWidth, int newHeight)
Sets size of stage- Parameters:
newWidth
- widthnewHeight
- height
-
getView
public View getView()
Gets current view of the stage.- Returns:
- View current view
-
setView
public void setView(View view)
Sets a new View for this stage.- Parameters:
view
- new view
-
recalculateMatrix
protected void recalculateMatrix()
Description copied from class:DisplayObject
Recalculates the matrix with it's current transformations.- Overrides:
recalculateMatrix
in classDisplayObject
-
-