geode/loader/src/hooks/TextInputNodeFix.cpp

18 lines
490 B
C++
Raw Normal View History

2023-10-02 12:03:58 -04:00
#include <Geode/modify/CCTextInputNode.hpp>
#ifdef GEODE_IS_ANDROID
using namespace geode::prelude;
struct TextNodeFix : Modify<TextNodeFix, CCTextInputNode> {
bool onTextFieldInsertText(cocos2d::CCTextFieldTTF* field, char const* text, int count) {
2023-10-02 12:05:27 -04:00
auto change = count >= m_maxLabelLength ? 1 : 0;
2023-10-02 12:03:58 -04:00
2023-10-02 12:05:27 -04:00
m_maxLabelLength += change;
2023-10-02 12:03:58 -04:00
auto ret = CCTextInputNode::onTextFieldInsertText(field, text, count);
2023-10-02 12:05:27 -04:00
m_maxLabelLength -= change;
2023-10-02 12:03:58 -04:00
return ret;
}
};
#endif