Global refactoring; add level builder
parent
e8f06c3929
commit
6eac3c84f6
@ -1,31 +1,31 @@
|
||||
#include "entity.h"
|
||||
|
||||
Entity::Entity(coordinate _x, coordinate _y) :
|
||||
pos_x(_x), pos_y(_y)
|
||||
Entity::Entity(coordinate _row, coordinate _col) :
|
||||
entity_row(_row), entity_col(_col)
|
||||
{}
|
||||
|
||||
Entity::~Entity()
|
||||
{}
|
||||
|
||||
/// Get current Entity position
|
||||
void Entity::position(coordinate &x, coordinate &y) const noexcept
|
||||
void Entity::position(coordinate &row, coordinate &col) const noexcept
|
||||
{
|
||||
x = pos_x;
|
||||
y = pos_y;
|
||||
row = entity_row;
|
||||
col = entity_col;
|
||||
}
|
||||
|
||||
void Entity::setPosition(coordinate x, coordinate y)
|
||||
void Entity::setPosition(coordinate row, coordinate col)
|
||||
{
|
||||
pos_x = x;
|
||||
pos_y = y;
|
||||
entity_row = row;
|
||||
entity_col = col;
|
||||
}
|
||||
|
||||
coordinate Entity::x() const noexcept
|
||||
coordinate Entity::row() const noexcept
|
||||
{
|
||||
return pos_x;
|
||||
return entity_row;
|
||||
}
|
||||
|
||||
coordinate Entity::y() const noexcept
|
||||
coordinate Entity::col() const noexcept
|
||||
{
|
||||
return pos_y;
|
||||
return entity_col;
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
#ifndef ENTITY_H
|
||||
#define ENTITY_H
|
||||
|
||||
using coordinate = unsigned int;
|
||||
using coordinate = unsigned long;
|
||||
|
||||
/// Interface representing entity which can be placed on the map
|
||||
class Entity
|
||||
{
|
||||
protected:
|
||||
coordinate pos_x, pos_y;
|
||||
coordinate entity_row, entity_col;
|
||||
|
||||
public:
|
||||
Entity(coordinate _x = 0, coordinate _y = 0);
|
||||
Entity(coordinate _row = 0, coordinate _col = 0);
|
||||
|
||||
virtual ~Entity() = 0;
|
||||
|
||||
/// Get current Entity position
|
||||
void position(coordinate &x, coordinate &y) const noexcept;
|
||||
void position(coordinate &row, coordinate &col) const noexcept;
|
||||
|
||||
/// Set Entity position explicitly
|
||||
void setPosition(coordinate x, coordinate y);
|
||||
void setPosition(coordinate row, coordinate col);
|
||||
|
||||
/// Get current x of the Entity position
|
||||
coordinate x() const noexcept;
|
||||
coordinate row() const noexcept;
|
||||
|
||||
/// Get current y of the Entity position
|
||||
coordinate y() const noexcept;
|
||||
coordinate col() const noexcept;
|
||||
};
|
||||
|
||||
#endif // ENTITY_H
|
||||
|
Loading…
Reference in New Issue