1 /** 2 * Module for texture sprite handling. 3 * 4 * Authors: 5 * Jacob Jensen 6 * License: 7 * https://github.com/PoisonEngine/poison-ui/blob/master/LICENSE 8 */ 9 module poison.ui.sprite; 10 11 import dsfml.graphics : Sprite, Texture; 12 import dsfml.system : Vector2f; 13 14 import poison.core : Point; 15 16 /// An extension class to the sprite implementation of Dsfml. 17 class TextureSprite : Sprite { 18 private: 19 /// The position of the sprite. 20 Point _position; 21 22 public: 23 /** 24 * Creates a new texture sprite. 25 * Params: 26 * texture = The texture of the sprite. 27 */ 28 this(Texture texture) { 29 super(texture); 30 } 31 32 @property { 33 /// Gets the position of the sprite. 34 Point position() { return _position; } 35 36 /// Sets the position of the sprite. 37 void position(Point newPosition) { 38 _position = newPosition; 39 40 super.position = Vector2f(_position.x, _position.y); 41 } 42 } 43 }