drawable Class Reference

Abstract class for drawable objects manipulation. More...

#include <drawable.h>

Inheritance diagram for drawable:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 drawable ()
 Default constructor.
virtual ~drawable ()
 Destructor.
u_int16 length () const
 Returns the length of the drawable.
u_int16 height () const
 Returns the height of the drawable.
virtual bool update ()
 Virtual update function, provided for objects which doesn't need one.
virtual bool input_update ()
 Virtual input update function, provided for objects which doesn't need one.
virtual void draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const =0
 Draw the object on the screen.

Protected Member Functions

void set_length (u_int16 l)
 Sets the length of the drawable.
void set_height (u_int16 h)
 Sets the height of the drawable.


Detailed Description

Abstract class for drawable objects manipulation.

This class is designed to allow flexibility in drawable objects manipulation. It also serves as a template when creating your own classes.

It defines the basic virtual methods every drawable object is required to have. When you design such drawable object, make it inherit from this class and overload the virtual functions you wish to use.

The main advantage of this class is that it allows you to manipulate any drawable object (image, animation, mapview...) without caring about it's type, at the little cost of having to use virtual methods.

There are a few methods that are required to be overloaded in your class. The draw method is a must-have. Your object must also take care to set the size of the drawable correctly (the best thing being that it should use the drawable's size as it's own and don't overload the length () and height () methods).

Definition at line 55 of file drawable.h.


Constructor & Destructor Documentation

drawable::drawable (  ) 

Default constructor.

Definition at line 30 of file drawable.cc.

drawable::~drawable (  )  [virtual]

Destructor.

Definition at line 36 of file drawable.cc.


Member Function Documentation

u_int16 drawable::length (  )  const [inline]

Returns the length of the drawable.

Returns:
length of the drawable.

Definition at line 76 of file drawable.h.

u_int16 drawable::height (  )  const [inline]

Returns the height of the drawable.

Returns:
height of the drawable.

Definition at line 87 of file drawable.h.

bool drawable::update (  )  [virtual]

Virtual update function, provided for objects which doesn't need one.

Reimplemented in animation, mapcharacter, mapobject, mapview, and text_bubble.

Definition at line 40 of file drawable.cc.

bool drawable::input_update (  )  [virtual]

Virtual input update function, provided for objects which doesn't need one.

Definition at line 45 of file drawable.cc.

virtual void drawable::draw ( s_int16  x,
s_int16  y,
const drawing_area da_opt = NULL,
surface target = NULL 
) const [pure virtual]

Draw the object on the screen.

Parameters:
x X position where to draw.
y Y position where to draw.
da_opt optional drawing_area to use during the drawing operation.
target pointer to the surface where to draw the drawable. If NULL, draw on the screen.

Implemented in animation, mapcharacter, mapobject, mapsquare_walkable_area, mapview, and surface.

void drawable::set_length ( u_int16  l  )  [inline, protected]

Sets the length of the drawable.

Parameters:
l new length.

Definition at line 125 of file drawable.h.

void drawable::set_height ( u_int16  h  )  [inline, protected]

Sets the height of the drawable.

Parameters:
h new height.

Definition at line 135 of file drawable.h.


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

Generated on Thu Sep 25 18:55:16 2008 for Adonthell by  doxygen 1.5.6