Merge branch 'main' into layout

This commit is contained in:
HJfod 2022-11-27 23:40:46 +02:00
commit 7cdb58878b
6 changed files with 53 additions and 28 deletions
bindings
loader
include/Geode/c++stl
src

View file

@ -1258,6 +1258,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ
void editColor(cocos2d::CCObject* sender) = mac 0x19190, win 0x8d3c0;
void alignObjects(cocos2d::CCArray* objs, bool alignY) = win 0x8f320;
virtual void scrollWheel(float vertical, float horizontal) = win 0x921d0, mac 0x31370, ios 0x2c4884;
void createMoveMenu() = mac 0x275e0, win 0x8c0d0;
EditButtonBar* m_buttonBar;
PAD = mac 0x8, win 0x4;
@ -1515,9 +1516,9 @@ class FLAlertLayer : cocos2d::CCLayerColor {
bool scrollable,
float height
) = mac 0x25e1b0, win 0x228e0;
static FLAlertLayer* create(FLAlertLayerProtocol*, char const*, gd::string, char const*, char const*) = mac 0x25de00, win 0x22680;
static FLAlertLayer* create(FLAlertLayerProtocol*, char const*, gd::string, char const*, char const*, float) = mac 0x25e0e0, win 0x22730, ios 0x1fe374;
static FLAlertLayer* create(FLAlertLayerProtocol*, char const*, gd::string, char const*, char const*, float, bool, float) = mac 0x25dec0, win 0x227e0;
static FLAlertLayer* create(FLAlertLayerProtocol* protocol, char const* title, gd::string content, char const* btn1, char const* btn2) = mac 0x25de00, win 0x22680;
static FLAlertLayer* create(FLAlertLayerProtocol* protocol, char const* title, gd::string content, char const* btn1, char const* btn2, float width) = mac 0x25e0e0, win 0x22730, ios 0x1fe374;
static FLAlertLayer* create(FLAlertLayerProtocol* protocol, char const* title, gd::string content, char const* btn1, char const* btn2, float width, bool scrollable, float height) = mac 0x25dec0, win 0x227e0;
void onBtn1(cocos2d::CCObject*) = mac 0x25ec20, win 0x23340;
void onBtn2(cocos2d::CCObject*) = mac 0x25ec80, win 0x23380;
@ -2026,7 +2027,9 @@ class GJEffectManager : cocos2d::CCNode {
void stopActionsForTrigger(EffectGameObject*) = mac 0x183150;
void stopMoveActionsForGroup(int) = mac 0x1830e0;
void storeTriggeredID(int) = mac 0x185380;
void toggleGroup(int, bool) = mac 0x182c80;
void toggleGroup(int item, bool value) { // mac 0x182c80;
m_groupToggled[item] = value;
}
void traverseInheritanceChain(InheritanceNode*) = mac 0x181850, win 0x11caf0;
void updateActiveOpacityEffects() = mac 0x1847e0;
void updateColorAction(ColorAction*) = mac 0x184560;
@ -5062,6 +5065,7 @@ class SetupTouchTogglePopup : FLAlertLayer {
}
class SimplePlayer : cocos2d::CCSprite {
SimplePlayer() {}
void setSecondColor(const cocos2d::ccColor3B& color) {
m_secondLayer->setColor(color);

View file

@ -448,12 +448,12 @@ namespace gd {
}
}
operator std::vector<bool>() {
std::vector<bool> out;
for (auto i = m_start; i != m_end; ++i) {
out.push_back(*i);
}
return out;
vector(vector<bool> const& lol) : vector(std::vector<bool>(lol)) {}
vector() : vector(std::vector<bool>()) {}
~vector() {
delete[] m_start.m_bitptr;
}
operator std::vector<bool>() const {
@ -464,12 +464,14 @@ namespace gd {
return out;
}
vector(vector<bool> const& lol) : vector(std::vector<bool>(lol)) {}
_bit_reference operator[](size_t index) {
const auto real_index = index / sizeof(uintptr_t);
const auto offset = index % sizeof(uintptr_t);
return _bit_reference(&m_start.m_bitptr[real_index], 1UL << offset);
}
vector() : vector(std::vector<bool>()) {}
~vector() {
delete[] m_start.m_bitptr;
bool operator[](size_t index) const {
return const_cast<vector&>(*this)[index];
}
};
};

View file

@ -126,6 +126,11 @@ void Index::updateIndex(IndexUpdateCallback callback, bool force) {
// gee i sure hope no one does 60 commits to the mod index an hour and download every
// single one of them
if (upcomingCommitSHA == "") {
auto err = this->updateIndexFromLocalCache();
if (!err) {
RETURN_ERROR(err.error());
}
m_upToDate = true;
m_updating = false;

View file

@ -145,8 +145,7 @@ bool ModInfoLayer::init(ModObject* obj, ModListView* list) {
nameLabel->limitLabelWidth(200.f, .7f, .1f);
m_mainLayer->addChild(nameLabel, 2);
auto logoSpr = this->createLogoSpr(obj);
logoSpr->setScale(logoSize / logoSpr->getContentSize().width);
auto logoSpr = this->createLogoSpr(obj, { logoSize, logoSize });
m_mainLayer->addChild(logoSpr);
auto developerStr = "by " + m_info.m_developer;
@ -720,23 +719,25 @@ ModInfoLayer* ModInfoLayer::create(ModObject* obj, ModListView* list) {
return nullptr;
}
CCNode* ModInfoLayer::createLogoSpr(ModObject* modObj) {
CCNode* ModInfoLayer::createLogoSpr(ModObject* modObj, CCSize const& size) {
switch (modObj->m_type) {
case ModObjectType::Mod:
{
return ModInfoLayer::createLogoSpr(modObj->m_mod);
return ModInfoLayer::createLogoSpr(modObj->m_mod, size);
}
break;
case ModObjectType::Index:
{
return ModInfoLayer::createLogoSpr(modObj->m_index);
return ModInfoLayer::createLogoSpr(modObj->m_index, size);
}
break;
default:
{
auto spr = CCSprite::createWithSpriteFrameName("no-logo.png"_spr);
spr->setScaleX(size.width / spr->getContentSize().width);
spr->setScaleY(size.height / spr->getContentSize().height);
if (!spr) {
return CCLabelBMFont::create("OwO", "goldFont.fnt");
}
@ -746,7 +747,7 @@ CCNode* ModInfoLayer::createLogoSpr(ModObject* modObj) {
}
}
CCNode* ModInfoLayer::createLogoSpr(Mod* mod) {
CCNode* ModInfoLayer::createLogoSpr(Mod* mod, CCSize const& size) {
CCNode* spr = nullptr;
if (mod == Loader::getInternalMod()) {
spr = CCSprite::createWithSpriteFrameName("geode-logo.png"_spr);
@ -758,10 +759,12 @@ CCNode* ModInfoLayer::createLogoSpr(Mod* mod) {
}
if (!spr) spr = CCSprite::createWithSpriteFrameName("no-logo.png"_spr);
if (!spr) spr = CCLabelBMFont::create("OwO", "goldFont.fnt");
spr->setScaleX(size.width / spr->getContentSize().width);
spr->setScaleY(size.height / spr->getContentSize().height);
return spr;
}
CCNode* ModInfoLayer::createLogoSpr(IndexItem const& item) {
CCNode* ModInfoLayer::createLogoSpr(IndexItem const& item, CCSize const& size) {
CCNode* spr = nullptr;
auto logoPath = ghc::filesystem::absolute(item.m_path / "logo.png");
spr = CCSprite::create(logoPath.string().c_str());
@ -773,14 +776,26 @@ CCNode* ModInfoLayer::createLogoSpr(IndexItem const& item) {
}
if (Index::get()->isFeaturedItem(item.m_info.m_id)) {
auto glowSize = size + CCSize(4.f, 4.f);
auto logoGlow = CCSprite::createWithSpriteFrameName("logo-glow.png"_spr);
logoGlow->setScaleX(glowSize.width / logoGlow->getContentSize().width);
logoGlow->setScaleY(glowSize.height / logoGlow->getContentSize().height);
// i dont know why + 1 is needed and its too late for me to figure out why
spr->setPosition(
logoGlow->getContentSize().width / 2, logoGlow->getContentSize().height / 2
);
logoGlow->setContentSize(spr->getContentSize());
// scary mathematics
spr->setScaleX(size.width / spr->getContentSize().width / logoGlow->getScaleX());
spr->setScaleY(size.height / spr->getContentSize().height / logoGlow->getScaleY());
logoGlow->addChild(spr);
spr = logoGlow;
}
else {
spr->setScaleX(size.width / spr->getContentSize().width);
spr->setScaleY(size.height / spr->getContentSize().height);
}
return spr;
}

View file

@ -76,7 +76,7 @@ public:
static void showIssueReportPopup(ModInfo const& info);
static CCNode* createLogoSpr(ModObject* modObj);
static CCNode* createLogoSpr(Mod* mod);
static CCNode* createLogoSpr(IndexItem const& item);
static CCNode* createLogoSpr(ModObject* modObj, CCSize const& size);
static CCNode* createLogoSpr(Mod* mod, CCSize const& size);
static CCNode* createLogoSpr(IndexItem const& item, CCSize const& size);
};

View file

@ -164,9 +164,8 @@ void ModCell::loadFromObject(ModObject* modobj) {
auto logoSize = m_height / 1.5f;
auto logoSpr = ModInfoLayer::createLogoSpr(modobj);
auto logoSpr = ModInfoLayer::createLogoSpr(modobj, { logoSize, logoSize });
logoSpr->setPosition({ logoSize / 2 + 12.f, m_height / 2 });
logoSpr->setScale(logoSize / logoSpr->getContentSize().width);
m_mainLayer->addChild(logoSpr);
bool hasCategories = false;