#include <AffineMatrix.hpp>
Public Member Functions | |
AffineMatrix (const uint index, const bool useMainOam=true) | |
the constructor that creates an AffineMatrix object. | |
const int | gethdx () const |
returns the 1st value of the affine matrix | |
const int | gethdy () const |
returns the 2nd value of the affine matrix | |
const uint | getIndex () const |
returns the rotation index of the object. | |
bool | getMainEngine () const |
returns if the sprite uses the main oam or not. | |
const int | getvdx () const |
returns the 3th value of the affine matrix | |
const int | getvdy () const |
returns the 4th value of the affine matrix | |
AffineMatrix & | operator= (const AffineMatrix &source) |
the asignment operator, will copy everything exept the index. | |
AffineMatrix & | setAffineTransformation (const int hdx, const int hdy, const int vdx, const int vdy) |
allows you to directly sets the affine transformation matrix | |
AffineMatrix & | setAngleScale (const int angle=0, const int scaleX=(1<< 8), const int scaleY=(1<< 8)) |
sets the angle and scale of the object. | |
AffineMatrix & | setIndex (const uint index) |
sets the rotation index of the object. | |
AffineMatrix & | setMainEngine (const bool useMainOam=true) |
sets the AffineMatrix's engine. | |
virtual void | update () |
this will update the AffineMatrix object. | |
Static Public Member Functions | |
static void | freeAffineMatrix (const uint AffineMatrixIndex, const bool mainOAM=true) |
frees a AffineMatrix index so other sprites can use it. | |
static uint | reserveEmptyAffineMatrix (const bool mainOAM=true) |
reserves an empty AffineMatrix index to use. | |
Static Public Attributes | |
static const uint | NUMBER_OF_AFFINE_MATRIXES = 32 |
a constant for the number of affine matrixes available per sprite engine |
sprite(s) can use objects of this class to manage information about scaling and rotating sprites. there can be at most 32 objects (index 0-31) (the hardware wont allow more), but multiple sprites can use the same AffineMatrix object.
DSOL::Sprites::AffineMatrix::AffineMatrix | ( | const uint | index, | |
const bool | useMainOam = true | |||
) | [inline] |
the constructor that creates an AffineMatrix object.
index | the index of the AffineMatrix in oam, must be (0-31). | |
useMainOam | true if this AffineMatrix object is for sprites of the main engine, false for the sub engine. default is true. |
static void DSOL::Sprites::AffineMatrix::freeAffineMatrix | ( | const uint | AffineMatrixIndex, | |
const bool | mainOAM = true | |||
) | [inline, static] |
frees a AffineMatrix index so other sprites can use it.
this will free a AffineMatrix index that has been reserved with reserveEmptyAffineMatrix() so that other sprites can use it.
mainOAM | true if the AffineMatrix index is for the main oam, false otherwise | |
AffineMatrixIndex | the index to be freed, should be an index gotten with reserveEmptyAffineMatrix() |
const int DSOL::Sprites::AffineMatrix::gethdx | ( | ) | const [inline] |
returns the 1st value of the affine matrix
const int DSOL::Sprites::AffineMatrix::gethdy | ( | ) | const [inline] |
returns the 2nd value of the affine matrix
const uint DSOL::Sprites::AffineMatrix::getIndex | ( | ) | const [inline] |
returns the rotation index of the object.
bool DSOL::Sprites::AffineMatrix::getMainEngine | ( | ) | const [inline] |
returns if the sprite uses the main oam or not.
const int DSOL::Sprites::AffineMatrix::getvdx | ( | ) | const [inline] |
returns the 3th value of the affine matrix
const int DSOL::Sprites::AffineMatrix::getvdy | ( | ) | const [inline] |
returns the 4th value of the affine matrix
AffineMatrix& DSOL::Sprites::AffineMatrix::operator= | ( | const AffineMatrix & | source | ) | [inline] |
the asignment operator, will copy everything exept the index.
source | the affine matrix to copy from. |
static uint DSOL::Sprites::AffineMatrix::reserveEmptyAffineMatrix | ( | const bool | mainOAM = true |
) | [static] |
reserves an empty AffineMatrix index to use.
this will check if there are AffineMatrix indexes that hasn't been reserved yet, and reserves and returns it if there are onreserved AffineMatrix. there are 32 AffineMatrix for main oam and 32 for sub engine.
mainOAM | true if the Affine Matrix is for the main oam, false otherwise |
AffineMatrix& DSOL::Sprites::AffineMatrix::setAffineTransformation | ( | const int | hdx, | |
const int | hdy, | |||
const int | vdx, | |||
const int | vdy | |||
) | [inline] |
allows you to directly sets the affine transformation matrix
with this, you have more freedom to set the matrix, but it might be more difficult to use if you're not used to affine transformation matrix.
hdx | the 1st matrix value | |
hdy | the 2nd matrix value | |
vdx | the 3th matrix value | |
vdy | the 4th matrix value |
AffineMatrix& DSOL::Sprites::AffineMatrix::setAngleScale | ( | const int | angle = 0 , |
|
const int | scaleX = (1<< 8) , |
|||
const int | scaleY = (1<< 8) | |||
) |
sets the angle and scale of the object.
the angle can be one of the spriteAngle enum values, a 360 degree value converted with libnds's degreesToAngle() macro function, or an 32 bits int if you need precision. the scale values are in .8 fixed point format.
angle | the new angle of the object, in the format that libnds uses (32768 degrees), default is 0 (no angle). | |
scaleX | the value to scale the x ax with. | |
scaleY | the value to scale the y ax with. |
AffineMatrix& DSOL::Sprites::AffineMatrix::setIndex | ( | const uint | index | ) | [inline] |
sets the rotation index of the object.
index | the new index of the object. |
AffineMatrix& DSOL::Sprites::AffineMatrix::setMainEngine | ( | const bool | useMainOam = true |
) | [inline] |
sets the AffineMatrix's engine.
puts the sprite on the main or the sub engine.
useMainOam | true if the sprite should be on the main engine, false for the sub engine. default is true. |
virtual void DSOL::Sprites::AffineMatrix::update | ( | ) | [inline, virtual] |
this will update the AffineMatrix object.
this will copy the data to oam so sprites can use it.
Implements DSOL::IUpdater.
const uint DSOL::Sprites::AffineMatrix::NUMBER_OF_AFFINE_MATRIXES = 32 [static] |
a constant for the number of affine matrixes available per sprite engine