ow_cell Class Reference

#include <ow_cell.h>

List of all members.

Public Member Functions

 ow_cell (int screenx, int screeny, int boardside, int cellx, int celly)
int countseeds ()
void emptyseeds ()
int addseeds (int seeds)
int takeseeds (int seeds)
void setaction (int action, int timeout)
void setstatus (int status, int timeout)
void update_status_action ()
void set_gfxdata (SDL_Surface *gfxdat)
void draw (SDL_Surface *surface, TTF_Font *font)
cellXY getcellcoordXY ()
void setcellname (string newcellname)
int isOverCoordXY (int coordx, int coordy)
 ~ow_cell ()

Private Attributes

int x
int y
string cellname
SDL_Surface * gfxdata
SDL_Surface * background
int cellstatus
int cellaction
int cellseeds
int statusaction_timeout


Detailed Description

Author:
David Torres <aiken669@gmail.com>

Constructor & Destructor Documentation

ow_cell::ow_cell ( int  screenx,
int  screeny,
int  boardside,
int  cellx,
int  celly 
)

Creates a new 'ow_cell' object.

Parameters:
screenx Xpos of the cell in the draw_gfx screen.
screeny Ypos of the cell in the draw_gfx screen.
boardside Side of the board (BRD_SIDE_NORTH, BRD_SIDE_SOUTH).
cellx Xpos of the specified cell in the board bcells array.
celly Ypos of the specified cell in the board bcells array.
Returns:
New 'ow_cell' object.

ow_cell::~ow_cell (  ) 

Deletes the 'ow_cell' object.


Member Function Documentation

int ow_cell::countseeds (  ) 

Count the number of seeds in the cell.

Returns:
Number of seeds.

void ow_cell::emptyseeds (  ) 

Remove all the seeds from the cell.

int ow_cell::addseeds ( int  seeds  ) 

Add seeds to the cell.

Parameters:
seeds Number of seeds to add to the cell.
Returns:
Count of seeds in the cell after adding the requested cells.

int ow_cell::takeseeds ( int  seeds  ) 

Take/Remove seeds to the cell.

Parameters:
seeds Number of seeds to remove/take from the cell.
Returns:
Count of seeds in the cell after taking/removing the requested cells.

void ow_cell::setaction ( int  action,
int  timeout 
)

Change the 'action' the cell is performing.

Parameters:
action Action currently running in the cell (CELL_ACTION_CANCEL,CELL_ACTION_MOVEL,CELL_ACTION_MOVER,CELL_ACTION_SELECT,CELL_ACTION_NONE).
timeout program loops the cell holds the action before returning to NONE action. -1 if lasts forever.

void ow_cell::setstatus ( int  status,
int  timeout 
)

Change the 'status' of the cell.

Parameters:
status Status of the cell (CELL_STATUS_NORM,CELL_STATUS_GREEN,CELL_STATUS_RED). RED is used for negative status like 'illegal movement' or 'captured cell'. GREEN is used for positive status like 'moving'.
timeout program loops the cell holds the status before returning to NORMAL status. -1 if lasts forever.

void ow_cell::update_status_action (  ) 

Update the status and action of the cell Basically it is used to update cells who has a timeout defined for setstatus() and setaction().

void ow_cell::set_gfxdata ( SDL_Surface *  gfxdat  ) 

Sets the gfx data in SDL format for the draw_gfx method

Parameters:
gfxdat SDL surface containing the graphics for the cell.

void ow_cell::draw ( SDL_Surface *  surface,
TTF_Font *  font 
)

Draw the cell in the surface provided

Parameters:
surface SDL surface where to draw the cell, usually is the screen surface.
font SDL_ttf font used to print out cellname.

cellXY ow_cell::getcellcoordXY (  ) 

Returns a cellXY struct with the cell screen coordinates.

Returns:
cell x,y coordinates struct.

void ow_cell::setcellname ( string  newcellname  ) 

Set the cell name

Parameters:
cellname The new name to be given to the cell

int ow_cell::isOverCoordXY ( int  coordx,
int  coordy 
)

Checks if (coordx,coordy) point position is inside the cell drawing area in the screen.

Parameters:
coordx Xcoordinate of the point to check.
coordy Ycoordinate of the point to check.
Returns:
1 if point is inside cell, 0 if point is outside cell.


The documentation for this class was generated from the following files:
Generated on Sun Jun 22 13:45:47 2008 for Omweso by  doxygen 1.5.3