mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 16:07:52 -05:00
Add text input node fix
This commit is contained in:
parent
d3235663ae
commit
0367360644
1 changed files with 18 additions and 0 deletions
18
loader/src/hooks/TextInputNodeFix.cpp
Normal file
18
loader/src/hooks/TextInputNodeFix.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#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) {
|
||||||
|
auto change = count >= this->m_maxLabelLength ? 1 : 0;
|
||||||
|
|
||||||
|
this->m_maxLabelLength += change;
|
||||||
|
auto ret = CCTextInputNode::onTextFieldInsertText(field, text, count);
|
||||||
|
this->m_maxLabelLength -= change;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue