From 057f3727deb83a768a45ad3b91282166683e039d Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 30 Jul 2023 00:11:16 +1000 Subject: [PATCH] Bottom Action Bar --- .../interface/actionbar/actionbarbottombg.png | Bin 0 -> 6162 bytes .../windowconfig/actionbarbottom.config | 7 ++++++ source/frontend/StarActionBar.cpp | 23 ++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 assets/opensb/interface/actionbar/actionbarbottombg.png create mode 100644 assets/opensb/interface/windowconfig/actionbarbottom.config diff --git a/assets/opensb/interface/actionbar/actionbarbottombg.png b/assets/opensb/interface/actionbar/actionbarbottombg.png new file mode 100644 index 0000000000000000000000000000000000000000..df7e9e2a1ab0531b9018217a759bd59aa3d233a5 GIT binary patch literal 6162 zcmeHL3wRS%77i;EsI>GGL?|tU6mWS=GBe5KMH)@h7K)^;X;*@7tCP%4n&*Vfv`Oot zKzWFzlvVkV3WD+~OH1kQqOAo*Wn~puD;6s(E7*t#T~x%fh=O}3uO_9qRleQN{dV)E z&CI#y{O6v>J@?$ZB0qO#LVR*OkH<^MnU$&M@dnu7bIOo7_%0@pEP*om=Z&kILZ%w1W+BHukui4r9Lw|qz=BN3rbkltrUs8 zUa!zA7SbMz2vaB&A`}eG~S`aEuUTih#RIJ&wS%DU%2|fD^b_ z2J&JN1<=JhU4*^Qxj3B>ZidY&gJy)h(kC}lSndWQJz(fkj|pUzL5*o)YZz7!dYsx1 zamXGKX07I%$Z{hw4gfyuO<1{+AZsAxT>Mqg1xl?4kSy&fq-lpbm`nL#&-1m~K<@B= zIoIlVwe(#Ut$_eJ`|0D2y(_C=wNnJBumC% z;CLY>RdT5-i^hoIjYXj;tGT>i7(JX3gh*;BwX}ow=x7S4#VS!>{9uKScsm0v}}{kUFvAy@10rguuaqNzo<<-V-`0Nnu8@m_WpGxdg#50G*3T zWC*DMC<;g!)M*T>i301TCeLGq<(zaxafF@TzvuvM3WLiRv0Q<5gGNUKd;0RW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?T zx^LskizjoJe)!O@3*Pu@yB)ICADxg;rtV&ppr7hcPi>x>v*@LTyT3aZ|6KKKq`2vc zdvgsN*Pk5T;7KgHZ#k=a`8iqkwog9n;)bh>x4!Y|LuHF=R||JPF|mHd@UB%WRtqPm zwnGqIYQ>({#eZFUw)J6$|An}QrsHRuL`#cldEE@#H`TsoOhT`n~Tg?$9LE^WQfN zi2H=9(@dLGH=x5RBYek(-O;{9$mUn>;@i^_QS$Q#cW5>oI)=5JxoiI)(5;tJiji&4 zW)-ZP8%Ml7InlPMa{3ziu%!xn^_cb|v~Iy1P&}r6;@F|Kq~)cF4~&jy+K+la)D9-r z$%ffFUqtFxBxq}&*}rMBi#0s`*yy7NZm+BzxoCHy?&xjW+AAfskKdm*xN}ou!&>fQ OJ|`3 literal 0 HcmV?d00001 diff --git a/assets/opensb/interface/windowconfig/actionbarbottom.config b/assets/opensb/interface/windowconfig/actionbarbottom.config new file mode 100644 index 0000000..f13a213 --- /dev/null +++ b/assets/opensb/interface/windowconfig/actionbarbottom.config @@ -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" + } + } +} \ No newline at end of file diff --git a/source/frontend/StarActionBar.cpp b/source/frontend/StarActionBar.cpp index 82eb7d2..acaa3d1 100644 --- a/source/frontend/StarActionBar.cpp +++ b/source/frontend/StarActionBar.cpp @@ -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(strf("customBar{}L", i + 1));