Skip to content

Commit 2d853e1

Browse files
authored
Merge pull request #3 from RayDeeUx/main
add mobile suppor for real this time
2 parents 15c2e5e + 39b0ac4 commit 2d853e1

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

.github/workflows/multi-platform.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ jobs:
1818
- name: macOS
1919
os: macos-latest
2020

21+
- name: iOS
22+
os: macos-latest
23+
target: iOS
24+
25+
- name: Android32
26+
os: ubuntu-latest
27+
target: Android32
28+
29+
- name: Android64
30+
os: ubuntu-latest
31+
target: Android64
32+
2133
name: ${{ matrix.config.name }}
2234
runs-on: ${{ matrix.config.os }}
2335

@@ -28,7 +40,6 @@ jobs:
2840
uses: geode-sdk/build-geode-mod@main
2941
with:
3042
bindings: geode-sdk/bindings
31-
bindings-ref: main
3243
combine: true
3344
target: ${{ matrix.config.target }}
3445

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
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)
4-
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
4+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
5+
set(CMAKE_OSX_ARCHITECTURES "arm64")
6+
else()
7+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
8+
endif()
59
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
610

711
project(Attempt-Set VERSION 1.0.0)

mod.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"geode": "4.0.1",
2+
"geode": "4.10.2",
33
"gd": {
44
"win": "2.2074",
5-
"mac": "2.2074"
5+
"mac": "2.2074",
6+
"ios": "2.2074",
7+
"android": "2.2074"
68
},
79
"id": "zsa.edit-attempts",
810
"name": "Edit Attempts",
@@ -12,11 +14,7 @@
1214
"resources": {
1315
"sprites": ["resources/editAttemptsButton.png"]
1416
},
15-
"dependencies": [
16-
{
17-
"id": "geode.node-ids",
18-
"version": "1.17.0",
19-
"importance": "required"
20-
}
21-
]
17+
"dependencies": {
18+
"geode.node-ids": ">=1.17.0"
19+
}
2220
}

src/main.cpp

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,32 @@ class ModifyAttemptCountPopup : public geode::Popup<GJGameLevel*> {
3232
}
3333
void onSetButtonClick(CCObject* sender){
3434
if(inputNode->getString().empty()){return;}
35-
try {
36-
int val = std::stoi(inputNode->getString());
35+
int val = geode::numFromString<int>(inputNode->getString()).unwrapOr(-1);
36+
if (val > -1) {
3737
setAttempts(val);
38-
this->removeMeAndCleanup();
39-
} catch (const std::invalid_argument& e) {
40-
log::warn("Input is not a valid integer");
41-
} catch (const std::out_of_range& e) {
42-
log::warn("Input is out of range");
38+
this->onClose(nullptr);
39+
} else {
40+
geode::Notification::create("Input is not a valid number", NotificationIcon::Error, 2.f)->show();
4341
}
4442
}
4543
void onPlusButtonClick(CCObject* sender){
4644
if(inputNode->getString().empty()){return;}
47-
try {
48-
int val = std::stoi(inputNode->getString());
45+
int val = geode::numFromString<int>(inputNode->getString()).unwrapOr(-1);
46+
if (val > -1) {
4947
addAttempts(val);
50-
this->removeMeAndCleanup();
51-
} catch (const std::invalid_argument& e) {
52-
log::warn("Input is not a valid integer");
53-
} catch (const std::out_of_range& e) {
54-
log::warn("Input is out of range");
48+
this->onClose(nullptr);
49+
} else {
50+
geode::Notification::create("Input is not a valid number", NotificationIcon::Error, 2.f)->show();
5551
}
5652
}
5753
void onMinusButtonClick(CCObject* sender){
5854
if(inputNode->getString().empty()){return;}
59-
try {
60-
int val = std::stoi(inputNode->getString());
55+
int val = geode::numFromString<int>(inputNode->getString()).unwrapOr(-1);
56+
if (val > -1) {
6157
subtractAttempts(val);
62-
this->removeMeAndCleanup();
63-
} catch (const std::invalid_argument& e) {
64-
log::warn("Input is not a valid integer");
65-
} catch (const std::out_of_range& e) {
66-
log::warn("Input is out of range");
58+
this->onClose(nullptr);
59+
} else {
60+
geode::Notification::create("Input is not a valid number", NotificationIcon::Error, 2.f)->show();
6761
}
6862
}
6963
bool setup(GJGameLevel* level) override {
@@ -75,8 +69,8 @@ class ModifyAttemptCountPopup : public geode::Popup<GJGameLevel*> {
7569
auto menu = CCMenu::create();
7670

7771
auto input = CCTextInputNode::create(100, 100, "Attempts", "bigFont.fnt");
78-
input->setScale(0.75);
79-
input->setPosition(CCPoint(272.5, 170 ));
72+
input->setScale(0.75);
73+
input->setPosition(CCPoint(this->m_mainLayer->getContentWidth() / 2.f, 170 ));
8074
input->setAllowedChars("0123456789");
8175
inputNode = input;
8276

0 commit comments

Comments
 (0)