public abstract class BaseDisplayObject extends java.lang.Object implements DisplayObject
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ATT_ALPHA |
protected static java.lang.String |
ATT_ANIMATOR |
protected static java.lang.String |
ATT_BLEND_MODE |
protected static java.lang.String |
ATT_COLOR |
protected static java.lang.String |
ATT_DEBUG |
protected static java.lang.String |
ATT_ORIGIN_AT_CENTER |
protected static java.lang.String |
ATT_ROTATION |
protected static java.lang.String |
ATT_VISIBLE |
protected boolean |
mAlive |
protected float |
mAlpha |
protected boolean |
mAlphaTestEnabled |
protected boolean |
mAutoUpdateBounds |
protected BlendFunc |
mBlendFunc |
protected RectF |
mBounds |
protected boolean |
mBypassCameraClipping |
protected GLColor |
mColor |
protected int |
mDebugFlags |
protected float |
mFrameDuration |
protected boolean |
mHasTransformValues |
protected java.lang.String |
mId |
protected int |
mInvalidateFlags |
protected java.util.ArrayList<Manipulator> |
mManipulators |
protected Maskable |
mMask |
protected Matrix |
mMatrix |
protected int |
mNumManipulators |
protected PointF |
mOrigin |
protected Container |
mParent |
protected boolean |
mPerspectiveEnabled |
protected PointF |
mPivot |
protected PointF |
mPosition |
protected float |
mRotation |
protected float |
mRotationVectorX |
protected float |
mRotationVectorY |
protected float |
mRotationVectorZ |
protected PointF |
mScale |
protected Scene |
mScene |
protected PointF |
mSceneSize |
protected PointF |
mSize |
protected PointF |
mSkew |
protected Matrix |
mTransformMatrix |
protected float[] |
mTransformMatrixValues |
protected UIConstraint |
mUIConstraint |
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 |
---|
BaseDisplayObject() |
Modifier and Type | Method and Description |
---|---|
boolean |
addManipulator(Manipulator manipulator) |
void |
dispose() |
boolean |
draw(GLState glState) |
protected void |
drawBounds(GLState glState) |
protected abstract boolean |
drawChildren(GLState glState) |
protected void |
drawEnd(GLState glState) |
protected void |
drawStart(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) |
Maskable |
getMask() |
Matrix |
getMatrix() |
int |
getNumManipulators() |
java.lang.String |
getObjectTree(java.lang.String prefix)
for debugging
|
PointF |
getOrigin() |
Parentable |
getParent() |
protected Matrix |
getParentMatrix() |
PointF |
getPivot() |
PointF |
getPosition() |
float |
getRotation() |
PointF |
getScale() |
Scene |
getScene() |
protected PointF |
getSceneSize()
This is used for 3D projection
|
PointF |
getSize() |
PointF |
getSkew() |
UIConstraint |
getUIConstraint() |
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 |
isAlphaTestEnabled() |
boolean |
isAutoUpdateBounds() |
boolean |
isBypassCameraClipping() |
boolean |
isOriginAtCenter() |
boolean |
isPerspectiveEnabled() |
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(Container container)
This is called after this object is added to a Container
|
void |
onAddedToScene(Scene scene) |
void |
onCreateChildren(UIManager manager) |
protected void |
onPreConcatParentMatrix() |
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) |
void |
rotate(float degreeDelta) |
void |
setAlive(boolean value)
Toggles the heart-beat.
|
void |
setAlpha(float alpha) |
void |
setAlphaTestEnabled(boolean alphaTestEnabled)
Enable Alpha Test.
|
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 |
setMask(Maskable mask) |
void |
setOrigin(float x,
float y) |
void |
setOrigin(PointF origin) |
void |
setOriginAtCenter() |
void |
setPerspectiveEnabled(boolean perspectiveEnabled) |
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 |
setRotationVector(float x,
float y,
float z) |
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 |
setUIConstraint(UIConstraint uiConstraint) |
void |
setVisible(boolean value) |
void |
setX(float x) |
void |
setXMLAttributes(XmlPullParser xmlParser,
UIManager manager) |
void |
setY(float y) |
void |
setZ(float z)
Set the Z-depth
|
boolean |
shouldDraw(RectF globalViewRect) |
java.lang.String |
toString() |
boolean |
update(int deltaTime) |
RectF |
updateBounds()
Find the global bounds of this object that takes position, scale, rotation, skew...
|
protected void |
updateChildren(int deltaTime) |
protected void |
validate(int flags) |
public static final java.lang.String TAG
protected static final java.lang.String ATT_COLOR
protected static final java.lang.String ATT_ALPHA
protected static final java.lang.String ATT_BLEND_MODE
protected static final java.lang.String ATT_ORIGIN_AT_CENTER
protected static final java.lang.String ATT_ROTATION
protected static final java.lang.String ATT_VISIBLE
protected static final java.lang.String ATT_ANIMATOR
protected static final java.lang.String ATT_DEBUG
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 mRotationVectorX
protected float mRotationVectorY
protected float mRotationVectorZ
protected float mZ
protected PointF mSkew
protected Matrix mTransformMatrix
protected float[] mTransformMatrixValues
protected boolean mHasTransformValues
protected boolean mVisible
protected boolean mAlive
protected float mFrameDuration
protected Container mParent
protected Scene mScene
protected Maskable mMask
protected GLColor mColor
protected float mAlpha
protected BlendFunc mBlendFunc
protected boolean mAlphaTestEnabled
protected java.util.ArrayList<Manipulator> mManipulators
protected int mNumManipulators
protected int mInvalidateFlags
protected Matrix mMatrix
protected boolean mAutoUpdateBounds
protected RectF mBounds
protected boolean mBypassCameraClipping
protected boolean mPerspectiveEnabled
protected PointF mSceneSize
protected UIConstraint mUIConstraint
protected abstract boolean drawChildren(GLState glState)
protected PointF getSceneSize()
setPerspectiveEnabled(boolean)
public boolean draw(GLState glState)
draw
in interface DisplayObject
protected void drawStart(GLState glState)
protected void drawEnd(GLState glState)
protected void drawWireframe(GLState glState)
protected void drawBounds(GLState glState)
public boolean update(int deltaTime)
update
in interface Displayable
protected void updateChildren(int deltaTime)
public final void invalidate()
invalidate
in interface Displayable
public void invalidate(int flags)
invalidate
in interface Displayable
protected final void validate(int flags)
public void setAlive(boolean value)
setAlive
in interface Displayable
com.funzio.pure2D.IDisplayObject#setAlive(boolean)
,
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 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 setRotationVector(float x, float y, float z)
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 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 BlendFunc getBlendFunc()
getBlendFunc
in interface Displayable
public void setBlendFunc(BlendFunc blendFunc)
setBlendFunc
in interface Displayable
blendFunc
- the blendFunc to setpublic final boolean isAlphaTestEnabled()
public void setAlphaTestEnabled(boolean alphaTestEnabled)
alphaTestEnabled
- setZ(float)
public final Maskable getMask()
public void setMask(Maskable mask)
public final Scene getScene()
getScene
in interface Displayable
public 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
- public PointF getGlobalPosition()
public RectF updateBounds()
updateBounds
in interface Displayable
protected void onPreConcatParentMatrix()
public final Matrix getMatrix()
protected Matrix getParentMatrix()
public final RectF getBounds()
getBounds
in interface Displayable
getBounds
in interface Manipulatable
public boolean isBypassCameraClipping()
public void setBypassCameraClipping(boolean ignoreCameraClipping)
public final boolean isAutoUpdateBounds()
isAutoUpdateBounds
in interface Displayable
public void setAutoUpdateBounds(boolean autoUpdateBounds)
setAutoUpdateBounds
in interface Displayable
autoUpdateBounds
- the autoUpdateBounds to setpublic boolean isPerspectiveEnabled()
isPerspectiveEnabled
in interface DisplayObject
public void setPerspectiveEnabled(boolean perspectiveEnabled)
setPerspectiveEnabled
in interface DisplayObject
Scene#setDepthRange(float, float)}, {@link #getSceneSize()}
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 void onAdded(Container container)
onAdded
in interface DisplayObject
public void onRemoved()
onRemoved
in interface Displayable
public void onAddedToScene(Scene scene)
onAddedToScene
in interface Displayable
public void onRemovedFromScene()
onRemovedFromScene
in interface Displayable
public java.lang.String toString()
toString
in class java.lang.Object
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 void setXMLAttributes(XmlPullParser xmlParser, UIManager manager)
setXMLAttributes
in interface DisplayObject
public void onCreateChildren(UIManager manager)
onCreateChildren
in interface DisplayObject
public UIConstraint getUIConstraint()
public void setUIConstraint(UIConstraint uiConstraint)