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 Parentable
queueEvent
in interface Scene
public final boolean queueEvent(java.lang.Runnable r, int delayMillis)
queueEvent
in interface Scene
public void setStage(Stage stage)
public void setAxisSystem(int value)
setAxisSystem
in interface Scene
public void setDepthRange(float zNear, float zFar)
setDepthRange
in interface Scene
zNear
- zFar
- DisplayObject#setPerspectiveEnabled(boolean)}, {@link PerspectiveCamera}
public final int getAxisSystem()
getAxisSystem
in interface Scene
public 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 Scene
protected TextureManager createDefaultTextureManager()
public void setTextureManager(TextureManager textureManager)
public final TextureManager getTextureManager()
getTextureManager
in interface Scene
public void onSurfaceCreated(GL10 gl, EGLConfig config)
public void onSurfaceChanged(GL10 gl, int width, int height)
public void onSurfacePaused()
onSurfacePaused
in interface Scene
public void onSurfaceResumed()
onSurfaceResumed
in interface Scene
public void onDrawFrame(GL10 gl)
public boolean isPaused()
public void stop()
public final void invalidate()
invalidate
in interface Parentable
public final void invalidate(int flags)
invalidate
in interface Parentable
public 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 Container
public void removeAllChildren()
removeAllChildren
in interface Parentable
public DisplayObject getChildAt(int index)
getChildAt
in interface Container
public int getChildIndex(DisplayObject child)
getChildIndex
in interface Container
public DisplayObject getChildById(java.lang.String id)
getChildById
in interface Container
public boolean swapChildren(DisplayObject child1, DisplayObject child2)
swapChildren
in interface Container
child1
- child2
- public boolean swapChildren(int index1, int index2)
swapChildren
in interface Parentable
index1
- index2
- public int getNumChildren()
getNumChildren
in interface Parentable
getNumGrandChildren()
public int getNumGrandChildren()
getNumGrandChildren
in interface Parentable
getNumChildren()
public final PointF getSize()
getSize
in interface Parentable
public final float getWidth()
public final float getHeight()
public final Camera getCamera()
public void setCamera(Camera camera)
public final RectF getCameraRect()
getCameraRect
in interface Scene
public boolean isClippingEnabled()
isClippingEnabled
in interface Parentable
public void setClippingEnabled(boolean clippingEnabled)
setClippingEnabled
in interface Parentable
clippingEnabled
- public final void localToGlobal(PointF local, PointF result)
localToGlobal
in interface Parentable
local
- result
- public final PointF globalToLocal(PointF global)
public final void globalToLocal(PointF global, PointF result)
globalToLocal
in interface Parentable
global
- result
- public final void globalToScreen(float globalX, float globalY, PointF result)
globalToScreen
in interface Scene
globalX
- globalY
- public final void screenToGlobal(float screenX, float screenY, PointF result)
screenToGlobal
in interface Scene
screenX
- screenY
- public final void screenToGlobal(PointF screen, PointF result)
screenToGlobal
in interface Scene
screen
- BaseScene#screenToGlobal(float, float)
public final void globalToStage(float globalX, float globalY, PointF result)
globalToStage
in interface Scene
globalX
- globalY
- result
- public final void globalToStage(RectF globalRect, RectF result)
globalToStage
in interface Scene
globalRect
- result
- protected float convertY(float y, float size)
y
- size
- public final Matrix getMatrix()
getMatrix
in interface Parentable
public final int getBuffersToInvalidate()
public void setBuffersToInvalidate(int buffersToInvalidate)
public final boolean isUIEnabled()
isUIEnabled
in interface Scene
public void setUIEnabled(boolean enabled)
setUIEnabled
in interface Scene
public PointF getTouchedPoint()
getTouchedPoint
in interface Scene
public PointF getTouchedPoint(int pointerIndex)
getTouchedPoint
in interface Scene
public int getPointerCount()
getPointerCount
in interface Scene
public boolean onTouchEvent(MotionEvent event)
onTouchEvent
in interface Scene
public Scene getScene()
getScene
in interface Parentable
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getObjectTree()
public java.lang.String countObjectsByType()
protected void countObjectsByType(Container container, java.util.Map<java.lang.String,java.lang.Integer> map)