Table 4-2. Interface Members for the DirectX Sprite Class
|
TYPE
|
NAME
|
DESCRIPTION
|
Properties
|
X and Y
|
The upper-left position of the sprite.
怪物左上角的位置
|
Properties
|
SizeX and SizeY
|
The size of the sprite, in the x and y axes.
在x与y轴上怪物的尺寸
|
Property
|
IsTransparent
|
If true, the Draw function will draw a transparent
sprite, loaded in the Load function. We don’t need to store a color key property to say which color will be transparent; such a color is used only when loading the textures.
为“true”则绘制函数将绘制一个透明的怪物,在函数“Load”中读取。我们不需要存储一个颜色的属性,也就是说颜色将透明;当读取材质时这样的颜色是最合适的
|
Property
|
Direction
|
The current direction the sprite is moving in. This
property can be used to choose which image must
be drawn.
移动进来的怪物的当前位置。这个属性通常决定图象是否要被绘制出来
|
Constant
|
IMAGE_SIZE
|
The default size for a square sprite.
一个正方形怪物的默认尺寸
|
Property
|
ScaleFactor
|
Same as the GDI+ Sprite class, it holds a constant
used when creating the sprite, indicating whether
the x and y values are pixel values or based on
IMAGE_SIZE. Useful for creating tiled game fields.
所谓的GDI+怪物类,当创建一个怪物它掌握着一个常数的使用,标志着x和y值是像素值还是基于IMAGE_SIZE。这有助于创建平铺游戏的区域。
|
Properties
|
SpeedX and SpeedY
|
The speed (translation increment per frame) of the
sprite on the x and y axes.
怪物在x与y轴的速度(每帧的平移增量)
|
Properties
|
TranslationX and
TranslationY
|
The current translation value in each axis, from the
initial x,y position.
从初始的x,y位置开始到当前各个轴上的平移量
|
Properties
|
ScaleX and ScaleY
|
The scale to be applied to the sprite in each axis.
怪物的比例在每个轴上
|
Properties
|
RotationX and
RotationY
|
The rotation in each axis.
每个轴上的旋转
|
Property
|
SpriteImage
|
The sprite texture, loaded from an image file.
从图象文件读取的怪物的材质贴图
|
Property
|
VertBuffer
|
The vertex buffer with the vertices of the sprite.
怪物的顶点集的顶点缓冲器
|
Method
|
New
|
Method for creating a new sprite.
创建一个新的怪物的函数
|
Method
|
Load
|
Method for loading the image file from disk; it
creates the vertices used to draw the image on the
screen.
从磁盘中读取图象文件;它的创建常用于在屏幕上绘制顶点集
|
Method
|
Draw
|
Method that draws the sprite.
绘制怪物的函数
|
Method
|
Dispose
|
Method that disposes of the texture and the vertex
buffer used by the sprite.
销毁被怪物使用的材质贴图与顶点缓冲
|
Method
|
CreateFlexVertex
|
Helper method used when creating the sprite vertex
buffer.
创建怪物顶点缓冲的辅助函数
|