First commit.
This commit is contained in:
23
include/Com.h
Normal file
23
include/Com.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "Obj.h"
|
||||
|
||||
class Com : public Obj
|
||||
{
|
||||
public:
|
||||
Com();
|
||||
|
||||
Com(std::string id);
|
||||
|
||||
Com(Com&& com) noexcept;
|
||||
|
||||
Com(const Com& com);
|
||||
|
||||
Com& operator=(Com&& com) noexcept;
|
||||
|
||||
Com& operator=(const Com& com);
|
||||
|
||||
virtual void Update();
|
||||
|
||||
virtual void Render();
|
||||
};
|
46
include/Ent.h
Normal file
46
include/Ent.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "Obj.h"
|
||||
#include "Vec2.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Com;
|
||||
|
||||
class Ent : public Obj
|
||||
{
|
||||
private:
|
||||
std::vector<Com*> coms;
|
||||
Vec2 pos;
|
||||
|
||||
public:
|
||||
Ent();
|
||||
|
||||
Ent(std::string id);
|
||||
|
||||
Ent(Ent&& ent) noexcept;
|
||||
|
||||
Ent(const Ent& ent);
|
||||
|
||||
Ent& operator=(Ent&& ent) noexcept;
|
||||
|
||||
Ent& operator=(const Ent& ent);
|
||||
|
||||
bool HasCom(size_t hashId);
|
||||
|
||||
bool HasCom(const std::string& id);
|
||||
|
||||
bool AddCom(Com* newCom);
|
||||
|
||||
Com* GetCom(size_t hashId) const;
|
||||
|
||||
Com* GetCom(const std::string& id) const;
|
||||
|
||||
void SetPos(const Vec2& newPos);
|
||||
|
||||
Vec2 GetPos() const;
|
||||
|
||||
void Update();
|
||||
|
||||
void Render();
|
||||
};
|
44
include/GameLoop.h
Normal file
44
include/GameLoop.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Level;
|
||||
|
||||
class GameLoop
|
||||
{
|
||||
private:
|
||||
std::vector<Level*> lvls;
|
||||
bool running;
|
||||
|
||||
public:
|
||||
GameLoop();
|
||||
|
||||
GameLoop(GameLoop&& gl) noexcept;
|
||||
|
||||
GameLoop(const GameLoop& gl);
|
||||
|
||||
GameLoop& operator=(GameLoop&& gl) noexcept;
|
||||
|
||||
GameLoop& operator=(const GameLoop& gl);
|
||||
|
||||
bool HasLevel(size_t hashId) const;
|
||||
|
||||
bool HasLevel(const std::string& id) const;
|
||||
|
||||
bool AddLevel(Level* newLvl);
|
||||
|
||||
Level* GetLevel(size_t hashId) const;
|
||||
|
||||
Level* GetLevel(const std::string& id) const;
|
||||
|
||||
void Update();
|
||||
|
||||
void Render();
|
||||
|
||||
void Tick();
|
||||
|
||||
void Start();
|
||||
|
||||
void Stop();
|
||||
};
|
16
include/Hash.h
Normal file
16
include/Hash.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
/// A 32-bit FNV-1a hash algorithm.
|
||||
/// @param [in] str The string to hash.
|
||||
/// @returns The resulting hash. Zero if string does not contain any characters.
|
||||
uint32_t Hash_32(const std::string& str);
|
||||
|
||||
/// A 64-bit FNV-1a hash algorithm.
|
||||
/// @param [in] str The string to hash.
|
||||
/// @returns The resulting hash. Zero if string does not contain any characters.
|
||||
uint64_t Hash_64(const std::string& str);
|
||||
|
||||
size_t Hash(const std::string& str);
|
39
include/Level.h
Normal file
39
include/Level.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "Obj.h"
|
||||
#include "Ent.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Level : public Obj
|
||||
{
|
||||
private:
|
||||
std::vector<Ent> ents;
|
||||
|
||||
public:
|
||||
Level();
|
||||
|
||||
Level(std::string id);
|
||||
|
||||
Level(Level&& lvl) noexcept;
|
||||
|
||||
Level(const Level& lvl);
|
||||
|
||||
Level& operator=(Level&& lvl) noexcept;
|
||||
|
||||
Level& operator=(const Level& lvl);
|
||||
|
||||
bool HasEnt(size_t hashId) const;
|
||||
|
||||
bool HasEnt(const std::string& id) const;
|
||||
|
||||
bool AddEnt(Ent newEnt);
|
||||
|
||||
Ent* GetEnt(size_t hashId);
|
||||
|
||||
Ent* GetEnt(const std::string& id);
|
||||
|
||||
virtual void Update();
|
||||
|
||||
virtual void Render();
|
||||
};
|
31
include/Obj.h
Normal file
31
include/Obj.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "Hash.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class Obj
|
||||
{
|
||||
private:
|
||||
size_t hashId;
|
||||
std::string id;
|
||||
|
||||
public:
|
||||
Obj();
|
||||
|
||||
Obj(std::string id);
|
||||
|
||||
Obj(Obj&& obj) noexcept;
|
||||
|
||||
Obj(const Obj& obj);
|
||||
|
||||
Obj& operator=(Obj&& obj) noexcept;
|
||||
|
||||
Obj& operator=(const Obj& obj);
|
||||
|
||||
size_t GetHashId() const;
|
||||
|
||||
void SetId(std::string newId);
|
||||
|
||||
std::string GetId() const;
|
||||
};
|
24
include/Vec2.h
Normal file
24
include/Vec2.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class Vec2
|
||||
{
|
||||
public:
|
||||
size_t x;
|
||||
size_t y;
|
||||
|
||||
Vec2();
|
||||
|
||||
Vec2(size_t scalar);
|
||||
|
||||
Vec2(size_t x, size_t y);
|
||||
|
||||
Vec2(Vec2&& vec) noexcept = default;
|
||||
|
||||
Vec2(const Vec2& vec) = default;
|
||||
|
||||
Vec2& operator=(Vec2&& vec) noexcept = default;
|
||||
|
||||
Vec2& operator=(const Vec2& vec) = default;
|
||||
};
|
54
include/coms/Stats.h
Normal file
54
include/coms/Stats.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "Com.h"
|
||||
|
||||
class Stats : public Com
|
||||
{
|
||||
private:
|
||||
uint8_t level;
|
||||
uint8_t strength;
|
||||
uint8_t dexterity;
|
||||
uint8_t constitution;
|
||||
uint8_t intelligence;
|
||||
uint8_t wisdom;
|
||||
uint8_t charisma;
|
||||
uint8_t maxHealth;
|
||||
uint8_t health;
|
||||
|
||||
public:
|
||||
Stats();
|
||||
|
||||
Stats(uint8_t strength, uint8_t dexterity, uint8_t constitution, uint8_t intelligence, uint8_t wisdom, uint8_t charisma);
|
||||
|
||||
Stats(Stats&& stats) noexcept;
|
||||
|
||||
Stats(const Stats& stats);
|
||||
|
||||
Stats& operator=(Stats&& stats) noexcept;
|
||||
|
||||
Stats& operator=(const Stats& stats);
|
||||
|
||||
uint8_t GetLevel() const;
|
||||
|
||||
uint8_t GetStrength() const;
|
||||
|
||||
uint8_t GetDexterity() const;
|
||||
|
||||
uint8_t GetConstitution() const;
|
||||
|
||||
uint8_t GetIntelligence() const;
|
||||
|
||||
uint8_t GetWisdom() const;
|
||||
|
||||
uint8_t GetCharisma() const;
|
||||
|
||||
uint8_t GetMaxHealth() const;
|
||||
|
||||
void SetHealth(uint8_t newHealth);
|
||||
|
||||
void TakeDmg(uint8_t dmg);
|
||||
|
||||
void Heal(uint8_t heal);
|
||||
|
||||
uint8_t GetHealth() const;
|
||||
};
|
7
include/levels/Plains.h
Normal file
7
include/levels/Plains.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Level.h"
|
||||
|
||||
class Plains : public Level
|
||||
{
|
||||
};
|
Reference in New Issue
Block a user