public abstract class UniObject extends java.lang.Object implements StackableObject, InvalidateFlags
Modifier and Type | Field and Description |
---|---|
protected boolean |
mAlive |
protected float |
mAlpha |
protected boolean |
mAutoUpdateBounds |
protected GLColor |
mBlendColor |
protected BlendFunc |
mBlendFunc |
protected RectF |
mBounds |
protected boolean |
mBypassCameraClipping |
protected GLColor |
mColor |
protected int |
mDebugFlags |
protected float |
mFrameDuration |
protected PointF |
mGlobalPosition |
protected boolean |
mHasOrigin |
protected java.lang.String |
mId |
protected int |
mInvalidateFlags |
protected java.util.ArrayList<Manipulator> |
mManipulators |
protected Matrix |
mMatrix |
protected Matrix |
mMatrixForVertices |
protected int |
mNumManipulators |
protected PointF |
mOrigin |
protected boolean |
mOriginAtCenter |
protected UniContainer |
mParent |
protected PointF |
mPivot |
protected PointF |
mPosition |
protected float |
mRotation |
protected PointF |
mScale |
protected Scene |
mScene |
protected PointF |
mSize |
protected PointF |
mSkew |
protected boolean |
mStackable |
protected float[] |
mVertices |
protected boolean |
mVisible |
protected float |
mZ |
static java.lang.String |
TAG |
FLIP_X, FLIP_Y
ALL, ALPHA, BLEND, BOUNDS, CACHE, CHILDREN, COLOR, DEPTH, FRAME, ORIGIN, PARENT, PARENT_BOUNDS, PERSPECTIVE, PIVOT, POSITION, ROTATION, SCALE, SIZE, SKEW, TEXTURE, TEXTURE_COORDS, TRANSFORM_MATRIX, VERTICES, VISIBILITY, VISUAL
Constructor and Description |
---|
UniObject() |
Modifier and Type | Method and Description |
---|---|
boolean |
addManipulator(Manipulator manipulator) |
void |
dispose() |
protected void |
drawBounds(GLState glState) |
protected void |
drawWireframe(GLState glState) |
float |
getAlpha() |
BlendFunc |
getBlendFunc() |
RectF |
getBounds()
Get the Global Bounds of this object that takes translation, rotation and scale factors into account.
|
GLColor |
getColor() |
int |
getDebugFlags() |
int |
getFps() |
PointF |
getGlobalPosition()
Get global position of this object
|
float |
getHeight() |
java.lang.String |
getId()
for ui
|
BlendFunc |
getInheritedBlendFunc() |
GLColor |
getInheritedColor() |
Manipulator |
getManipulator(int index) |
Matrix |
getMatrix() |
int |
getNumManipulators() |
int |
getNumStackedChildren() |
java.lang.String |
getObjectTree(java.lang.String prefix)
for debugging
|
PointF |
getOrigin() |
Parentable |
getParent() |
PointF |
getPivot() |
PointF |
getPosition() |
float |
getRotation() |
PointF |
getScale() |
Scene |
getScene() |
PointF |
getSize() |
PointF |
getSkew() |
float |
getWidth() |
float |
getX() |
float |
getY() |
float |
getZ() |
void |
globalToLocal(PointF global,
PointF result)
Converts a global point to a local point, without allocating new PointF
|
void |
invalidate() |
void |
invalidate(int flags) |
boolean |
isAlive() |
boolean |
isAutoUpdateBounds() |
boolean |
isBypassCameraClipping() |
boolean |
isOriginAtCenter() |
boolean |
isStackable() |
boolean |
isVisible() |
void |
localToGlobal(PointF local,
PointF result)
Converts a local point to a global point, without allocating new PointF
|
void |
move(float dx,
float dy) |
void |
moveTo(float x,
float y) |
void |
onAdded(UniContainer container)
This is called after this object is added to a Container
|
void |
onAddedToScene(Scene scene) |
void |
onRemoved()
This is called after this object is removed from a Container
|
void |
onRemovedFromScene() |
boolean |
queueEvent(java.lang.Runnable r) |
int |
removeAllManipulators() |
boolean |
removeFromParent() |
boolean |
removeManipulator(Manipulator manipulator) |
protected abstract void |
resetVertices() |
void |
rotate(float degreeDelta) |
void |
setAlive(boolean value)
Toggles the heart-beat.
|
void |
setAlpha(float alpha) |
void |
setAutoUpdateBounds(boolean autoUpdateBounds)
This needs to be set to true if using Camera clipping.
|
void |
setBlendFunc(BlendFunc blendFunc) |
void |
setBypassCameraClipping(boolean ignoreCameraClipping) |
void |
setColor(GLColor color) |
void |
setDebugFlags(int flags) |
void |
setFps(int fps) |
void |
setId(java.lang.String id) |
void |
setOrigin(float x,
float y) |
void |
setOrigin(PointF origin) |
void |
setOriginAtCenter() |
void |
setPivot(float x,
float y) |
void |
setPivot(PointF pivot) |
void |
setPivotAtCenter() |
void |
setPosition(float x,
float y) |
void |
setPosition(PointF position) |
void |
setRotation(float degree) |
void |
setScale(float scale) |
void |
setScale(float sx,
float sy) |
void |
setSize(float w,
float h) |
void |
setSize(PointF size) |
void |
setSkew(float kx,
float ky) |
void |
setStackable(boolean value) |
void |
setVisible(boolean value) |
void |
setX(float x) |
void |
setY(float y) |
void |
setZ(float z)
Set the Z-depth
|
boolean |
shouldDraw(RectF globalViewRect) |
boolean |
update(int deltaTime) |
RectF |
updateBounds() |
protected void |
updateMatrix()
Find the global bounds of this object that takes position, scale, rotation, skew...
|
protected void |
validate(int flags) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
stack
public static final java.lang.String TAG
protected int mDebugFlags
protected java.lang.String mId
protected PointF mPosition
protected PointF mOrigin
protected PointF mSize
protected PointF mScale
protected PointF mPivot
protected float mRotation
protected float mZ
protected PointF mSkew
protected boolean mAlive
protected boolean mVisible
protected float mFrameDuration
protected UniContainer mParent
protected Scene mScene
protected GLColor mColor
protected GLColor mBlendColor
protected BlendFunc mBlendFunc
protected float mAlpha
protected boolean mHasOrigin
protected boolean mOriginAtCenter
protected java.util.ArrayList<Manipulator> mManipulators
protected int mNumManipulators
protected int mInvalidateFlags
protected Matrix mMatrix
protected Matrix mMatrixForVertices
protected RectF mBounds
protected boolean mAutoUpdateBounds
protected boolean mBypassCameraClipping
protected PointF mGlobalPosition
protected float[] mVertices
protected boolean mStackable
protected abstract void resetVertices()
protected void drawWireframe(GLState glState)
protected void drawBounds(GLState glState)
public boolean update(int deltaTime)
update
in interface Displayable
public final void invalidate()
invalidate
in interface Displayable
public final void invalidate(int flags)
invalidate
in interface Displayable
protected final void validate(int flags)
public void setAlive(boolean value)
setAlive
in interface Displayable
update(int)
public final boolean isAlive()
isAlive
in interface Displayable
public void setVisible(boolean value)
setVisible
in interface Displayable
public final boolean isVisible()
isVisible
in interface Displayable
public boolean shouldDraw(RectF globalViewRect)
shouldDraw
in interface Displayable
public void setStackable(boolean value)
setStackable
in interface StackableObject
public boolean isStackable()
isStackable
in interface StackableObject
public final PointF getPosition()
getPosition
in interface Manipulatable
public final void setPosition(PointF position)
setPosition
in interface Manipulatable
position
- the position to setpublic void setPosition(float x, float y)
setPosition
in interface Manipulatable
position
- the position to setpublic void setX(float x)
setX
in interface Manipulatable
public final float getX()
getX
in interface Manipulatable
public void setY(float y)
setY
in interface Manipulatable
public final float getY()
getY
in interface Manipulatable
public void setZ(float z)
setZ
in interface Displayable
#setAlphaTestEnabled(boolean)
public final float getZ()
getZ
in interface Displayable
public void moveTo(float x, float y)
moveTo
in interface Manipulatable
public void move(float dx, float dy)
move
in interface Manipulatable
public final PointF getOrigin()
getOrigin
in interface Displayable
public final void setOrigin(PointF origin)
setOrigin
in interface Displayable
origin
- the origin to set. Origin is the local point and (0,0) by default. Origin is used to define offset of this object and also the center of rotation and scaling.public void setOrigin(float x, float y)
setOrigin
in interface Displayable
public void setOriginAtCenter()
setOriginAtCenter
in interface Displayable
public boolean isOriginAtCenter()
public PointF getPivot()
getPivot
in interface Displayable
public void setPivot(PointF pivot)
setPivot
in interface Displayable
public void setPivot(float x, float y)
setPivot
in interface Displayable
public void setPivotAtCenter()
setPivotAtCenter
in interface Displayable
public final PointF getSize()
getSize
in interface Manipulatable
public final float getWidth()
getWidth
in interface Manipulatable
public final float getHeight()
getHeight
in interface Manipulatable
public final void setSize(PointF size)
setSize
in interface Manipulatable
size
- the size to setpublic void setSize(float w, float h)
setSize
in interface Manipulatable
size
- the size to setpublic void setScale(float sx, float sy)
setScale
in interface Manipulatable
screen_scale
- the scale to setpublic void setScale(float scale)
setScale
in interface Manipulatable
scale
- the scale to setpublic final PointF getScale()
getScale
in interface Manipulatable
public void setRotation(float degree)
setRotation
in interface Manipulatable
public void rotate(float degreeDelta)
rotate
in interface Manipulatable
public final float getRotation()
getRotation
in interface Manipulatable
public void setSkew(float kx, float ky)
setSkew
in interface Displayable
public PointF getSkew()
getSkew
in interface Displayable
public final GLColor getColor()
getColor
in interface Displayable
public void setColor(GLColor color)
setColor
in interface Displayable
color
- the color to setpublic BlendFunc getBlendFunc()
getBlendFunc
in interface Displayable
public void setBlendFunc(BlendFunc blendFunc)
setBlendFunc
in interface Displayable
blendFunc
- the blendFunc to setpublic final GLColor getInheritedColor()
getInheritedColor
in interface Displayable
public final BlendFunc getInheritedBlendFunc()
getInheritedBlendFunc
in interface Displayable
public final float getAlpha()
getAlpha
in interface Displayable
public void setAlpha(float alpha)
setAlpha
in interface Displayable
alpha
- the alpha to setpublic final int getFps()
getFps
in interface Displayable
public void setFps(int fps)
setFps
in interface Displayable
fps
- the fps to setpublic boolean addManipulator(Manipulator manipulator)
addManipulator
in interface Displayable
public boolean removeManipulator(Manipulator manipulator)
removeManipulator
in interface Displayable
public int removeAllManipulators()
removeAllManipulators
in interface Displayable
public Manipulator getManipulator(int index)
getManipulator
in interface Displayable
public int getNumManipulators()
getNumManipulators
in interface Displayable
public final Parentable getParent()
getParent
in interface Displayable
public final boolean queueEvent(java.lang.Runnable r)
queueEvent
in interface Displayable
public boolean removeFromParent()
removeFromParent
in interface Displayable
public final void localToGlobal(PointF local, PointF result)
localToGlobal
in interface Displayable
local
- result
- public final void globalToLocal(PointF global, PointF result)
globalToLocal
in interface Displayable
global
- result
- protected void updateMatrix()
public PointF getGlobalPosition()
public RectF updateBounds()
updateBounds
in interface Displayable
public final Matrix getMatrix()
public final RectF getBounds()
getBounds
in interface Displayable
getBounds
in interface Manipulatable
public final boolean isAutoUpdateBounds()
isAutoUpdateBounds
in interface Displayable
public boolean isBypassCameraClipping()
public void setBypassCameraClipping(boolean ignoreCameraClipping)
public void setAutoUpdateBounds(boolean autoUpdateBounds)
setAutoUpdateBounds
in interface Displayable
autoUpdateBounds
- the autoUpdateBounds to setpublic int getNumStackedChildren()
getNumStackedChildren
in interface StackableObject
public void dispose()
dispose
in interface Displayable
public int getDebugFlags()
Pure2D.DEBUG_FLAG_LOCAL_SHAPE, Pure2D.DEBUG_FLAG_GLOBAL_BOUNDS
public void setDebugFlags(int flags)
flags
- Pure2D.DEBUG_FLAG_SHAPE, Pure2D.DEBUG_FLAG_BOUNDS
public java.lang.String getObjectTree(java.lang.String prefix)
getObjectTree
in interface Displayable
public java.lang.String getId()
getId
in interface Displayable
public void setId(java.lang.String id)
setId
in interface Displayable
public Scene getScene()
getScene
in interface Displayable
public void onAdded(UniContainer container)
onAdded
in interface StackableObject
public void onRemoved()
onRemoved
in interface Displayable
public void onAddedToScene(Scene scene)
onAddedToScene
in interface Displayable
public void onRemovedFromScene()
onRemovedFromScene
in interface Displayable