Proper theming controls added, attributes are now an inheritable interface for anything.
This commit is contained in:
+25
-14
@@ -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 "<<themeName<<" Loaded."<<std::endl;
|
||||
}
|
||||
SetPixelMode(prevMode);
|
||||
|
||||
Menu::themes.SetInitialized();
|
||||
std::cout<<Menu::themes.size()<<" themes have been loaded."<<std::endl;
|
||||
GFX.SetInitialized();
|
||||
std::cout<<GFX.size()<<" images have been loaded."<<std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user