29 #include "nomlib/math/Transformable.hpp"
33 Transformable::Transformable (
void ) : coords ( 0, 0, 0, 0 ),
34 color ( 0, 0, 0, 255 )
39 Transformable::Transformable (
const Coords& coords ): coords ( coords ) {}
41 Transformable::Transformable (
const Coords& coords,
const Color& color )
43 this->coords = coords;
47 Transformable::~Transformable (
void ) {}
49 const Coords Transformable::getPosition (
void )
const
51 return Coords ( this->coords.x, this->coords.y );
54 const Coords Transformable::getSize (
void )
const
56 return Coords ( this->coords.width, this->coords.height );
60 void Transformable::setPosition ( int32 x, int32 y )
62 this->coords.setPosition ( x, y );
66 void Transformable::setPosition ( int32 x, int32 y, int32 width, int32 height )
68 this->coords = Coords ( x, y, width, height );
72 void Transformable::setPosition (
const Coords& coords )
74 this->setPosition ( coords.x, coords.y, coords.width, coords.height );
77 void Transformable::setSize ( int32 width, int32 height )
79 this->coords.setSize ( width, height );
82 void Transformable::setSize (
const Coords& size )
84 this->setSize ( size.width, size.height );
87 void Transformable::move ( uint32 x, uint32 y )
93 void Transformable::move (
const Coords& offsets )
95 this->coords.x += offsets.x;
96 this->coords.y += offsets.y;
99 const Color& Transformable::getColor (
void )
const
104 void Transformable::setColor ( uint8 red, uint8 green, uint8 blue, uint8 alpha )
106 this->color = Color ( red, green, blue, alpha );
109 void Transformable::setColor (
const Color& color )
111 this->setColor ( color.red, color.green, color.blue, color.alpha );