diff --git a/Crawler/Attributable.h b/Crawler/Attributable.h new file mode 100644 index 00000000..bbbd5ad5 --- /dev/null +++ b/Crawler/Attributable.h @@ -0,0 +1,40 @@ +#pragma once +#include "olcPixelGameEngine.h" +#include "MonsterAttribute.h" +#include "DEFINES.h" +#include + +class IAttributable{ +protected: + std::map>attributes; + inline float&GetFloat(Attribute a){ + if(attributes.count(a)==0){ + attributes[a]=0.f; + } + return std::get(attributes[a]); + }; + inline int&GetInt(Attribute a){ + if(attributes.count(a)==0){ + attributes[a]=0; + } + return std::get(attributes[a]); + }; + inline std::string&GetString(Attribute a){ + if(attributes.count(a)==0){ + attributes[a]=""; + } + return std::get(attributes[a]); + }; + inline bool&GetBool(Attribute a){ + if(attributes.count(a)==0){ + attributes[a]=false; + } + return std::get(attributes[a]); + }; + inline vf2d&GetVf2d(Attribute a){ + if(attributes.count(a)==0){ + attributes[a]=vf2d{}; + } + return std::get(attributes[a]); + }; +}; \ No newline at end of file diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 5365149d..432f5ac8 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -68,6 +68,9 @@ Crawler::Crawler() std::string MONSTERSTRATEGIES_CONFIG = CONFIG_PATH + "monsterstrategies_config"_S; utils::datafile::Read(DATA,MONSTERSTRATEGIES_CONFIG); + std::string THEMES_CONFIG = CONFIG_PATH + "themes_config"_S; + utils::datafile::Read(DATA,THEMES_CONFIG); + DEBUG_PATHFINDING="debug_pathfinding"_I; for(std::string&cl:DATA.GetProperty("class_list").GetValues()){ @@ -1685,23 +1688,31 @@ void Crawler::InitializeGraphics(){ } } - //Specifically split up the 9 patch image into multiple pieces. - Renderable&patchImg=GFX["GFX_Prefix"_S+"Images.GFX_9Patch"_S]; - Pixel::Mode prevMode=GetPixelMode(); - SetPixelMode(Pixel::Mode::MASK); - for(int x=0;x<3;x++){ - for(int y=0;y<3;y++){ - std::string patchKey="9patch_"+std::to_string(x)+std::to_string(y)+".png"; - GFX[patchKey].Create("Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1],false,false); - SetDrawTarget(GFX[patchKey].Sprite()); - Clear(BLANK); - DrawPartialSprite({0,0},patchImg.Sprite(),{x*"Interface.9PatchSize"_i[0],y*"Interface.9PatchSize"_i[1]},{"Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1]}); - GFX[patchKey].Decal()->Update(); - SetDrawTarget(nullptr); + //Specifically split up the 9 patch image into multiple pieces for each theme. + for(auto&key:DATA["Themes"].GetKeys()){ + std::string themeName=key.first; + std::string imgPath=DATA["Themes"][themeName]["Name"].GetString(); + Renderable&patchImg=GFX["theme_img_directory"_S+imgPath+".png"]; + Pixel::Mode prevMode=GetPixelMode(); + SetPixelMode(Pixel::Mode::MASK); + for(int x=0;x<3;x++){ + for(int y=0;y<3;y++){ + std::string patchKey=imgPath+"_"+std::to_string(x)+std::to_string(y)+".png"; + GFX[patchKey].Create("Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1],false,false); + SetDrawTarget(GFX[patchKey].Sprite()); + Clear(BLANK); + DrawPartialSprite({0,0},patchImg.Sprite(),{x*"Interface.9PatchSize"_i[0],y*"Interface.9PatchSize"_i[1]},{"Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1]}); + GFX[patchKey].Decal()->Update(); + SetDrawTarget(nullptr); + } } + SetPixelMode(prevMode); + Menu::themes[imgPath]=Theme{themeName,imgPath,DATA["Themes"][themeName]["ButtonColor"].GetPixel(),DATA["Themes"][themeName]["HighlightColor"].GetPixel()}; + std::cout<<"Theme "< + @@ -270,6 +271,8 @@ + + @@ -290,6 +293,7 @@ + @@ -314,7 +318,6 @@ - @@ -351,6 +354,7 @@ + diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters index bf7be552..732ddc70 100644 --- a/Crawler/Crawler.vcxproj.filters +++ b/Crawler/Crawler.vcxproj.filters @@ -43,6 +43,9 @@ {f90a901c-026c-4c22-9fab-58927f1e5536} + + {45ecf440-1472-4e9a-a4d9-e9eac538a2b0} + @@ -144,15 +147,27 @@ Header Files - - Header Files - - - Header Files - Header Files + + Header Files + + + Header Files\Interface + + + Header Files\Interface + + + Header Files\Interface + + + Header Files\Interface + + + Source Files + @@ -275,9 +290,6 @@ Source Files\Interface - - Source Files\Interface - @@ -329,6 +341,9 @@ Documentation + + Configurations\GFX + diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp index a93ee8d1..9d5450b5 100644 --- a/Crawler/Menu.cpp +++ b/Crawler/Menu.cpp @@ -6,6 +6,8 @@ bool Menu::MOUSE_NAVIGATION=true; std::vectorMenu::stack; std::mapMenu::menus; +std::string Menu::themeSelection="9patch"; +safemapMenu::themes; INCLUDE_GFX @@ -24,11 +26,21 @@ void Menu::InitializeMenus(){ std::cout<<"WARNING! Menu Type "<rect.pos.y].push_back(button); +void Menu::AddComponent(std::string key,MenuComponent*button){ + if(button->selectable){ + buttons[button->rect.pos.y].push_back(button); + }else{ + displayComponents.push_back(button); + } + if(components.count(key)){ + std::cout<<"WARNING! Key "<Update(game); } } + for(auto&component:displayComponents){ + component->Update(game); + } }; void Menu::Draw(Crawler*game){ @@ -86,6 +101,9 @@ void Menu::Draw(Crawler*game){ button->Draw(game,upperLeftPos); } } + for(auto&component:displayComponents){ + component->Draw(game,upperLeftPos); + } }; void Menu::OpenMenu(MenuType menu){ @@ -272,5 +290,5 @@ void Menu::DrawTiledWindow(Crawler*game,vf2d menuPos){ } Renderable&Menu::GetPatchPart(int x,int y){ - return GFX["9patch_"+std::to_string(x)+std::to_string(y)+".png"]; + return GFX[themeSelection+"_"+std::to_string(x)+std::to_string(y)+".png"]; } \ No newline at end of file diff --git a/Crawler/Menu.h b/Crawler/Menu.h index 8b2626cb..34126e19 100644 --- a/Crawler/Menu.h +++ b/Crawler/Menu.h @@ -2,31 +2,36 @@ #include "MenuComponent.h" #include "olcPixelGameEngine.h" #include - -#define MENUFUNC [](Menu&menu,Crawler*game) +#include "safemap.h" +#include "Theme.h" +#include "Attributable.h" class Crawler; -class Menu{ +class Menu:IAttributable{ friend class Crawler; friend class Player; static bool MOUSE_NAVIGATION; static std::mapmenus; std::map>buttons; //Buttons are stored in rows followed by their column order. + std::vectordisplayComponents; //Components that are only for displaying purposes. + safemapcomponents; //A friendly way to interrogate any component we are interested in. vi2d selection={-1,-1}; vf2d size; //Size in tiles (24x24), every menu will be tile-based bool scaled=false; //Whether or not the patch border is supposed to be scaled or tiled. public: Menu(); Menu(vf2d size); - void AddComponent(MenuComponent*button); + void AddComponent(std::string key,MenuComponent*button); void Update(Crawler*game); void Draw(Crawler*game); void SetScaledPatchBorder(bool scaled); static void InitializeMenus(); static void OpenMenu(MenuType menu); static std::vectorstack; + static std::string themeSelection; + static safemapthemes; private: void MenuSelect(Crawler*game); static const Menu InitializeTestMenu(); diff --git a/Crawler/MenuComponent.cpp b/Crawler/MenuComponent.cpp index 4f3e8e3a..3186a8fd 100644 --- a/Crawler/MenuComponent.cpp +++ b/Crawler/MenuComponent.cpp @@ -1,11 +1,11 @@ #include "Crawler.h" #include "Menu.h" -MenuComponent::MenuComponent(geom2d::rectrect,std::string label,MenuFunc onClick) - :rect(rect),label(label),menuDest(MenuType::ENUM_END),onClick(onClick),hoverEffect(0){} +MenuComponent::MenuComponent(geom2d::rectrect,std::string label,MenuFunc onClick,bool selectable) + :rect(rect),label(label),menuDest(MenuType::ENUM_END),onClick(onClick),hoverEffect(0),selectable(selectable){} -MenuComponent::MenuComponent(geom2d::rectrect,std::string label,MenuType menuDest,MenuFunc onClick) - :rect(rect),label(label),menuDest(menuDest),onClick(onClick),hoverEffect(0){} +MenuComponent::MenuComponent(geom2d::rectrect,std::string label,MenuType menuDest,MenuFunc onClick,bool selectable) + :rect(rect),label(label),menuDest(menuDest),onClick(onClick),hoverEffect(0),selectable(selectable){} void MenuComponent::Update(Crawler*game){ if(hovered){ @@ -16,7 +16,9 @@ void MenuComponent::Update(Crawler*game){ } void MenuComponent::Draw(Crawler*game,vf2d parentPos){ - game->FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(VERY_DARK_BLUE,CYAN,hoverEffect)); - game->DrawRectDecal(rect.pos+parentPos,rect.size,GREY); + game->FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect)); + if(border){ + game->DrawRectDecal(rect.pos+parentPos,rect.size,GREY); + } game->DrawStringPropDecal(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label); } \ No newline at end of file diff --git a/Crawler/MenuComponent.h b/Crawler/MenuComponent.h index 96fdb4cc..bbc67ce9 100644 --- a/Crawler/MenuComponent.h +++ b/Crawler/MenuComponent.h @@ -9,26 +9,18 @@ class Crawler; class MenuComponent{ friend class Menu; MenuType menuDest; - std::string label; MenuFunc onClick; bool hovered=false; + bool selectable=true; private: float hoverEffect=0; protected: geom2d::rectrect; + std::string label; + bool border=true; public: - MenuComponent(geom2d::rectrect,std::string label,MenuFunc onClick); - MenuComponent(geom2d::rectrect,std::string label,MenuType menuDest,MenuFunc onClick); + MenuComponent(geom2d::rectrect,std::string label,MenuFunc onClick,bool selectable=true); + MenuComponent(geom2d::rectrect,std::string label,MenuType menuDest,MenuFunc onClick,bool selectable=true); virtual void Update(Crawler*game); virtual void Draw(Crawler*game,vf2d parentPos); -}; - -class MenuIconButton:public MenuComponent{ -private: - Decal*icon; -public: - MenuIconButton(geom2d::rectrect,Decal*icon,MenuFunc onClick); -protected: - virtual void Update(Crawler*game)override; - virtual void Draw(Crawler*game,vf2d parentPos)override; }; \ No newline at end of file diff --git a/Crawler/MenuIconButton.cpp b/Crawler/MenuIconButton.cpp deleted file mode 100644 index e1377ec0..00000000 --- a/Crawler/MenuIconButton.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "MenuComponent.h" -#include "Crawler.h" - -MenuIconButton::MenuIconButton(geom2d::rectrect,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); -} \ No newline at end of file diff --git a/Crawler/MenuIconButton.h b/Crawler/MenuIconButton.h new file mode 100644 index 00000000..582f3ad8 --- /dev/null +++ b/Crawler/MenuIconButton.h @@ -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::rectrect,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); + } +}; \ No newline at end of file diff --git a/Crawler/MenuLabel.h b/Crawler/MenuLabel.h new file mode 100644 index 00000000..476eaad3 --- /dev/null +++ b/Crawler/MenuLabel.h @@ -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::rectrect,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); + } +}; \ No newline at end of file diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index 8e0504cb..ced39ee0 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -401,41 +401,6 @@ void Monster::SetSize(float newSize,bool immediate){ } } -float&Monster::GetFloat(Attribute a){ - if(attributes.count(a)==0){ - attributes[a]=0.f; - } - return std::get(attributes[a]); -} - -int&Monster::GetInt(Attribute a){ - if(attributes.count(a)==0){ - attributes[a]=0; - } - return std::get(attributes[a]); -} - -std::string&Monster::GetString(Attribute a){ - if(attributes.count(a)==0){ - attributes[a]=""; - } - return std::get(attributes[a]); -} - -bool&Monster::GetBool(Attribute a){ - if(attributes.count(a)==0){ - attributes[a]=false; - } - return std::get(attributes[a]); -} - -vf2d&Monster::GetVf2d(Attribute a){ - if(attributes.count(a)==0){ - attributes[a]=vf2d{}; - } - return std::get(attributes[a]); -} - void Monster::SetZ(float z){ this->z=z; } diff --git a/Crawler/Monster.h b/Crawler/Monster.h index bbb938bf..03f95f07 100644 --- a/Crawler/Monster.h +++ b/Crawler/Monster.h @@ -6,7 +6,7 @@ #include "olcUTIL_Animate2D.h" #include "DamageNumber.h" #include "DEFINES.h" -#include +#include "Attributable.h" struct Player; class Crawler; @@ -56,7 +56,7 @@ struct MonsterData{ }; -struct Monster{ +struct Monster:IAttributable{ friend struct STRATEGY; private: int id=0; @@ -93,7 +93,6 @@ private: int phase=0; bool diesNormally=true; //If set to false, the monster death is handled in a special way. Set it to true when it's time to die. float targetSize=0; - std::map>attributes; bool isBoss=false; protected: public: @@ -142,11 +141,6 @@ public: void SetZ(float z); std::string GetStrategy(); void SetSize(float newSize,bool immediate=true); - float&GetFloat(Attribute a); - int&GetInt(Attribute a); - std::string&GetString(Attribute a); - bool&GetBool(Attribute a); - vf2d&GetVf2d(Attribute a); void SetStrategyDrawFunction(std::functionfunc); std::functionstrategyDraw=[](Crawler*pge){}; private: diff --git a/Crawler/MonsterAttribute.h b/Crawler/MonsterAttribute.h index 13d4c09a..aadcf67d 100644 --- a/Crawler/MonsterAttribute.h +++ b/Crawler/MonsterAttribute.h @@ -27,4 +27,5 @@ enum class Attribute{ PHASE_REPEAT_COUNT, JUMP_TOWARDS_PLAYER, HITS_UNTIL_DEATH, //When this is set, it is reduced by 1 each time the monster is hit. + INDEXED_THEME, }; \ No newline at end of file diff --git a/Crawler/TestMenu.cpp b/Crawler/TestMenu.cpp index 0e995f59..89915c51 100644 --- a/Crawler/TestMenu.cpp +++ b/Crawler/TestMenu.cpp @@ -8,19 +8,19 @@ const Menu Menu::InitializeTestMenu(){ menu.stack.clear(); }; - testMenu.AddComponent(new MenuComponent({{24*1,24*1},{24*2,24*1}},"Close",quitWindow)); + testMenu.AddComponent("Close",new MenuComponent({{24*1,24*1},{24*2,24*1}},"Close",quitWindow)); MenuFunc doNothing=[](Menu&menu,Crawler*game){}; - testMenu.AddComponent(new MenuComponent({{24*4,24*1},{24*3,24*1}},"Test",doNothing)); + testMenu.AddComponent("Test",new MenuComponent({{24*4,24*1},{24*3,24*1}},"Test",doNothing)); MenuFunc HurtPlayer=[](Menu&menu,Crawler*game){ game->GetPlayer()->Hurt(20,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ()); }; - testMenu.AddComponent(new MenuComponent({{24*4,24*3},{24*3,24*1}},"Hurt Player",HurtPlayer)); + testMenu.AddComponent("Hurt Player",new MenuComponent({{24*4,24*3},{24*3,24*1}},"Hurt Player",HurtPlayer)); - testMenu.AddComponent(new MenuComponent({{24*2,24*4.5},{24*4,24*1}},"Open Another\n Menu",TEST_2,doNothing)); + testMenu.AddComponent("Open SubMenu",new MenuComponent({{24*2,24*4.5},{24*4,24*1}},"Open Another\n Menu",TEST_2,doNothing)); return testMenu; } \ No newline at end of file diff --git a/Crawler/TestSubMenu.cpp b/Crawler/TestSubMenu.cpp index d31aad1e..e6e6bea1 100644 --- a/Crawler/TestSubMenu.cpp +++ b/Crawler/TestSubMenu.cpp @@ -3,29 +3,58 @@ #include "DEFINES.h" #include "olcPixelGameEngine.h" #include "safemap.h" +#include "MenuIconButton.h" +#include "MenuLabel.h" INCLUDE_GFX +typedef Attribute A; const Menu Menu::InitializeTestSubMenu(){ Menu testSubMenu({24*4,24*5}); - MenuFunc goBack=MENUFUNC{ + MenuFunc goBack=[](Menu&menu,Crawler*game){ menu.stack.pop_back(); }; - testSubMenu.AddComponent(new MenuComponent({{24*1,24*1},{24*2,24*1}},"Go Back",goBack)); + testSubMenu.AddComponent("BACK",new MenuComponent({{24*1,24*1},{24*2,24*1}},"Go Back",goBack)); - MenuFunc quitWindow=MENUFUNC{ - menu.stack.clear(); + testSubMenu.I(A::INDEXED_THEME)=0; + + MenuFunc themePrev=[](Menu&menu,Crawler*game){ + bool found=false; + menu.I(A::INDEXED_THEME)--; + if(menu.I(A::INDEXED_THEME)<0){ + menu.I(A::INDEXED_THEME)=themes.size()-1; + } + int index=0; + for(auto&theme:Menu::themes){ + if(index==menu.I(A::INDEXED_THEME)){ + Menu::themeSelection=theme.first; + ((MenuLabel*)(menu.components["THEME_DISPLAY"]))->SetLabel("Theme\n"+Menu::themes[themeSelection].GetThemeName()); + break; + } + index++; + } }; - testSubMenu.AddComponent(new MenuComponent({{24*1,24*3},{24*3,24*1}},"Close Window",quitWindow)); + testSubMenu.AddComponent("PREV_THEME",new MenuComponent({{24*-0.5,24*3},{24*1,24*1}},"<",themePrev)); - MenuFunc restoreMana=MENUFUNC{ - game->GetPlayer()->SetMana(game->GetPlayer()->GetMaxMana()); + testSubMenu.AddComponent("THEME_DISPLAY",new MenuLabel({{24*0.5,24*3},{24*3,24*1}},"Theme\n"+Menu::themes[themeSelection].GetThemeName())); + + MenuFunc themeNext=[](Menu&menu,Crawler*game){ + menu.I(A::INDEXED_THEME)=(size_t(menu.I(A::INDEXED_THEME))+1)%themes.size(); + int index=0; + for(auto&theme:Menu::themes){ + if(index==menu.I(A::INDEXED_THEME)){ + Menu::themeSelection=theme.first; + ((MenuLabel*)(menu.components["THEME_DISPLAY"]))->SetLabel("Theme\n"+Menu::themes[themeSelection].GetThemeName()); + break; + } + index++; + } }; - testSubMenu.AddComponent(new MenuIconButton({{24*0,24*3},{24*1,24*2}},GFX["mana.png"].Decal(),restoreMana)); + testSubMenu.AddComponent("NEXT_THEME",new MenuComponent({{24*3.5,24*3},{24*1,24*1}},">",themeNext)); return testSubMenu; } \ No newline at end of file diff --git a/Crawler/Theme.h b/Crawler/Theme.h new file mode 100644 index 00000000..6432f459 --- /dev/null +++ b/Crawler/Theme.h @@ -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; + } +}; \ No newline at end of file diff --git a/Crawler/Version.h b/Crawler/Version.h index b641166d..e2c778e1 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 1651 +#define VERSION_BUILD 1676 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/configuration.txt b/Crawler/assets/config/configuration.txt index cee078d9..81949743 100644 --- a/Crawler/assets/config/configuration.txt +++ b/Crawler/assets/config/configuration.txt @@ -27,6 +27,12 @@ monsters_config = Monsters.txt # Monster Strategy Config monsterstrategies_config = MonsterStrategies.txt +# Interface Theme Config +themes_config = gfx/themes.txt + +# Path to theme image files +theme_img_directory = themes/ + # Path to class configuration files class_directory = classes/ diff --git a/Crawler/assets/config/gfx/gfx.txt b/Crawler/assets/config/gfx/gfx.txt index 21b97883..318880a1 100644 --- a/Crawler/assets/config/gfx/gfx.txt +++ b/Crawler/assets/config/gfx/gfx.txt @@ -39,7 +39,8 @@ Images GFX_SkillOverlayIcon = skill_overlay_icon.png GFX_SkillOverlayIconOverlay = skill_overlay_icon_overlay.png - GFX_9Patch = 9patch.png + GFX_9Patch = themes/9patch.png + GFX_9Patch2 = themes/9patch_2.png # Ability Icons GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png diff --git a/Crawler/assets/config/gfx/themes.txt b/Crawler/assets/config/gfx/themes.txt new file mode 100644 index 00000000..44175e14 --- /dev/null +++ b/Crawler/assets/config/gfx/themes.txt @@ -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 + } +} \ No newline at end of file diff --git a/Crawler/assets/9patch.png b/Crawler/assets/themes/9patch.png similarity index 100% rename from Crawler/assets/9patch.png rename to Crawler/assets/themes/9patch.png diff --git a/Crawler/assets/themes/9patch_2.png b/Crawler/assets/themes/9patch_2.png new file mode 100644 index 00000000..563f33e6 Binary files /dev/null and b/Crawler/assets/themes/9patch_2.png differ diff --git a/Crawler/olcUTIL_DataFile.h b/Crawler/olcUTIL_DataFile.h index 219ad087..506ccb3b 100644 --- a/Crawler/olcUTIL_DataFile.h +++ b/Crawler/olcUTIL_DataFile.h @@ -119,6 +119,10 @@ namespace olc::utils SetString(std::to_string(n), nItem); } + inline Pixel GetPixel(const size_t nItem = 0){ + return {uint8_t(GetInt(nItem)),uint8_t(GetInt(nItem+1)),uint8_t(GetInt(nItem+2)),uint8_t(GetInt(nItem+3))}; + } + // Returns the number of Values a property consists of inline size_t GetValueCount() const { @@ -429,6 +433,8 @@ namespace olc::utils } // File not found, so fail + std::cout<<"WARNING! Could not open file "<