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