develop classes

This commit is contained in:
ProgramSnail 2021-03-24 20:31:44 +03:00
parent 9be0f50790
commit 580ef8ac3c
15 changed files with 62 additions and 22 deletions

View file

@ -0,0 +1,19 @@
#include <vector>
#include "map_entities/cell.hpp"
#include "map_entities/action.hpp"
#include "map_entities/unit_obj.hpp"
#pragma once
namespace map {
class GameMap {
private:
std::vector<std::vector<Cell> > cells;
std::vector<Action*> actions;
std::vector<UnitObj> units;
public:
GameMap() {
}
};
}

View file

@ -1,4 +1,4 @@
#pragma ONCE
#pragma once
namespace map {
class Action {

View file

@ -1 +1,3 @@
#pragma once
// include all actions from folder

View file

@ -1,4 +1,4 @@
#pragma ONCE
#pragma once
namespace map {
enum CellType { // needed to choose final types

View file

@ -1,26 +1,20 @@
#include <utility>
#include <cstdint>
#include "cell.hpp"
#include "../unit/unit.hpp"
#pragma ONCE
#pragma once
namespace map {
class UnitObj {
class UnitObj { // may be useless
private:
Unit* unit;
std::pair<int32_t, int32_t> pos;
std::pair<int32_t, int32_t> size;
using Coord = std::pair<int32_t, int32_t>;
Coord pos;
Coord size;
CellType cellType;
public:
UnitObj(Unit* unit) : unit(unit) {
UnitObj(const Coord& pos, const Coord& size, const CellType& cellType) :
pos(pos), size(size), cellType(cellType) {
}
void updateValues() {
// from unit size, pos
}
void updatePosition() {
// from unit position
}
void updateAll() {

View file

@ -1,14 +1,16 @@
#include <string>
#include "unit_module.hpp"
#pragma ONCE
#pragma once
namespace unit {
class ModuleBuilder {
private:
public:
ModuleBuilder();
Module create();
void config(const std::string& file);
};
}

View file

@ -1 +1,3 @@
#pragma once
// include all modules from folder

View file

@ -1,15 +1,19 @@
#include <vector>
#include "../game_map.hpp"
#include "unit_module.hpp"
#include "unit_memory_elem.hpp"
#pragma ONCE
#pragma once
namespace unit {
class Unit {
private:
std::vector<Module> modules;
std::vector<MemoryElem> memory;
map::GameMap map;
public:
Unit();
void update();
};
}

View file

@ -0,0 +1 @@
#include "unit_builder.hpp"

View file

@ -0,0 +1,16 @@
#include <string>
#include "unit.hpp"
#pragma once
namespace unit {
class UnitBuilder {
private:
public:
UnitBuilder();
Unit create();
void config(std::string& file);
};
}

View file

@ -1,4 +1,4 @@
#pragma ONCE
#pragma once
namespace unit {
struct MemoryElem {

View file

@ -1,6 +1,6 @@
// #include "unit.hpp" // ??
#pragma ONCE
#pragma once
namespace unit {
class Module {

View file

@ -1,6 +1,6 @@
#include <cstdint>
#pragma ONCE
#pragma once
namespace draw {

View file

@ -1,6 +1,6 @@
#include <cstdint>
#pragma ONCE
#pragma once
namespace init {

View file

@ -1,6 +1,6 @@
#include <cstdint>
#pragma ONCE
#pragma once
namespace input {