pull/28/head
parent
bff7eabef5
commit
999855c6e8
@ -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]);
|
||||
}; |
||||
}; |
@ -1,15 +0,0 @@ |
||||
#include "MenuComponent.h" |
||||
#include "Crawler.h" |
||||
|
||||
MenuIconButton::MenuIconButton(geom2d::rect<float>rect,Decal*icon,MenuFunc onClick) |
||||
:MenuComponent(rect,"",onClick),icon(icon) |
||||
{} |
||||
|
||||
void MenuIconButton::Update(Crawler*game){ |
||||
MenuComponent::Update(game); |
||||
} |
||||
|
||||
void MenuIconButton::Draw(Crawler*game,vf2d parentPos){ |
||||
MenuComponent::Draw(game,parentPos); |
||||
game->DrawRotatedDecal(parentPos+rect.middle(),icon,0,icon->sprite->Size()/2); |
||||
} |
@ -0,0 +1,22 @@ |
||||
#pragma once |
||||
#include "MenuComponent.h" |
||||
#include "DEFINES.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_game |
||||
|
||||
class MenuIconButton:public MenuComponent{ |
||||
private: |
||||
Decal*icon; |
||||
public: |
||||
inline MenuIconButton(geom2d::rect<float>rect,Decal*icon,MenuFunc onClick) |
||||
:MenuComponent(rect,"",onClick),icon(icon){} |
||||
protected: |
||||
virtual void inline Update(Crawler*game)override{ |
||||
MenuComponent::Update(game); |
||||
} |
||||
virtual void inline Draw(Crawler*game,vf2d parentPos)override{ |
||||
MenuComponent::Draw(game,parentPos); |
||||
game->DrawRotatedDecal(parentPos+rect.middle(),icon,0,icon->sprite->Size()/2); |
||||
} |
||||
}; |
@ -0,0 +1,24 @@ |
||||
#pragma once |
||||
#include "MenuComponent.h" |
||||
#include "DEFINES.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_game |
||||
|
||||
class MenuLabel:public MenuComponent{ |
||||
public: |
||||
inline MenuLabel(geom2d::rect<float>rect,std::string label) |
||||
:MenuComponent(rect,label,MenuFunc{},false){ |
||||
border=false; |
||||
} |
||||
inline void SetLabel(std::string text){ |
||||
label=text; |
||||
} |
||||
protected: |
||||
virtual void inline Update(Crawler*game)override{ |
||||
MenuComponent::Update(game); |
||||
} |
||||
virtual void inline Draw(Crawler*game,vf2d parentPos)override{ |
||||
MenuComponent::Draw(game,parentPos); |
||||
} |
||||
}; |
@ -0,0 +1,22 @@ |
||||
#pragma once |
||||
#include "olcPixelGameEngine.h" |
||||
|
||||
class Theme{ |
||||
std::string displayName; |
||||
std::string imgPath; |
||||
|
||||
Pixel buttonCol,highlightCol; |
||||
public: |
||||
inline Theme(){} |
||||
inline Theme(std::string displayName,std::string imgPath,Pixel buttonCol,Pixel highlightCol) |
||||
:displayName(displayName),imgPath(imgPath),buttonCol(buttonCol),highlightCol(highlightCol){} |
||||
inline Pixel GetButtonCol(){ |
||||
return buttonCol; |
||||
} |
||||
inline Pixel GetHighlightCol(){ |
||||
return highlightCol; |
||||
} |
||||
inline std::string GetThemeName(){ |
||||
return displayName; |
||||
} |
||||
}; |
@ -0,0 +1,25 @@ |
||||
Themes |
||||
{ |
||||
# Provide the patch image names without the .png extensions. |
||||
|
||||
BlueDefault |
||||
{ |
||||
Name = "9patch" |
||||
|
||||
ButtonColor = 0,0,64,255 |
||||
HighlightColor = 0,200,200,255 |
||||
|
||||
# If set to 0, stretches the edges and center instead of tiling it. |
||||
Tiled = 1 |
||||
} |
||||
Purple |
||||
{ |
||||
Name = "9patch_2" |
||||
|
||||
ButtonColor = 40,16,71,255 |
||||
HighlightColor = 192,128,238,255 |
||||
|
||||
# If set to 0, stretches the edges and center instead of tiling it. |
||||
Tiled = 1 |
||||
} |
||||
} |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
After Width: | Height: | Size: 4.3 KiB |
Loading…
Reference in new issue