Skip to content

Commit 55f0155

Browse files
committed
Merge branch 'main' of https://github.com/Jouca/BadgesAPI
2 parents 3e4e1d4 + 8216d6d commit 55f0155

9 files changed

Lines changed: 213 additions & 106 deletions

File tree

.github/workflows/multi-platform.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939
- name: Build the mod
4040
uses: geode-sdk/build-geode-mod@main
4141
with:
42-
sdk: nightly
42+
# sdk: nightly
4343
bindings: geode-sdk/bindings
4444
bindings-ref: main
4545
combine: true
4646
export-pdb: true
4747
target: ${{ matrix.config.target }}
48-
cli: nightly
48+
# cli: nightly
4949

5050
package:
5151
name: Package builds

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.21)
2-
set(CMAKE_CXX_STANDARD 20)
2+
set(CMAKE_CXX_STANDARD 23)
33
set(CMAKE_CXX_STANDARD_REQUIRED ON)
44

55
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class $modify(ProfilePage) {
5858

5959
// your code for create your badge
6060
61-
yourBadge->setID("mycustombadge-badge")
61+
yourBadge->setID("mycustombadge-badge"_spr);
6262
username_menu->addChild(yourBadge);
6363
username_menu->updateLayout();
6464
}
@@ -73,7 +73,7 @@ class $modify(CommentCell) {
7373

7474
// your code for create your badge
7575

76-
yourBadge->setID("mycustombadge-badge")
76+
yourBadge->setID("mycustombadge-badge"_spr);
7777
username_menu->addChild(yourBadge);
7878
username_menu->updateLayout();
7979
}

mod.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"geode": "4.10.0",
2+
"geode": "5.0.0-beta.3",
33
"gd": {
4-
"win": "2.2074",
5-
"android": "2.2074",
6-
"mac": "2.2074",
7-
"ios": "2.2074"
4+
"win": "2.2081",
5+
"mac": "2.2081",
6+
"ios": "2.2081",
7+
"android": "2.2081"
88
},
99
"id": "jouca.badgesapi",
1010
"name": "Badges API",
1111
"version": "v1.4.0",
1212
"developer": "Jouca",
1313
"description": "API mod to integrate badges & optimizing UI",
1414
"dependencies": {
15-
"geode.node-ids": ">=v1.21.1"
15+
"geode.node-ids": ">=v1.22.0"
1616
},
1717
"links": {
1818
"source": "https://github.com/Jouca/BadgesAPI"

src/OldBorder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void OldBorder::setNode(CCNode* node) {
134134
CCNode* content = this->getChildByID("border_content"_spr);
135135

136136
// Can't assume an ID as the node is a user input and may have its ID changed
137-
if (CCNode* oldNode = cocos::getChild<CCNode>(content, 0)) {
137+
if (CCNode* oldNode = content->getChildByIndex<CCNode>(0)) {
138138
// Not going to mess with releasing the node, I'll leave that to the user
139139
oldNode->removeFromParent();
140140
}
@@ -145,7 +145,8 @@ void OldBorder::setNode(CCNode* node) {
145145
}
146146

147147
CCNode* OldBorder::getNode() {
148-
if (CCNode* node = cocos::getChild<CCNode>(this->getChildByID("border_content"_spr), 0)) {
148+
if (!this->getChildByID("border_content"_spr)) return nullptr;
149+
if (CCNode* node = this->getChildByID("border_content"_spr)->getChildByIndex<CCNode>(0)) {
149150
return node;
150151
} else {
151152
return nullptr;

src/badges/BadgeMenu.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
BadgeMenu* BadgeMenu::scene(CCArray* array) {
55
auto popup = new BadgeMenu(array);
66

7-
if (popup && popup->initAnchored(300.0f, 210.0f)) {
7+
if (popup && popup->init()) {
88
popup->autorelease();
99
popup->setZOrder(1000);
1010
popup->show();
@@ -17,7 +17,9 @@ BadgeMenu* BadgeMenu::scene(CCArray* array) {
1717

1818
BadgeMenu::BadgeMenu(CCArray* data) : m_data(data) {}
1919

20-
bool BadgeMenu::setup() {
20+
bool BadgeMenu::init() {
21+
if (!geode::Popup::init(300.0f, 210.0f)) return false;
22+
2123
auto winSize = cocos2d::CCDirector ::sharedDirector()->getWinSize();
2224
auto director = cocos2d::CCDirector::sharedDirector();
2325

@@ -28,7 +30,15 @@ bool BadgeMenu::setup() {
2830

2931
CCObject* obj;
3032
CCArray* cell = CCArray::create();
31-
CCARRAY_FOREACH(m_data, obj) {
33+
// CCARRAY_FOREACH(m_data, obj) {
34+
// cell->addObject(obj);
35+
// if (cell->count() == badges_max) {
36+
// cells.push_back(BadgeMenuCell::create(cell, { 300, 210 }));
37+
// cell = CCArray::create();
38+
// }
39+
// }
40+
for (CCObject* obj : CCArrayExt<CCObject*>(m_data)) {
41+
if (!obj) continue;
3242
cell->addObject(obj);
3343
if (cell->count() == badges_max) {
3444
cells.push_back(BadgeMenuCell::create(cell, { 300, 210 }));

src/badges/BadgeMenu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "../includes.h"
33
#include "../OldBorder.hpp"
44

5-
class BadgeMenu : public Popup<> {
5+
class BadgeMenu : public Popup {
66
protected:
7-
bool setup() override;
7+
bool init() override;
88
public:
99
CCArray* m_data;
1010

src/badges/BadgeMenuCell.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ BadgeMenuCell* BadgeMenuCell::create(CCArray* badges, const CCSize& size) {
66
if (instance && instance->init(size)) {
77
return instance;
88
} else {
9-
CC_SAFE_DELETE(instance);
10-
9+
// CC_SAFE_DELETE(instance);
10+
delete instance;
1111
return nullptr;
1212
}
1313
}

0 commit comments

Comments
 (0)