Inital Commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 4.2)
|
||||
|
||||
project(Editor)
|
||||
|
||||
set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/editor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/playerEditor.cpp)
|
||||
|
||||
add_library(Editor SHARED ${SOURCES})
|
||||
target_include_directories(Editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/headers ${CMAKE_SOURCE_DIR}/Extern)
|
||||
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 4.2)
|
||||
|
||||
project(Editor)
|
||||
|
||||
set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/editor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/playerEditor.cpp)
|
||||
|
||||
add_library(Editor SHARED ${SOURCES})
|
||||
target_include_directories(Editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/headers)
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum DmgType {SINGLE, MULTI};
|
||||
|
||||
struct Stat
|
||||
{
|
||||
int statID;
|
||||
std::string statName;
|
||||
float stat;
|
||||
};
|
||||
|
||||
class Creature
|
||||
{
|
||||
protected:
|
||||
int id;
|
||||
int level;
|
||||
std::vector<Stat> stats;
|
||||
std::string name;
|
||||
std::string description;
|
||||
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void LevelUp() = 0;
|
||||
virtual void Die() = 0;
|
||||
virtual void TakeDamage(int damageType, float damage) = 0;
|
||||
virtual float GetHealth() = 0;
|
||||
|
||||
|
||||
bool IsAlive() { return GetHealth() > 0; }
|
||||
|
||||
void PrintDescription() { printf("%s\n", description); }
|
||||
void PrintName() { printf("%s\n", name); }
|
||||
|
||||
virtual ~Creature() = default;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "playerEditor.h"
|
||||
|
||||
class Editor
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
class Editor
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "json.hpp"
|
||||
#include "creature.h"
|
||||
|
||||
struct PlayerE : Creature
|
||||
{
|
||||
|
||||
int id;
|
||||
int level;
|
||||
std::vector<Stat> stats;
|
||||
std::string name;
|
||||
std::string description;
|
||||
|
||||
void Init();
|
||||
void LevelUp();
|
||||
void Die();
|
||||
void TakeDamage(int damageType, float damage);
|
||||
float GetHealth();
|
||||
};
|
||||
|
||||
|
||||
class PlayerEditor
|
||||
{
|
||||
private:
|
||||
PlayerE *toEdit;
|
||||
std::vector<PlayerE> players;
|
||||
std::vector<std::string> commands;
|
||||
|
||||
public:
|
||||
void Create();
|
||||
void Edit();
|
||||
bool Save();
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "Extern/json.hpp"
|
||||
#include "Creature.h"
|
||||
|
||||
struct PlayerE : Creature
|
||||
{
|
||||
|
||||
int id;
|
||||
int level;
|
||||
std::vector<Stat> stats;
|
||||
std::string name;
|
||||
std::string description;
|
||||
|
||||
void Init();
|
||||
void LevelUp();
|
||||
void Die();
|
||||
void TakeDamage(int damageType, float damage);
|
||||
float GetHealth();
|
||||
}
|
||||
|
||||
|
||||
class PlayerEditor
|
||||
{
|
||||
private:
|
||||
Player *toEdit;
|
||||
std::vector<PlayerE> players;
|
||||
|
||||
std::vector<std::string> commands;
|
||||
public:
|
||||
void Create();
|
||||
void Edit();
|
||||
|
||||
bool Save();
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
#include "editor.h"
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "playerEditor.h"
|
||||
#include <vector>
|
||||
|
||||
void PlayerEditor::Create()
|
||||
{
|
||||
if (toEdit == nullptr)
|
||||
{
|
||||
toEdit = new PlayerE();
|
||||
}
|
||||
players.push_back(*toEdit);
|
||||
}
|
||||
|
||||
|
||||
void PlayerEditor::Edit()
|
||||
{
|
||||
|
||||
printf("Options: %s\n");
|
||||
for (auto &command : commands.begin())
|
||||
{
|
||||
printf("%s\n", command.c_str());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "playerEditor.h"
|
||||
|
||||
void Create()
|
||||
{
|
||||
if (toEdit == nullptr)
|
||||
{
|
||||
toEdit = new PlayerE();
|
||||
}
|
||||
players.push_back(toEdit);
|
||||
}
|
||||
|
||||
|
||||
void Edit()
|
||||
{
|
||||
|
||||
printf("Options: %s\n");
|
||||
for (auto command : commands.begin())'
|
||||
{
|
||||
printf("%s\n", command.c_str());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user