geode/loader/include/Geode/ui/General.hpp

48 lines
1.5 KiB
C++
Raw Normal View History

2022-10-16 14:37:18 -04:00
#pragma once
#include <Geode/DefaultInclude.hpp>
#include <cocos2d.h>
namespace geode {
/**
2022-10-30 14:59:20 -04:00
* Creates the usual blue gradient BG for a layer. You should use this over
* creating the sprite manually, as in the future we may provide texture
2022-10-16 14:37:18 -04:00
* packs the ability to override this function.
*/
GEODE_DLL cocos2d::CCSprite* createLayerBG();
2024-02-21 19:04:38 -05:00
enum class SideArt {
BottomLeft = 0b0001,
BottomRight = 0b0010,
TopLeft = 0b0100,
TopRight = 0b1000,
Bottom = 0b0011,
Top = 0b1100,
All = 0b1111,
};
constexpr SideArt operator|(SideArt a, SideArt b) {
return static_cast<SideArt>(static_cast<int>(a) | static_cast<int>(b));
}
constexpr bool operator&(SideArt a, SideArt b) {
return static_cast<bool>(static_cast<int>(a) & static_cast<int>(b));
}
/**
* Add side art (corner pieces) for a layer
* @param to Layer to add corner pieces to
* @param sides Which corners to populate; by default, populates all
* @param useAnchorLayout If true, `to` is given an `AnchorLayout` and the
* corners' positions are dynamically updated
*/
GEODE_DLL void addSideArt(cocos2d::CCNode* to, SideArt sides = SideArt::All, bool useAnchorLayout = false);
/**
* Add the rounded comment borders to a node
*/
GEODE_DLL void addListBorders(
cocos2d::CCNode* to,
cocos2d::CCPoint const& center,
cocos2d::CCSize const& size
);
2022-10-16 14:37:18 -04:00
}