Enrichir les sprites : textures, défilement, transformation, animation
CHAPITRE 6
123
{
this.position = position;
this.sourceRectangle = sourceRectangle;
this.color = color;
this.rotation = rotation;
this.origin = origin;
}
public Sprite(Vector2 position, Rectangle? sourceRectangle, Color color, float
➥rotation, Vector2 origin, Vector2 scale)
{
this.position = position;
this.sourceRectangle = sourceRectangle;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.scale = scale;
}
public Sprite(Vector2 position, Rectangle? sourceRectangle, Color color, float
➥rotation, Vector2 origin, Vector2 scale, SpriteEffects effect)
{
this.position = position;
this.sourceRectangle = sourceRectangle;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.scale = scale;
this.effect = effect;
}
public Sprite(Vector2 position, Rectangle? sourceRectangle, Color color, float
➥rotation, Vector2 origin, Vector2 scale, SpriteEffects effect, float layerDepth)
{
this.position = position;
this.sourceRectangle = sourceRectangle;
this.color = color;
this.rotation = rotation;
this.origin = origin;
this.scale = scale;
this.effect = effect;
this.layerDepth = layerDepth;
}
public void LoadContent(ContentManager content, string assetName)
{
texture = content.Load(assetName);
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(texture, position, sourceRectangle, color, rotation,
➥origin, scale, effect, layerDepth);
}
}
=Labat FM.book Page 123 Vendredi, 19. juin 2009 4:01 16
Précédent

- 144/366

Suivant