You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdepacman/tdepacman/energizer.cpp

62 lines
878 B

#include "energizer.h"
Energizer::Energizer(Board *b)
{
board = b;
setOn();
actualPosition = OUT;
maxPixmaps = 0;
}
void Energizer::setMaxPixmaps(int max)
{
maxPixmaps = max;
}
void Energizer::setOff()
{
actualState = off;
}
void Energizer::setOn()
{
actualState = on;
actualPix = 0;
}
void Energizer::setPosition(int pos)
{
board->reset(actualPosition, energizer);
actualPosition = pos;
board->set(actualPosition, energizer);
}
energizerState Energizer::state()
{
return actualState;
}
int Energizer::position()
{
return actualPosition;
}
bool Energizer::move()
{
if (actualPosition == OUT)
return FALSE;
if (++actualPix >= maxPixmaps)
actualPix = 0;
return TRUE;
}
int Energizer::pix()
{
if (actualPosition == OUT || actualState == off)
return -1;
return actualPix;
}