SurfaceView
java.lang.Object
SurfaceView
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
ShapeView(Context context)
Creates a new ShapeView.
| ||||||||||
|
ShapeView(Context context, AttributeSet attrs)
Creates a new ShapeView.
| ||||||||||
|
ShapeView(Context context, AttributeSet attrs, int defStyle)
Creates a new ShapeView.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void
|
add(Shape shape)
Adds a shape to the
ShapeField currently in use by this view. | ||||||||||
void
|
clear()
Removes all shapes from the
ShapeField currently in use by this
view. | ||||||||||
void
|
conditionallyRepaint(RectF bounds)
| ||||||||||
void
|
conditionallyRepaint()
| ||||||||||
boolean
|
dispatchTouchEvent(MotionEvent e)
| ||||||||||
synchronized
boolean
|
doesAutoRepaint()
Does this view automatically repaint, or is an explicit call needed?
| ||||||||||
void
|
enableRotateGestures()
Turn on support for rotation gestures.
| ||||||||||
void
|
enableScaleGestures()
Turn on support for pinching/zoom gestures.
| ||||||||||
ShapeAnimationManager
|
getAnimationManager()
Get the animation manager for this view.
| ||||||||||
Color
|
getBackgroundColor()
Gets the background color of the view.
| ||||||||||
CoordinateSystem
|
getCoordinateSystem()
| ||||||||||
PointF
|
getGravity()
Gets the gravity of the physical world represented by this shape view.
| ||||||||||
<MyShape extends Shape>
Set<MyShape>
|
getNeighbors(Shape shape, float distance, boolean diag, Class<MyShape> cls)
Returns the neighbors to the given location.
| ||||||||||
ShapeField
|
getShapeField()
Gets the
ShapeField that the view is currently displaying and
simulating. | ||||||||||
ShapeFilter<Shape>
|
getShapes()
Gets a filter that can be used to find shapes that match certain
criteria.
| ||||||||||
<MyShape extends Shape>
Set<MyShape>
|
getShapesInDirection(float x, float y, float angle, float length, Class<MyShape> cls)
Return all objects that intersect a straight line from the location at
a specified angle.
| ||||||||||
<MyShape extends Shape>
Set<MyShape>
|
getShapesInRange(float x, float y, float r, Class<MyShape> cls)
Returns all objects with the logical location within the specified
circle.
| ||||||||||
synchronized
void
|
internalSetAutoRepaintForThread(boolean value)
Used internally to temporarily disable repainting.
| ||||||||||
boolean
|
isInFrontOf(Shape left, Shape right)
Returns true if the left shape is drawn in front of (later than) the
shape on the right.
| ||||||||||
boolean
|
onKeyDown(int keyCode, KeyEvent e)
| ||||||||||
boolean
|
onTouchEvent(MotionEvent e)
| ||||||||||
void
|
remove(Shape shape)
Removes a shape from the
ShapeField currently in use by this
view. | ||||||||||
void
|
repaint()
| ||||||||||
void
|
repaint(RectF bounds)
| ||||||||||
synchronized
void
|
setAutoRepaint(boolean value)
Tell this view to automatically repaint when Shapes change (or not).
| ||||||||||
void
|
setBackgroundColor(Color color)
Sets the background color of the view.
| ||||||||||
void
|
setGravity(float xGravity, float yGravity)
Sets the gravity of the physical world represented by this shape view.
| ||||||||||
void
|
setGravity(PointF gravity)
Sets the gravity of the physical world represented by this shape view.
| ||||||||||
void
|
setShapeField(ShapeField newField)
Sets the
ShapeField that the view is currently displaying and
simulating. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void
|
drawContents(Canvas canvas, RectF repaintBounds)
Draw all of this view's shapes on the given canvas.
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Creates a new ShapeView.
Creates a new ShapeView.
Creates a new ShapeView.
Adds a shape to the ShapeField
currently in use by this view.
This method is a shortcut for getShapeField().add(shape)
.
Removes all shapes from the ShapeField
currently in use by this
view. This method is a shortcut for getShapeField().clear()
.
Does this view automatically repaint, or is an explicit call needed?
True if this view automatically repaints when contained shapes are modified.
Turn on support for rotation gestures.
Turn on support for pinching/zoom gestures.
Get the animation manager for this view.
This view's animation manager.
Gets the background color of the view.
the background Color
of the view
Gets the gravity of the physical world represented by this shape view.
a PointF
object whose x and y components are the
horizontal and vertical acceleration due to gravity (in units/sec^2)
of the physical world represented by this shape view
Returns the neighbors to the given location. This method only looks at the logical location and not the extent of objects. Hence it is most useful in scenarios where objects only span one cell.
A collection of all neighbors found.
Gets the ShapeField
that the view is currently displaying and
simulating.
the ShapeField
currently in use by the view
Gets a filter that can be used to find shapes that match certain
criteria. This method is a shortcut for
getShapeField().getShapes()
.
a filter that can be used to find shapes that match certain criteria
Return all objects that intersect a straight line from the location at a specified angle. The angle is clockwise.
A collection of all objects found.
Returns all objects with the logical location within the specified circle. In other words an object A is within the range of an object B if the distance between the center of the two objects is less than r.
A set of shapes that lie within the given circle.
Used internally to temporarily disable repainting.
Returns true if the left shape is drawn in front of (later than) the shape on the right.
True if left is drawn in front of (later than) right.
Removes a shape from the ShapeField
currently in use by this
view. This method is a shortcut for
getShapeField().remove(shape)
.
Tell this view to automatically repaint when Shapes change (or not).
Sets the background color of the view.
Color
Sets the gravity of the physical world represented by this shape view.
Sets the gravity of the physical world represented by this shape view.
PointF
whose x and y components are the
horizontal and vertical acceleration due to gravity (in units/sec^2)
of the physical world represented by this shape view
Sets the ShapeField
that the view is currently displaying and
simulating. When developing games or simulations that involve multiple
"levels" or other complex multiple shape layouts, this method can be
used to quickly and easily swap out the entire set of shapes used by the
view.
ShapeField
to be used by the view
Draw all of this view's shapes on the given canvas.