Proper theming controls added, attributes are now an inheritable interface for anything.
This commit is contained in:
@@ -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]);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user