public class BaseScene extends java.lang.Object implements Scene
Scene.Listener| Modifier and Type | Field and Description |
|---|---|
protected int |
mBuffersToInvalidate |
protected Camera |
mCamera |
protected java.util.ArrayList<DisplayObject> |
mChildren |
protected java.util.HashMap<java.lang.String,DisplayObject> |
mChildrenIds |
protected boolean |
mClippingEnabled |
protected GLState |
mGLState |
protected Stage |
mStage |
protected TextureManager |
mTextureManager |
static java.lang.String |
TAG |
AXIS_BOTTOM_LEFT, AXIS_TOP_LEFT, DEFAULT_FPS, DEFAULT_MSPF, PROJECTION_PERSPECTIVE| Constructor and Description |
|---|
BaseScene() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addChild(DisplayObject child) |
boolean |
addChild(DisplayObject child,
int index) |
protected void |
clear() |
protected float |
convertY(float y,
float size)
Convert y based on the Axis system
|
java.lang.String |
countObjectsByType()
For Debugging.
|
protected void |
countObjectsByType(Container container,
java.util.Map<java.lang.String,java.lang.Integer> map) |
protected TextureManager |
createDefaultTextureManager() |
void |
dispose()
Dispose everything
|
int |
getAxisSystem() |
int |
getBuffersToInvalidate() |
Camera |
getCamera() |
RectF |
getCameraRect() |
DisplayObject |
getChildAt(int index) |
DisplayObject |
getChildById(java.lang.String id) |
int |
getChildIndex(DisplayObject child) |
GLColor |
getColor() |
int |
getCurrentFps() |
BlendFunc |
getDefaultBlendFunc() |
GLState |
getGLState() |
float |
getHeight() |
Matrix |
getMatrix()
Scene got no matrix
|
int |
getNumChildren()
Get the number of children, not including grand children
|
int |
getNumGrandChildren()
Get number of children including grand children
|
java.lang.String |
getObjectTree()
for Debugging.
|
int |
getPointerCount()
Note: only use this within onTouchEvent()
|
Scene |
getScene() |
PointF |
getSize() |
Stage |
getStage() |
int |
getTargetFps()
Deprecated.
|
TextureManager |
getTextureManager() |
PointF |
getTouchedPoint()
Note: only use this within onTouchEvent()
|
PointF |
getTouchedPoint(int pointerIndex)
Note: only use this within onTouchEvent()
|
float |
getWidth() |
PointF |
globalToLocal(PointF global)
Scene is the top level of the hierachy.
|
void |
globalToLocal(PointF global,
PointF result)
Converts a global point to a local point, without allocating new PointF
|
void |
globalToScreen(float globalX,
float globalY,
PointF result)
Get the Screen's coordinates from a global point relative to this scene
|
void |
globalToStage(float globalX,
float globalY,
PointF result)
Convert a Global Point to a Pixel Point on the Stage
|
void |
globalToStage(RectF globalRect,
RectF result)
Convert a Global Rectangle to a Pixel Rectangle on the Stage
|
void |
invalidate() |
void |
invalidate(int flags) |
void |
invalidateBuffers(int numBuffers) |
boolean |
isAutoClear() |
boolean |
isClippingEnabled() |
boolean |
isPaused() |
boolean |
isRenderContinueously() |
boolean |
isUIEnabled() |
void |
localToGlobal(PointF local,
PointF result)
Converts a local point to a global point, without allocating new PointF
|
void |
onDrawFrame(GL10 gl) |
void |
onSurfaceChanged(GL10 gl,
int width,
int height) |
void |
onSurfaceCreated(GL10 gl,
EGLConfig config) |
void |
onSurfacePaused() |
void |
onSurfaceResumed() |
boolean |
onTouchEvent(MotionEvent event)
Note: This is called from UI-Thread
|
void |
pause() |
boolean |
queueEvent(java.lang.Runnable r) |
boolean |
queueEvent(java.lang.Runnable r,
int delayMillis) |
void |
removeAllChildren() |
boolean |
removeChild(DisplayObject child) |
void |
resume() |
void |
screenToGlobal(float screenX,
float screenY,
PointF result)
Get the global coordinates from the Screen's coordinates
|
void |
screenToGlobal(PointF screen,
PointF result) |
void |
setAutoClear(boolean autoClear) |
void |
setAxisSystem(int value) |
void |
setBuffersToInvalidate(int buffersToInvalidate) |
void |
setCamera(Camera camera) |
void |
setClippingEnabled(boolean clippingEnabled) |
void |
setColor(GLColor color)
This needs to be called on GL Thread
|
void |
setDefaultBlendFunc(BlendFunc defaultBlendFunc)
Set the default Blending function for all child objects
|
void |
setDepthRange(float zNear,
float zFar) |
void |
setListener(Scene.Listener listener) |
void |
setRenderContinueously(boolean renderContinueously) |
void |
setStage(Stage stage) |
void |
setTargetFps(int fps)
Deprecated.
|
void |
setTextureManager(TextureManager textureManager) |
void |
setUIEnabled(boolean enabled)
Enables the touch interface for UI objects
|
void |
stop() |
boolean |
swapChildren(DisplayObject child1,
DisplayObject child2)
Swap the indeces of 2 children.
|
boolean |
swapChildren(int index1,
int index2)
Swap the indeces of 2 children.
|
java.lang.String |
toString() |
public static final java.lang.String TAG
protected int mBuffersToInvalidate
protected Stage mStage
protected GLState mGLState
protected Camera mCamera
protected boolean mClippingEnabled
protected TextureManager mTextureManager
protected java.util.ArrayList<DisplayObject> mChildren
protected java.util.HashMap<java.lang.String,DisplayObject> mChildrenIds
public final boolean queueEvent(java.lang.Runnable r)
queueEvent in interface ParentablequeueEvent in interface Scenepublic final boolean queueEvent(java.lang.Runnable r,
int delayMillis)
queueEvent in interface Scenepublic void setStage(Stage stage)
public void setAxisSystem(int value)
setAxisSystem in interface Scenepublic void setDepthRange(float zNear,
float zFar)
setDepthRange in interface ScenezNear - zFar - DisplayObject#setPerspectiveEnabled(boolean)}, {@link PerspectiveCamera}public final int getAxisSystem()
getAxisSystem in interface Scenepublic final int getCurrentFps()
@Deprecated public final int getTargetFps()
@Deprecated public void setTargetFps(int fps)
fps - the fps to setpublic void setListener(Scene.Listener listener)
public final GLState getGLState()
getGLState in interface Sceneprotected TextureManager createDefaultTextureManager()
public void setTextureManager(TextureManager textureManager)
public final TextureManager getTextureManager()
getTextureManager in interface Scenepublic void onSurfaceCreated(GL10 gl,
EGLConfig config)
public void onSurfaceChanged(GL10 gl,
int width,
int height)
public void onSurfacePaused()
onSurfacePaused in interface Scenepublic void onSurfaceResumed()
onSurfaceResumed in interface Scenepublic void onDrawFrame(GL10 gl)
public boolean isPaused()
public void stop()
public final void invalidate()
invalidate in interface Parentablepublic final void invalidate(int flags)
invalidate in interface Parentablepublic final void invalidateBuffers(int numBuffers)
public boolean isRenderContinueously()
public void setRenderContinueously(boolean renderContinueously)
public final GLColor getColor()
public void setColor(GLColor color)
color - the color to set.public BlendFunc getDefaultBlendFunc()
public void setDefaultBlendFunc(BlendFunc defaultBlendFunc)
defaultBlendFunc - protected void clear()
public final boolean isAutoClear()
public void setAutoClear(boolean autoClear)
autoClear - the autoClear to setpublic boolean addChild(DisplayObject child)
public boolean addChild(DisplayObject child, int index)
public boolean removeChild(DisplayObject child)
removeChild in interface Containerpublic void removeAllChildren()
removeAllChildren in interface Parentablepublic DisplayObject getChildAt(int index)
getChildAt in interface Containerpublic int getChildIndex(DisplayObject child)
getChildIndex in interface Containerpublic DisplayObject getChildById(java.lang.String id)
getChildById in interface Containerpublic boolean swapChildren(DisplayObject child1, DisplayObject child2)
swapChildren in interface Containerchild1 - child2 - public boolean swapChildren(int index1,
int index2)
swapChildren in interface Parentableindex1 - index2 - public int getNumChildren()
getNumChildren in interface ParentablegetNumGrandChildren()public int getNumGrandChildren()
getNumGrandChildren in interface ParentablegetNumChildren()public final PointF getSize()
getSize in interface Parentablepublic final float getWidth()
public final float getHeight()
public final Camera getCamera()
public void setCamera(Camera camera)
public final RectF getCameraRect()
getCameraRect in interface Scenepublic boolean isClippingEnabled()
isClippingEnabled in interface Parentablepublic void setClippingEnabled(boolean clippingEnabled)
setClippingEnabled in interface ParentableclippingEnabled - public final void localToGlobal(PointF local,
PointF result)
localToGlobal in interface Parentablelocal - result - public final PointF globalToLocal(PointF global)
public final void globalToLocal(PointF global,
PointF result)
globalToLocal in interface Parentableglobal - result - public final void globalToScreen(float globalX,
float globalY,
PointF result)
globalToScreen in interface SceneglobalX - globalY - public final void screenToGlobal(float screenX,
float screenY,
PointF result)
screenToGlobal in interface ScenescreenX - screenY - public final void screenToGlobal(PointF screen,
PointF result)
screenToGlobal in interface Scenescreen - BaseScene#screenToGlobal(float, float)public final void globalToStage(float globalX,
float globalY,
PointF result)
globalToStage in interface SceneglobalX - globalY - result - public final void globalToStage(RectF globalRect,
RectF result)
globalToStage in interface SceneglobalRect - result - protected float convertY(float y,
float size)
y - size - public final Matrix getMatrix()
getMatrix in interface Parentablepublic final int getBuffersToInvalidate()
public void setBuffersToInvalidate(int buffersToInvalidate)
public final boolean isUIEnabled()
isUIEnabled in interface Scenepublic void setUIEnabled(boolean enabled)
setUIEnabled in interface Scenepublic PointF getTouchedPoint()
getTouchedPoint in interface Scenepublic PointF getTouchedPoint(int pointerIndex)
getTouchedPoint in interface Scenepublic int getPointerCount()
getPointerCount in interface Scenepublic boolean onTouchEvent(MotionEvent event)
onTouchEvent in interface Scenepublic Scene getScene()
getScene in interface Parentablepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getObjectTree()
public java.lang.String countObjectsByType()
protected void countObjectsByType(Container container, java.util.Map<java.lang.String,java.lang.Integer> map)