Bottom Action Bar

This commit is contained in:
Kae 2023-07-30 00:11:16 +10:00
parent 40a2fe57e0
commit 057f3727de
3 changed files with 30 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,7 @@
{ // gets merged over actionbar.config - game flips it all, this is just for the text and icons in the sprite
"paneLayout" : {
"background" : {
"fileBody" : "/interface/actionbar/actionbarbottombg.png"
}
}
}

View File

@ -12,6 +12,7 @@
#include "StarPlayer.hpp"
#include "StarPlayerInventory.hpp"
#include "StarAssets.hpp"
#include "StarImageMetadataDatabase.hpp"
#include "StarItem.hpp"
#include "StarMerchantInterface.hpp"
@ -50,7 +51,29 @@ ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) {
swapCustomBar();
});
auto configuration = Root::singleton().configuration();
bool bottomBar = configuration->getPath("inventory.bottomActionBar").optBool().value(false);
if (bottomBar)
m_config = jsonMerge(m_config, assets->json("/interface/windowconfig/actionbarbottom.config"));
reader.construct(m_config.get("paneLayout"), this);
if (bottomBar) {
setAnchor(PaneAnchor::CenterBottom);
m_anchorOffset[1] *= -1;
if (!m_bgBody.empty())
m_bgBody += "?flipy";
if (!m_bgHeader.empty())
m_bgHeader += "?flipy";
if (!m_bgFooter.empty())
m_bgFooter += "?flipy";
swap(m_bgHeader, m_bgFooter);
for (auto& child : m_members) {
auto position = child->relativePosition();
child->setPosition({position[0], m_bodySize[1] - position[1] - child->size()[1] + 1});
}
}
for (uint8_t i = 0; i < m_player->inventory()->customBarIndexes(); ++i) {
auto customBarLeft = fetchChild<ItemSlotWidget>(strf("customBar{}L", i + 1));