Skip to content

Commit d1ac354

Browse files
committed
fix
1 parent 995d14b commit d1ac354

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/filter.hpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#pragma once
2-
#include <climits>
3-
#include <Geode/binding/CCTextInputNode.hpp>
2+
#include <limits>
3+
#include <string>
4+
#include <Geode/Geode.hpp>
5+
#include <Geode/modify/CCTextInputNode.hpp>
46

57
class $modify(CCTextInputNode) {
68
public:
7-
bool init(float width, float height, char const* placeholder, char const* textFont, int fontSize, char const* labelFont) {
9+
bool init(float width, float height, const char* placeholder, const char* textFont, int fontSize, const char* labelFont) {
810
if (!CCTextInputNode::init(width, height, placeholder, textFont, fontSize, labelFont))
911
return false;
10-
this->setMaxLabelLength(INT_MAX);
11-
this->setAllowedChars(gd::string());
12+
CCTextInputNode::setMaxLabelLength(std::numeric_limits<int>::max());
1213
return true;
1314
}
1415

1516
void setMaxLabelLength(int v) {
16-
CCTextInputNode::setMaxLabelLength(INT_MAX);
17+
CCTextInputNode::setMaxLabelLength(std::numeric_limits<int>::max());
1718
}
1819

19-
bool onTextFieldInsertText(cocos2d::CCTextFieldTTF* pSender, char const* text, int nLen, cocos2d::enumKeyCodes keyCodes) {
20+
bool onTextFieldInsertText(cocos2d::CCTextFieldTTF* pSender, const char* text, int nLen, cocos2d::enumKeyCodes keyCodes) {
2021
if (text && nLen > 0) {
2122
try {
2223
auto cur = this->getString();
23-
cur.append(text, static_cast<size_t>(nLen));
24-
this->setString(cur);
24+
std::string s = cur.c_str();
25+
s.append(text, static_cast<size_t>(nLen));
26+
this->setString(s.c_str());
2527
return true;
2628
} catch (...) {}
2729
}

0 commit comments

Comments
 (0)