Proper theming controls added, attributes are now an inheritable interface for anything.

This commit is contained in:
2023-10-03 02:34:26 -05:00
parent bff7eabef5
commit 999855c6e8
24 changed files with 289 additions and 122 deletions
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "olcPixelGameEngine.h"
#include "MonsterAttribute.h"
#include "DEFINES.h"
#include <variant>
class IAttributable{
protected:
std::map<Attribute,std::variant<VARIANTS>>attributes;
inline float&GetFloat(Attribute a){
if(attributes.count(a)==0){
attributes[a]=0.f;
}
return std::get<float>(attributes[a]);
};
inline int&GetInt(Attribute a){
if(attributes.count(a)==0){
attributes[a]=0;
}
return std::get<int>(attributes[a]);
};
inline std::string&GetString(Attribute a){
if(attributes.count(a)==0){
attributes[a]="";
}
return std::get<std::string>(attributes[a]);
};
inline bool&GetBool(Attribute a){
if(attributes.count(a)==0){
attributes[a]=false;
}
return std::get<bool>(attributes[a]);
};
inline vf2d&GetVf2d(Attribute a){
if(attributes.count(a)==0){
attributes[a]=vf2d{};
}
return std::get<vf2d>(attributes[a]);
};
};