|
|
|
@ -98,11 +98,11 @@ void Menu::Draw(Crawler*game){ |
|
|
|
|
|
|
|
|
|
for(auto&key:buttons){ |
|
|
|
|
for(auto&button:key.second){ |
|
|
|
|
button->Draw(game,upperLeftPos); |
|
|
|
|
button->Draw(game,upperLeftPos,this==Menu::stack.back()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(auto&component:displayComponents){ |
|
|
|
|
component->Draw(game,upperLeftPos); |
|
|
|
|
component->Draw(game,upperLeftPos,this==Menu::stack.back()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -243,27 +243,27 @@ void Menu::DrawScaledWindow(Crawler*game,vf2d menuPos){ |
|
|
|
|
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]}; |
|
|
|
|
|
|
|
|
|
//Upper-Left
|
|
|
|
|
game->DrawPartialDecal(menuPos-patchSize,patchSize,GetPatchPart(0,0).Decal(),{patchSize.x*0,patchSize.y*0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos-patchSize,patchSize,GetPatchPart(0,0).Decal(),{patchSize.x*0,patchSize.y*0},patchSize,GetRenderColor()); |
|
|
|
|
//Upper-Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,-patchSize.y},patchSize,GetPatchPart(2,0).Decal(),{patchSize.x*2,patchSize.y*0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,-patchSize.y},patchSize,GetPatchPart(2,0).Decal(),{patchSize.x*2,patchSize.y*0},patchSize,GetRenderColor()); |
|
|
|
|
//Bottom-Left
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,size.y},patchSize,GetPatchPart(0,2).Decal(),{patchSize.x*0,patchSize.y*2},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,size.y},patchSize,GetPatchPart(0,2).Decal(),{patchSize.x*0,patchSize.y*2},patchSize,GetRenderColor()); |
|
|
|
|
//Bottom-Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,size.y},patchSize,GetPatchPart(2,2).Decal(),{patchSize.x*2,patchSize.y*2},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,size.y},patchSize,GetPatchPart(2,2).Decal(),{patchSize.x*2,patchSize.y*2},patchSize,GetRenderColor()); |
|
|
|
|
//Top
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,-patchSize.y},vf2d{size.x,patchSize.y},GetPatchPart(1,0).Decal(),{patchSize.x*1,patchSize.y*0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,-patchSize.y},vf2d{size.x,patchSize.y},GetPatchPart(1,0).Decal(),{patchSize.x*1,patchSize.y*0},patchSize,GetRenderColor()); |
|
|
|
|
//Left
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,0},vf2d{patchSize.x,size.y},GetPatchPart(0,1).Decal(),{patchSize.x*0,patchSize.y*1},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,0},vf2d{patchSize.x,size.y},GetPatchPart(0,1).Decal(),{patchSize.x*0,patchSize.y*1},patchSize,GetRenderColor()); |
|
|
|
|
//Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,0},vf2d{patchSize.x,size.y},GetPatchPart(2,1).Decal(),{patchSize.x*2,patchSize.y*1},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,0},vf2d{patchSize.x,size.y},GetPatchPart(2,1).Decal(),{patchSize.x*2,patchSize.y*1},patchSize,GetRenderColor()); |
|
|
|
|
//Bottom
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{patchSize.x*1,patchSize.y*2},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{patchSize.x*1,patchSize.y*2},patchSize,GetRenderColor()); |
|
|
|
|
//Center
|
|
|
|
|
if(GetCurrentTheme().HasBackground()){ |
|
|
|
|
Decal*back=GetCurrentTheme().GetBackground(); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,back,{0,0},back->sprite->Size()); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,back,{0,0},back->sprite->Size(),GetRenderColor()); |
|
|
|
|
}else{ |
|
|
|
|
game->DrawPartialDecal(menuPos,size,GetPatchPart(1,1).Decal(),{patchSize.x*1,patchSize.y*1},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,GetPatchPart(1,1).Decal(),{patchSize.x*1,patchSize.y*1},patchSize,GetRenderColor()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -271,27 +271,27 @@ void Menu::DrawTiledWindow(Crawler*game,vf2d menuPos){ |
|
|
|
|
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]}; |
|
|
|
|
|
|
|
|
|
//Upper-Left
|
|
|
|
|
game->DrawPartialDecal(menuPos-patchSize,patchSize,GetPatchPart(0,0).Decal(),{0,0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos-patchSize,patchSize,GetPatchPart(0,0).Decal(),{0,0},patchSize,GetRenderColor()); |
|
|
|
|
//Upper-Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,-patchSize.y},patchSize,GetPatchPart(2,0).Decal(),{0,0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,-patchSize.y},patchSize,GetPatchPart(2,0).Decal(),{0,0},patchSize,GetRenderColor()); |
|
|
|
|
//Bottom-Left
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,size.y},patchSize,GetPatchPart(0,2).Decal(),{0,0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,size.y},patchSize,GetPatchPart(0,2).Decal(),{0,0},patchSize,GetRenderColor()); |
|
|
|
|
//Bottom-Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,size.y},patchSize,GetPatchPart(2,2).Decal(),{0,0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,size.y},patchSize,GetPatchPart(2,2).Decal(),{0,0},patchSize,GetRenderColor()); |
|
|
|
|
//Top
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,-patchSize.y},vf2d{size.x,patchSize.y},GetPatchPart(1,0).Decal(),{0,0},vf2d{size.x,patchSize.y}); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,-patchSize.y},vf2d{size.x,patchSize.y},GetPatchPart(1,0).Decal(),{0,0},vf2d{size.x,patchSize.y},GetRenderColor()); |
|
|
|
|
//Left
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,0},vf2d{patchSize.x,size.y},GetPatchPart(0,1).Decal(),{0,0},vf2d{patchSize.x,size.y}); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{-patchSize.x,0},vf2d{patchSize.x,size.y},GetPatchPart(0,1).Decal(),{0,0},vf2d{patchSize.x,size.y},GetRenderColor()); |
|
|
|
|
//Right
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,0},vf2d{patchSize.x,size.y},GetPatchPart(2,1).Decal(),{0,0},vf2d{patchSize.x,size.y}); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{size.x,0},vf2d{patchSize.x,size.y},GetPatchPart(2,1).Decal(),{0,0},vf2d{patchSize.x,size.y},GetRenderColor()); |
|
|
|
|
//Bottom
|
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{0,0},vf2d{size.x,patchSize.y}); |
|
|
|
|
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{0,0},vf2d{size.x,patchSize.y},GetRenderColor()); |
|
|
|
|
//Center
|
|
|
|
|
if(GetCurrentTheme().HasBackground()){ |
|
|
|
|
Decal*back=GetCurrentTheme().GetBackground(); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,back,{0,0},size); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,back,{0,0},size,GetRenderColor()); |
|
|
|
|
}else{ |
|
|
|
|
game->DrawPartialDecal(menuPos,size,GetPatchPart(1,1).Decal(),{0,0},patchSize); |
|
|
|
|
game->DrawPartialDecal(menuPos,size,GetPatchPart(1,1).Decal(),{0,0},patchSize,GetRenderColor()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -301,4 +301,13 @@ Renderable&Menu::GetPatchPart(int x,int y){ |
|
|
|
|
|
|
|
|
|
Theme&Menu::GetCurrentTheme(){ |
|
|
|
|
return themes[themeSelection]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Pixel Menu::GetRenderColor(){ |
|
|
|
|
bool focused=Menu::stack.back()==this; |
|
|
|
|
Pixel col=WHITE; |
|
|
|
|
if(!focused){ |
|
|
|
|
col=WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F; |
|
|
|
|
} |
|
|
|
|
return col; |
|
|
|
|
} |