Skip to content

Commit 5528ab2

Browse files
committed
2.208
1 parent c92ccff commit 5528ab2

7 files changed

Lines changed: 37 additions & 32 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Default keybind is HOME
108108

109109
**Button properties** can be a string, OR an object with any of:
110110
- `content` (string or Text) - The message on the button
111-
- `background` (string) - Button color
111+
- `background` (string or int) - Button color
112112
- green, cyan, pink, grey, darkgrey, red, geodeblue, geodepink, geodepurple, geodeblack or trans
113113
- Uses GJ_button_0#.png texture in resources folder
114114
- `texture` ([filename](#texture-files-can-be-read-from)) - Custom button texture, overrides background
@@ -462,7 +462,7 @@ Icon types (1-15):
462462

463463
Reward types (1-15):
464464

465-
`fireShard`, `iceShard`, `poisonShard`, `shadowShard`, `lavaShard`, `key`, `keys`, `orb`, `orbs`, `diamond`, `diamonds`, `icon`, `earthShard`, `bloodShard`, `metalShard`, `lightShard`, `soulShard`, `goldKey`
465+
`fireShard`, `iceShard`, `poisonShard`, `shadowShard`, `lavaShard`, `key`, `orb`, `diamond`, `icon`, `earthShard`, `bloodShard`, `metalShard`, `lightShard`, `soulShard`, `goldKey`
466466

467467
Item types (1-19):
468468

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.0.6
2+
- 2.208 support
3+
14
# 1.0.5
25
- Added `instant` property for popups which skips the bounce animation
36
- Fixed buttons not being the correct width

mod.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"geode": "4.6.1",
2+
"geode": "5.0.0",
33
"gd": {
4-
"win": "2.2074",
5-
"mac": "2.2074"
4+
"win": "2.2081",
5+
"mac": "2.2081"
66
},
77
"id": "colon.customtextboxes",
88
"name": "Custom Textboxes",
9-
"version": "v1.0.5",
9+
"version": "v1.0.6",
1010
"developer": "Colon",
1111
"description": "Display custom popups, chests, and more",
1212
"resources": {
@@ -17,8 +17,8 @@
1717
"source": "https://github.com/GDColon/Custom-Textboxes"
1818
},
1919
"dependencies": {
20-
"geode.node-ids": { "version": ">=1.20.0", "importance": "required" },
21-
"geode.texture-loader": { "version": ">=1.7.0", "importance": "suggested" }
20+
"geode.node-ids": { "version": ">=1.20.0", "required": true },
21+
"geode.texture-loader": { "version": ">=1.7.0", "required": false }
2222
},
2323
"settings": {
2424
"key_popup": {

src/KeyPicker/KeyPickerPopup.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include <Geode/Geode.hpp>
22
#include "KeyPickerPopup.hpp"
33

4-
bool KeyPickerPopup::setup(enumKeyCodes current, std::function<void(enumKeyCodes)> onConfirm) {
4+
bool KeyPickerPopup::init(enumKeyCodes current, std::function<void(enumKeyCodes)> onConfirm) {
5+
6+
if (!Popup::init(220.0f, 130.0f)) return false;
57

68
key = current;
79
this->setTitle("Press a key!", "bigFont.fnt");
@@ -20,7 +22,7 @@ bool KeyPickerPopup::setup(enumKeyCodes current, std::function<void(enumKeyCodes
2022
return true;
2123
}
2224

23-
void KeyPickerPopup::keyDown(enumKeyCodes pressedKey) {
25+
void KeyPickerPopup::keyDown(enumKeyCodes pressedKey, double balls) {
2426
if (pressedKey == enumKeyCodes::KEY_Escape) pressedKey = enumKeyCodes::KEY_None;
2527
int k = int(pressedKey);
2628
if (k < 0) return;

src/KeyPicker/KeyPickerPopup.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
#include <Geode/ui/Popup.hpp>
44
using namespace geode::prelude;
55

6-
class KeyPickerPopup : public geode::Popup<enumKeyCodes, std::function<void(enumKeyCodes)>> {
6+
class KeyPickerPopup : public geode::Popup {
77
protected:
8-
bool setup(enumKeyCodes current, std::function<void(enumKeyCodes)> onConfirm) override;
9-
void keyDown(cocos2d::enumKeyCodes key) override;
8+
bool init(enumKeyCodes current, std::function<void(enumKeyCodes)> onConfirm);
9+
void keyDown(cocos2d::enumKeyCodes key, double balls) override;
1010
void updateKeyLabel();
1111
enumKeyCodes key;
1212
CCLabelBMFont* keyLabel;
1313
public:
1414
static KeyPickerPopup* create(enumKeyCodes current, std::function<void(enumKeyCodes)> onConfirm) {
1515
auto ret = new KeyPickerPopup();
16-
if (ret->initAnchored(220.0f, 130.0f, current, onConfirm)) {
16+
if (ret->init(current, onConfirm)) {
1717
ret->autorelease();
1818
return ret;
1919
}
2020
delete ret;
2121
return nullptr;
2222
}
23-
enumKeyCodes getKey() { return key; };
23+
enumKeyCodes getKey() { return key; }
2424
};
2525

2626
// I stole this from custom keybinds lol

src/KeyPicker/Keybind.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
using namespace geode::prelude;
22

3-
struct Keybind {
3+
struct CTKeybind {
44
int value;
55

66
// no idea what any of this does but it was in the docs
7-
bool operator==(Keybind const& other) const = default;
7+
bool operator==(CTKeybind const& other) const = default;
88
operator int() const { return value; };
99

10-
Keybind() = default;
11-
Keybind(int value) : value(value) {}
12-
Keybind(Keybind const&) = default;
10+
CTKeybind() = default;
11+
CTKeybind(int value) : value(value) {}
12+
CTKeybind(CTKeybind const&) = default;
1313

1414
enumKeyCodes getKey() const { return static_cast<enumKeyCodes>(value); }
1515
};
@@ -32,15 +32,15 @@ class KeyPicker : public SettingBaseValueV3<int> {
3232
};
3333

3434
template <>
35-
struct matjson::Serialize<Keybind> {
36-
static matjson::Value toJson(Keybind const& settingValue) { return settingValue.value; }
37-
static Result<Keybind> fromJson(matjson::Value const& json) {
35+
struct matjson::Serialize<CTKeybind> {
36+
static matjson::Value toJson(CTKeybind const& settingValue) { return settingValue.value; }
37+
static Result<CTKeybind> fromJson(matjson::Value const& json) {
3838
GEODE_UNWRAP_INTO(auto num, json.asInt());
39-
return Ok(Keybind(num));
39+
return Ok(CTKeybind(num));
4040
}
4141
};
4242

4343
template <>
44-
struct geode::SettingTypeForValueType<Keybind> {
44+
struct geode::SettingTypeForValueType<CTKeybind> {
4545
using SettingType = KeyPicker;
4646
};

src/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ std::string getTargetID(std::string path, bool alt) {
6666

6767
// ===== //
6868

69-
enumKeyCodes getPopupKey() { return Mod::get()->getSettingValue<Keybind>("key_popup").getKey(); };
70-
enumKeyCodes getTextboxKey() { return Mod::get()->getSettingValue<Keybind>("key_dialogue").getKey(); };
71-
enumKeyCodes getChestKey() { return Mod::get()->getSettingValue<Keybind>("key_chest").getKey(); };
69+
enumKeyCodes getPopupKey() { return Mod::get()->getSettingValue<CTKeybind>("key_popup").getKey(); };
70+
enumKeyCodes getTextboxKey() { return Mod::get()->getSettingValue<CTKeybind>("key_dialogue").getKey(); };
71+
enumKeyCodes getChestKey() { return Mod::get()->getSettingValue<CTKeybind>("key_chest").getKey(); };
7272

7373
// ===== //
7474

@@ -148,7 +148,7 @@ bool killAllAlerts() {
148148
auto children = scene->getChildren();
149149
for (int i = children->count() - 1; i >= 0; i--) {
150150
CCNode* n = typeinfo_cast<CCNode*>(children->objectAtIndex(i));
151-
if (n != nullptr && n->getID().starts_with(""_spr)) {
151+
if (n != nullptr && std::string(n->getID()).starts_with(""_spr)) {
152152
n->removeMeAndCleanup();
153153
killed = true;
154154
}
@@ -168,8 +168,8 @@ bool killAllAlerts() {
168168

169169
// Handle key presses
170170
class $modify(CCKeyboardDispatcher) {
171-
bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool repeat) {
172-
if (repeat || !down || key == KEY_None || key == KEY_Unknown) return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, repeat);
171+
bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool repeat, double time) {
172+
if (repeat || !down || key == KEY_None || key == KEY_Unknown) return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, repeat, time);
173173

174174
else if (key == KEY_Escape && CCKeyboardDispatcher::get()->getShiftKeyPressed()) {
175175
if (killAllAlerts()) return false;
@@ -179,7 +179,7 @@ class $modify(CCKeyboardDispatcher) {
179179
else if (key == getTextboxKey()) prepTextbox();
180180
else if (key == getChestKey()) prepChest();
181181

182-
return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, repeat);
182+
return CCKeyboardDispatcher::dispatchKeyboardMSG(key, down, repeat, time);
183183
}
184184
};
185185

0 commit comments

Comments
 (0)