C# 클래스 Sparrow.Display.DisplayObject

The DisplayObject class is the base class for all objects that are rendered on the screen. In Sparrow, all displayable objects are organized in a display tree. Only objects that are part of the display tree will be displayed (rendered). The display tree consists of leaf nodes (Image, Quad) that will be rendered directly to the screen, and of container nodes (subclasses of DisplayObjectContainer, like Sprite). A container is simply a display object that has child nodes - which can, again, be either leaf nodes or other containers. A display object has properties that define its position in relation to its parent ('X', 'Y'), as well as its rotation, skewing and scaling factors. Use the 'Alpha' and 'Visible' properties to make an object translucent or invisible. Every display object may be the target of touch events. If you don't want an object to be touchable, you can disable the `Touchable` property. When it's disabled, neither the object nor its children will receive any more touch events. **Points vs. Pixels** All sizes and distances are measured in points. What this means in pixels depends on the contentScaleFactor of the device. **Transforming coordinates** Within the display tree, each object has its own local coordinate system. If you rotate a container, you rotate that coordinate system - and thus all the children of the container. Sometimes you need to know where a certain point lies relative to another coordinate system. That's the purpose of the method 'TransformationMatrixToSpace'. It will create a matrix that represents the transformation of a point in one coordinate system to another. **Subclassing DisplayObject** As DisplayObject is an abstract class, you can't instantiate it directly, but have to use one of its subclasses instead. However, you can create custom display objects as well. That's especially useful when you want to create an object with a custom render function. You will need to implement the following methods when you subclass DisplayObject: - void Render ( RenderSupport support); - Rectangle BoundsInSpace ( DisplayObject targetSpace); Have a look at Quad for a sample implementation of those methods.
파일 보기 프로젝트 열기: fmotagarcia/sparrow-sharp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
BlendMode uint
Filter SparrowSharp.Filters.FragmentFilter
Name string
Touchable bool
Visible bool

보호된 프로퍼티들

프로퍼티 타입 설명
_alpha float

공개 메소드들

메소드 설명
Align ( HAlign hAlign, VAlign vAlign ) : void

Moves the pivot point to a certain position within the local coordinate system of the object.

AlignPivotToCenter ( ) : void

Moves the pivot point to the center of the object.

BoundsInSpace ( DisplayObject targetSpace ) : Rectangle

Returns a rectangle that completely encloses the object as it appears in another coordinate system.

GlobalToLocal ( Point globalPoint ) : Point

Transforms a point from global (stage) coordinates to the local coordinate system.

HitTestPoint ( Point localPoint ) : DisplayObject

Returns the object that is found topmost on a point in local coordinates, or null if the test fails.

LocalToGlobal ( Point localPoint ) : Point

Transforms a point from the local coordinate system to global (stage) coordinates.

RemoveFromParent ( ) : void

Removes the object from its parent, if it has one.

Render ( RenderSupport support ) : void

Renders the display object with the help of a support object.

TransformationMatrixToSpace ( DisplayObject targetSpace ) : Matrix

Creates a matrix that represents the transformation from the local coordinate system to another.

보호된 메소드들

메소드 설명
DisplayObject ( ) : System

비공개 메소드들

메소드 설명
BroadcastAddedToStageEvent ( DisplayObjectContainer currentTarget ) : void
BroadcastEnterFrameEvent ( float passedTime ) : void
BroadcastRemovedFromStageEvent ( DisplayObjectContainer currentTarget ) : void
InvokeAdded ( DisplayObject target, DisplayObject currentTarget ) : void
InvokeKeyDown ( DisplayObject target, DisplayObject currentTarget ) : void
InvokeKeyUp ( DisplayObject target, DisplayObject currentTarget ) : void
InvokeRemoved ( ) : void
InvokeTouch ( TouchEvent touchEvent ) : void

메소드 상세

Align() 공개 메소드

Moves the pivot point to a certain position within the local coordinate system of the object.
public Align ( HAlign hAlign, VAlign vAlign ) : void
hAlign HAlign
vAlign VAlign
리턴 void

AlignPivotToCenter() 공개 메소드

Moves the pivot point to the center of the object.
public AlignPivotToCenter ( ) : void
리턴 void

BoundsInSpace() 공개 추상적인 메소드

Returns a rectangle that completely encloses the object as it appears in another coordinate system.
public abstract BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
targetSpace DisplayObject
리턴 Sparrow.Geom.Rectangle

DisplayObject() 보호된 메소드

protected DisplayObject ( ) : System
리턴 System

GlobalToLocal() 공개 메소드

Transforms a point from global (stage) coordinates to the local coordinate system.
public GlobalToLocal ( Point globalPoint ) : Point
globalPoint Point
리턴 Point

HitTestPoint() 공개 메소드

Returns the object that is found topmost on a point in local coordinates, or null if the test fails.
public HitTestPoint ( Point localPoint ) : DisplayObject
localPoint Point
리턴 DisplayObject

LocalToGlobal() 공개 메소드

Transforms a point from the local coordinate system to global (stage) coordinates.
public LocalToGlobal ( Point localPoint ) : Point
localPoint Point
리턴 Point

RemoveFromParent() 공개 메소드

Removes the object from its parent, if it has one.
public RemoveFromParent ( ) : void
리턴 void

Render() 공개 추상적인 메소드

Renders the display object with the help of a support object.
public abstract Render ( RenderSupport support ) : void
support Sparrow.Core.RenderSupport
리턴 void

TransformationMatrixToSpace() 공개 메소드

Creates a matrix that represents the transformation from the local coordinate system to another.
public TransformationMatrixToSpace ( DisplayObject targetSpace ) : Matrix
targetSpace DisplayObject
리턴 Matrix

프로퍼티 상세

BlendMode 공개적으로 프로퍼티

The blend mode determines how the object is blended with the objects underneath. Default: BlendMode.AUTO
public uint BlendMode
리턴 uint

Filter 공개적으로 프로퍼티

The filter that is attached to the display object. Beware that you should NOT use the same filter on more than one object (for performance reasons).
public FragmentFilter,SparrowSharp.Filters Filter
리턴 SparrowSharp.Filters.FragmentFilter

Name 공개적으로 프로퍼티

The name of the display object (default: null). Used by 'GetChild(string name)' of display object containers.
public string Name
리턴 string

Touchable 공개적으로 프로퍼티

Indicates if this object (and its children) will receive touch events.
public bool Touchable
리턴 bool

Visible 공개적으로 프로퍼티

The visibility of the object. An invisible object will be untouchable.
public bool Visible
리턴 bool

_alpha 보호되어 있는 프로퍼티

protected float _alpha
리턴 float