C# 클래스 Sparrow.Display.Sprite

A Sprite is the most lightweight, non-abstract container class. Use it as a simple means of grouping objects together in one coordinate system. Sprite sprite = new Sprite(); // create children Image venus = TextureLoader.LoadLocalImage("../venus.png"); Image mars = TextureLoader.LoadLocalImage("mars.png"); // move children to some relative positions venus.X = 50; mars.X = -20; // add children to the sprite sprite.AddChild(venus); sprite.AddChild(mars); // calculate total width of all children float totalWidth = sprite.Width; // rotate the whole group sprite.Rotation = Math.PI; **Flattened Sprites** The 'Flatten' method allows you to optimize the rendering of static parts of your display list. It analyzes the tree of children attached to the sprite and optimizes the rendering calls in a way that makes rendering extremely fast. The speed-up comes at a price, though: you will no longer see any changes in the properties of the children (position, rotation, alpha, etc). To update the object after changes have happened, simply call 'flatten' again, or 'unflatten' the object.
상속: DisplayObjectContainer
파일 보기 프로젝트 열기: fmotagarcia/sparrow-sharp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
ClipRect Sparrow.Geom.Rectangle

공개 메소드들

메소드 설명
BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
ClipRectInSpace ( DisplayObject targetSpace ) : Rectangle

Returns the bounds of the container's clipRect in the given coordinate space, or null if the sprite doens't have a clipRect.

Flatten ( ) : void

Optimizes the sprite for optimal rendering performance. Changes in the children of a flattened sprite will not be displayed any longer. For this to happen, either call 'Flatten' again, or 'Unflatten' the sprite. Beware that the actual flattening will not happen right away, but right before the next rendering.

HitTestPoint ( Point localPoint ) : DisplayObject
Render ( RenderSupport support ) : void
Unflatten ( ) : void

Removes the rendering optimizations that were created when flattening the sprite. Changes to the sprite's children will immediately become visible again.

메소드 상세

BoundsInSpace() 공개 메소드

public BoundsInSpace ( DisplayObject targetSpace ) : Rectangle
targetSpace DisplayObject
리턴 Sparrow.Geom.Rectangle

ClipRectInSpace() 공개 메소드

Returns the bounds of the container's clipRect in the given coordinate space, or null if the sprite doens't have a clipRect.
public ClipRectInSpace ( DisplayObject targetSpace ) : Rectangle
targetSpace DisplayObject
리턴 Sparrow.Geom.Rectangle

Flatten() 공개 메소드

Optimizes the sprite for optimal rendering performance. Changes in the children of a flattened sprite will not be displayed any longer. For this to happen, either call 'Flatten' again, or 'Unflatten' the sprite. Beware that the actual flattening will not happen right away, but right before the next rendering.
public Flatten ( ) : void
리턴 void

HitTestPoint() 공개 메소드

public HitTestPoint ( Point localPoint ) : DisplayObject
localPoint Sparrow.Geom.Point
리턴 DisplayObject

Render() 공개 메소드

public Render ( RenderSupport support ) : void
support Sparrow.Core.RenderSupport
리턴 void

Unflatten() 공개 메소드

Removes the rendering optimizations that were created when flattening the sprite. Changes to the sprite's children will immediately become visible again.
public Unflatten ( ) : void
리턴 void

프로퍼티 상세

ClipRect 공개적으로 프로퍼티

The sprite's clipping rectangle in its local coordinate system. Only pixels within this rectangle will be drawn. The clipping rectangle is axis aligned with the screen, so it will not be rotated or skewed if the sprite is.
public Rectangle,Sparrow.Geom ClipRect
리턴 Sparrow.Geom.Rectangle