mSDL::ScreenObject Class Reference

A screen object. It handles objects positioning and drawing on screen. More...

Inheritance diagram for mSDL::ScreenObject:

mSDL::GFX mSDL::Banner mSDL::BG mSDL::Sprite

List of all members.

Public Member Functions

bool isVisible ()
void SetVisible (bool b=true)
void Show ()
void Hide ()
u16 GetPrio () const
 return the object priority
virtual void SetPrio (const u16 NewPrio)
 change the object priority (the higher the most on top)
s16 GetX () const
 return the horizontal screen coordinate of the upper-left corner of the object
s16 GetY () const
 return the vertical screen coordinate of the upper-left corner of the object
s16 GetVX () const
 return the horizontal object velocity
s16 GetVY () const
 return the vertical object velocity
Point GetPosition (void) const
void SetX (const s16 NewX=0)
void SetY (const s16 NewY=0)
virtual void SetXY (const s16 NewX=0, const s16 NewY=0)
void SetVX (const s16 NewVX=0)
void SetVY (const s16 NewVY=0)
void SetVXY (const s16 NewVX=0, const s16 NewVY=0)
bool isMoving () const
virtual void Draw (void)
s16 GetCenterX (void) const
 Return the center's X coordinate of the object.
s16 GetCenterY (void) const
 Return the center's Y coordinate of the object.
u16 Distance (const ScreenObject &Another) const
 Compute the distance (in pixels) between the centers of two screen objects (member version).
s16 Angle (const ScreenObject &Another) const
 Compute the angle (in degrees) between the centers of two screen objects (member version).
bool CollisionRect (const ScreenObject &Another, u16 Range=0) const
 Rectangular collision checker (member version).
bool CollisionCirc (const ScreenObject &Another, u16 Range=0) const
 Circular collision checker (member version).
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)

Static Public Member Functions

static void DrawAll (void)

Protected Types

typedef std::multiset
< ScreenObject
*, CompareByPrio > 
MultisetSortedByPrio

Protected Member Functions

 ScreenObject ()
 ~ScreenObject ()
void Move (void)
 change object's position according to current velocities
void Register ()
void Unregister ()
void UpdateFrame (void)
SDL_Rect GetFrameRect () const

Protected Attributes

bool Visible
 if false makes the object invisible. Can be useful in a lot of situations...
s16 X
s16 Y
 current screen position (pixel coords) for Sprites and Banners. For BGs indicate current scrolling position (the upper-left corner).
s16 VX
s16 VY
 velocities (in pixel/sec)
u32 LastMoveTime
 last (SDL) time when position changed
u16 Prio
MultisetSortedByPrio::const_iterator ROs_Pos
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

Static Protected Attributes

static MultisetSortedByPrio RegisteredScreenObjects


Detailed Description

A screen object. It handles objects positioning and drawing on screen.

Member Typedef Documentation

typedef std::multiset<ScreenObject*, CompareByPrio> mSDL::ScreenObject::MultisetSortedByPrio [protected]


Constructor & Destructor Documentation

mSDL::ScreenObject::ScreenObject (  )  [inline, protected]

mSDL::ScreenObject::~ScreenObject (  )  [inline, protected]


Member Function Documentation

s16 mSDL::ScreenObject::Angle ( const ScreenObject Another  )  const [inline]

Compute the angle (in degrees) between the centers of two screen objects (member version).

GFX mSDL::GFX::Clone ( void   )  const [inline, inherited]

bool mSDL::ScreenObject::CollisionCirc ( const ScreenObject Another,
u16  Range = 0 
) const [inline]

Circular collision checker (member version).

bool mSDL::ScreenObject::CollisionRect ( const ScreenObject Another,
u16  Range = 0 
) const [inline]

Rectangular collision checker (member version).

u16 mSDL::ScreenObject::Distance ( const ScreenObject Another  )  const [inline]

Compute the distance (in pixels) between the centers of two screen objects (member version).

virtual void mSDL::ScreenObject::Draw ( void   )  [virtual]

Reimplemented in mSDL::Sprite, mSDL::BG, and mSDL::Banner.

static void mSDL::ScreenObject::DrawAll ( void   )  [static]

void mSDL::GFX::DrawLine ( const u16  X1,
const u16  Y1,
const u16  X2,
const u16  Y2,
SDL_Color  EdgeColor = BLACK,
u8  Thick = 1 
) [inline, inherited]

void mSDL::GFX::DrawRect ( Rect  r,
SDL_Color  FillColor = BLACK 
) [inline, inherited]

u8 mSDL::GFX::GetAlpha (  )  const [inline, inherited]

s16 mSDL::ScreenObject::GetCenterX ( void   )  const [inline]

Return the center's X coordinate of the object.

s16 mSDL::ScreenObject::GetCenterY ( void   )  const [inline]

Return the center's Y coordinate of the object.

u8 mSDL::GFX::GetFPS (  )  [inline, inherited]

u16 mSDL::GFX::GetFrame (  )  const [inline, inherited]

get current frame number (count starts from 0)

SDL_Rect mSDL::GFX::GetFrameRect (  )  const [protected, inherited]

u16 mSDL::GFX::GetHeight (  )  const [inline, inherited]

u8 mSDL::GFX::GetNoFrames (  )  [inline, inherited]

SDL_Color mSDL::GFX::GetPixel ( const u16  X,
const u16  Y 
) const [inline, inherited]

Point mSDL::ScreenObject::GetPosition ( void   )  const [inline]

u16 mSDL::ScreenObject::GetPrio (  )  const [inline]

return the object priority

SDL_Surface* mSDL::GFX::GetSurface (  )  const [inline, inherited]

return the associated SDL Surface for direct manipulation

SDL_Color mSDL::GFX::GetTrans ( void   )  const [inline, inherited]

s16 mSDL::ScreenObject::GetVX (  )  const [inline]

return the horizontal object velocity

s16 mSDL::ScreenObject::GetVY (  )  const [inline]

return the vertical object velocity

u16 mSDL::GFX::GetWidth (  )  const [inline, inherited]

s16 mSDL::ScreenObject::GetX (  )  const [inline]

return the horizontal screen coordinate of the upper-left corner of the object

s16 mSDL::ScreenObject::GetY (  )  const [inline]

return the vertical screen coordinate of the upper-left corner of the object

void mSDL::ScreenObject::Hide (  )  [inline]

bool mSDL::GFX::isAnim (  )  const [inline, inherited]

return true if playing animation

bool mSDL::ScreenObject::isMoving (  )  const [inline]

bool mSDL::ScreenObject::isVisible (  )  [inline]

void mSDL::ScreenObject::Move ( void   )  [protected]

change object's position according to current velocities

void mSDL::GFX::PauseAnim (  )  [inline, inherited]

void mSDL::ScreenObject::Register (  )  [inline, protected]

void mSDL::GFX::Save ( const std::string  Filename  )  const [inline, inherited]

saves this graphical surface into a BMP file.

void mSDL::GFX::SetAlpha ( const u8  NewAlpha = SDL_ALPHA_OPAQUE  )  [inline, inherited]

Parameters:
NewAlpha set the alpha blending. If invoked with no args reset to opaque.

void mSDL::GFX::SetFrame ( const u16  NewFrame = 0  )  [inline, inherited]

set current frame number (count starts from 0, must be < NoFrames)

void mSDL::GFX::SetNoFrames ( const u16  NewNoFrames = 1  )  [inline, inherited]

void mSDL::GFX::SetPixel ( const u16  X,
const u16  Y,
const SDL_Color  Color = BLACK 
) [inline, inherited]

virtual void mSDL::ScreenObject::SetPrio ( const u16  NewPrio  )  [inline, virtual]

change the object priority (the higher the most on top)

Reimplemented in mSDL::Sprite, mSDL::BG, and mSDL::Banner.

void mSDL::GFX::SetSurface ( SDL_Surface *  NewSurface  )  [inline, inherited]

NewSurface is copied and can be safely fred after invocation.

void mSDL::GFX::SetTrans ( const SDL_Color  NewTransparent = NONE  )  [inline, inherited]

Parameters:
NewTransparent set the transparent color. Invoked with no arguments will remove any previously set transparency.

void mSDL::ScreenObject::SetVisible ( bool  b = true  )  [inline]

void mSDL::ScreenObject::SetVX ( const s16  NewVX = 0  )  [inline]

Parameters:
NewVX Set the horizontal speed (in pixel/sec)

void mSDL::ScreenObject::SetVXY ( const s16  NewVX = 0,
const s16  NewVY = 0 
) [inline]

void mSDL::ScreenObject::SetVY ( const s16  NewVY = 0  )  [inline]

Parameters:
NewVY Set the vertical speed (in pixel/sec)

void mSDL::ScreenObject::SetX ( const s16  NewX = 0  )  [inline]

virtual void mSDL::ScreenObject::SetXY ( const s16  NewX = 0,
const s16  NewY = 0 
) [inline, virtual]

Reimplemented in mSDL::Sprite.

void mSDL::ScreenObject::SetY ( const s16  NewY = 0  )  [inline]

void mSDL::ScreenObject::Show (  )  [inline]

void mSDL::GFX::StartAnim (  )  [inline, inherited]

start sprite auto-animation

void mSDL::GFX::StopAnim (  )  [inline, inherited]

void mSDL::ScreenObject::Unregister (  )  [inline, protected]

void mSDL::GFX::UpdateFrame ( void   )  [protected, inherited]


Member Data Documentation

u8 mSDL::GFX::Alpha [protected, inherited]

bool mSDL::GFX::Anim [protected, inherited]

s8 mSDL::GFX::AnimNoLoops [protected, inherited]

u8 mSDL::GFX::FPS [protected, inherited]

u16 mSDL::GFX::Frame [protected, inherited]

u16 mSDL::GFX::H [protected, inherited]

u32 mSDL::GFX::LastFrameTime [protected, inherited]

last (SDL) time when position changed

u8 mSDL::GFX::NoFrames [protected, inherited]

SDL_Surface* mSDL::GFX::OriginalSurface [protected, inherited]

MultisetSortedByPrio::const_iterator mSDL::ScreenObject::ROs_Pos [protected]

bool mSDL::GFX::RotZoomEnabled [protected, inherited]

SDL_Surface* mSDL::GFX::Surface [protected, inherited]

SDL_Color mSDL::GFX::Transparent [protected, inherited]

bool mSDL::ScreenObject::Visible [protected]

if false makes the object invisible. Can be useful in a lot of situations...

velocities (in pixel/sec)

u16 mSDL::GFX::W [protected, inherited]

current screen position (pixel coords) for Sprites and Banners. For BGs indicate current scrolling position (the upper-left corner).


The documentation for this class was generated from the following file:

Generated on Tue May 12 09:01:35 2009 for libmSDL by  doxygen 1.5.9