Public Member Functions | |
GFX () | |
GFX (const std::string Filename, const SDL_Color InitTransparent=NONE, const u16 InitNoFrames=1) | |
GFX (SDL_Surface *InitSurface, const SDL_Color InitTransparent=NONE, const u16 InitNoFrames=1) | |
GFX (SDL_Color InitColor, u16 Width=Screen->w, u16 Height=Screen->h) | |
GFX | Clone (void) const |
void | Save (const std::string Filename) const |
saves this graphical surface into a BMP file. | |
SDL_Surface * | GetSurface () const |
return the associated SDL Surface for direct manipulation | |
void | SetSurface (SDL_Surface *NewSurface) |
NewSurface is copied and can be safely fred after invocation. | |
u16 | GetWidth () const |
u16 | GetHeight () const |
u8 | GetNoFrames () |
void | SetNoFrames (const u16 NewNoFrames=1) |
SDL_Color | GetTrans (void) const |
void | SetTrans (const SDL_Color NewTransparent=NONE) |
void | SetAlpha (const u8 NewAlpha=SDL_ALPHA_OPAQUE) |
u8 | GetAlpha () const |
u16 | GetFrame () const |
get current frame number (count starts from 0) | |
void | SetFrame (const u16 NewFrame=0) |
set current frame number (count starts from 0, must be < NoFrames) | |
bool | isAnim () const |
return true if playing animation | |
void | StartAnim () |
start sprite auto-animation | |
void | PauseAnim () |
void | StopAnim () |
u8 | GetFPS () |
SDL_Color | GetPixel (const u16 X, const u16 Y) const |
void | SetPixel (const u16 X, const u16 Y, const SDL_Color Color=BLACK) |
void | DrawLine (const u16 X1, const u16 Y1, const u16 X2, const u16 Y2, SDL_Color EdgeColor=BLACK, u8 Thick=1) |
void | DrawRect (Rect r, SDL_Color FillColor=BLACK) |
Protected Member Functions | |
void | UpdateFrame (void) |
SDL_Rect | GetFrameRect () const |
Protected Attributes | |
SDL_Surface * | Surface |
SDL_Color | Transparent |
u8 | Alpha |
bool | RotZoomEnabled |
SDL_Surface * | OriginalSurface |
u16 | W |
u16 | H |
u8 | NoFrames |
u16 | Frame |
bool | Anim |
u32 | LastFrameTime |
u8 | FPS |
s8 | AnimNoLoops |
GFX::GFX | ( | ) | [inline] |
default constructor: create an empty/invisible surface
GFX::GFX | ( | const std::string | Filename, | |
const SDL_Color | InitTransparent = NONE , |
|||
const u16 | InitNoFrames = 1 | |||
) | [inline] |
most-used constructor: load a surface from a graphic file (only BMPs are supported, use SDL_image and the second constructor to load other image formats)
References SetNoFrames(), SetTrans(), and Surface.
GFX::GFX | ( | SDL_Surface * | InitSurface, | |
const SDL_Color | InitTransparent = NONE , |
|||
const u16 | InitNoFrames = 1 | |||
) | [inline] |
alternative constructor no.1: uses a given SDL_Surface NOTE: InitSurface is copied and can be safely fred after invocation.
References SetNoFrames(), SetSurface(), and SetTrans().
GFX::GFX | ( | SDL_Color | InitColor, | |
u16 | Width = Screen->w , |
|||
u16 | Height = Screen->h | |||
) | [inline] |
alternative constructor no.2: create an empty surface of given dimensions (default is screen size) and fills it with a solid color
References mSDL::Screen, SetNoFrames(), and Surface.
GFX GFX::Clone | ( | void | ) | const [inline] |
References OriginalSurface, RotZoomEnabled, and Surface.
void GFX::DrawLine | ( | const u16 | X1, | |
const u16 | Y1, | |||
const u16 | X2, | |||
const u16 | Y2, | |||
SDL_Color | EdgeColor = BLACK , |
|||
u8 | Thick = 1 | |||
) | [inline] |
References DrawRect(), SetPixel(), and Surface.
void GFX::DrawRect | ( | Rect | r, | |
SDL_Color | FillColor = BLACK | |||
) | [inline] |
u8 GFX::GetAlpha | ( | ) | const [inline] |
References Alpha.
u8 GFX::GetFPS | ( | ) | [inline] |
References FPS.
u16 GFX::GetFrame | ( | ) | const [inline] |
SDL_Rect GFX::GetFrameRect | ( | ) | const [protected] |
u16 GFX::GetHeight | ( | ) | const [inline] |
u8 GFX::GetNoFrames | ( | ) | [inline] |
References NoFrames.
SDL_Color GFX::GetPixel | ( | const u16 | X, | |
const u16 | Y | |||
) | const [inline] |
References Surface.
SDL_Surface* GFX::GetSurface | ( | ) | const [inline] |
SDL_Color GFX::GetTrans | ( | void | ) | const [inline] |
References Transparent.
u16 GFX::GetWidth | ( | ) | const [inline] |
References W.
Referenced by ScreenObject::CollisionCirc(), ScreenObject::CollisionRect(), and ScreenObject::GetCenterX().
bool GFX::isAnim | ( | ) | const [inline] |
void GFX::PauseAnim | ( | ) | [inline] |
References Anim.
void GFX::Save | ( | const std::string | Filename | ) | const [inline] |
void GFX::SetAlpha | ( | const u8 | NewAlpha = SDL_ALPHA_OPAQUE |
) | [inline] |
void GFX::SetFrame | ( | const u16 | NewFrame = 0 |
) | [inline] |
void GFX::SetNoFrames | ( | const u16 | NewNoFrames = 1 |
) | [inline] |
void GFX::SetPixel | ( | const u16 | X, | |
const u16 | Y, | |||
const SDL_Color | Color = BLACK | |||
) | [inline] |
void GFX::SetSurface | ( | SDL_Surface * | NewSurface | ) | [inline] |
void GFX::SetTrans | ( | const SDL_Color | NewTransparent = NONE |
) | [inline] |
NewTransparent | set the transparent color. Invoked with no arguments will remove any previously set transparency. |
References Surface, and Transparent.
Referenced by GFX().
void GFX::StartAnim | ( | ) | [inline] |
void GFX::StopAnim | ( | ) | [inline] |
void GFX::UpdateFrame | ( | void | ) | [protected] |
u8 GFX::Alpha [protected] |
Referenced by GetAlpha(), and SetAlpha().
bool GFX::Anim [protected] |
Referenced by isAnim(), PauseAnim(), StartAnim(), and StopAnim().
s8 GFX::AnimNoLoops [protected] |
u16 GFX::Frame [protected] |
Referenced by GetFrame(), SetFrame(), and StopAnim().
u16 GFX::H [protected] |
Referenced by GetHeight(), and SetNoFrames().
u32 GFX::LastFrameTime [protected] |
Referenced by StartAnim().
u8 GFX::NoFrames [protected] |
Referenced by GetNoFrames(), SetFrame(), and SetNoFrames().
SDL_Surface* GFX::OriginalSurface [protected] |
Referenced by Clone().
bool GFX::RotZoomEnabled [protected] |
Referenced by Clone().
SDL_Surface* GFX::Surface [protected] |
Referenced by Clone(), DrawLine(), DrawRect(), GetPixel(), GetSurface(), GFX(), Save(), SetAlpha(), SetNoFrames(), SetPixel(), SetSurface(), and SetTrans().
SDL_Color GFX::Transparent [protected] |
Referenced by GetTrans(), and SetTrans().
u16 GFX::W [protected] |
Referenced by GetWidth(), and SetNoFrames().