Space Walk board game
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.
 
 

57 lines
1.0 KiB

#include "spaceship.h"
#include "window.h"
SpaceShip::SpaceShip() :
color(COLOR_UNSET),
size(SpaceShip::SIZE_UNSET),
planet(PLANET_UNSET) {
}
SpaceShip::SpaceShip(unsigned char color, unsigned char size) :
color(color),
size(size),
planet(PLANET_UNSET) {
}
void SpaceShip::render(Window *window, int y, int x, bool checkPlaced) {
if (checkPlaced && this->planet != PLANET_UNSET) {
return;
}
std::string print = "";
if (this->size == SpaceShip::SMALL) {
print = "S";
}
else if (this->size == SpaceShip::MEDIUM) {
print = "M";
}
else if (this->size == SpaceShip::BIG) {
print = "B";
}
window->print(print, y, x, COLOR_PAIR(this->color));
}
unsigned char SpaceShip::getColor() {
return this->color;
}
void SpaceShip::setColor(unsigned char color) {
this->color = color;
}
unsigned char SpaceShip::getSize() {
return this->size;
}
void SpaceShip::setSize(unsigned char size) {
this->size = size;
}
char SpaceShip::getPlanet() {
return this->planet;
}
void SpaceShip::setPlanet(char planet) {
this->planet = planet;
}