Skip to content

Commit 0a64da1

Browse files
committed
cccczxcz
1 parent 144e11f commit 0a64da1

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "4.1.0",
3-
"version": "v1.7.6",
3+
"version": "v1.7.7",
44
"gd": {
55
"win": "2.2074",
66
"android": "2.2074",

src/Client/Windows/Labels.cpp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,30 @@ void Labels::refreshList()
292292
bg->setContentSize(bg->getContentSize() * 2.5f);
293293
bg->setPositionX(4);
294294

295-
auto name = CCLabelBMFont::create(module->name.c_str(), "bigFont.fnt");
296-
name->setAnchorPoint(ccp(0, 0.5f));
297-
name->setPosition(ccp(10, cell->getContentHeight() / 2));
298-
name->limitLabelWidth(95, 0.4f, 0);
295+
auto nameBack = CCScale9Sprite::create("square02_small.png");
296+
nameBack->setOpacity(100);
297+
nameBack->setContentSize(ccp(120, 18) * 3);
298+
nameBack->setAnchorPoint(ccp(0, 0.5f));
299+
nameBack->setScale(1.0f / 3.0f);
300+
nameBack->setPositionX(6.5f);
301+
nameBack->setPositionY(cell->getContentHeight() / 2);
302+
303+
auto nameInp = TextInput::create(160, "Display Name", "bigFont.fnt");
304+
nameInp->setAnchorPoint(ccp(0, 0.5f));
305+
nameInp->setPosition(ccp(10, cell->getContentHeight() / 2));
306+
nameInp->setScale(0.7f);
307+
308+
nameInp->getBGSprite()->setVisible(false);
309+
nameInp->getInputNode()->m_placeholderLabel->setAnchorPoint(ccp(0, 0.5f));
310+
nameInp->getInputNode()->m_placeholderLabel->setPositionX(-nameInp->getContentWidth() / 2);
311+
312+
nameInp->setString(lbl->name);
313+
nameInp->setCallback([this, lbl](const std::string& str)
314+
{
315+
lbl->name = str;
316+
317+
save();
318+
});
299319

300320
auto m = CCMenu::create();
301321
m->setPosition(ccp(0, 0));
@@ -397,7 +417,8 @@ void Labels::refreshList()
397417
m->addChild(toggleBtn);
398418

399419
cell->addChild(bg);
400-
cell->addChild(name);
420+
cell->addChild(nameBack);
421+
cell->addChild(nameInp);
401422
cell->addChild(m);
402423

403424
scroll->m_contentLayer->addChild(cell);

src/UI/TransAlertLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bool TransAlertLayer::init(char const* title, const gd::string& desc, char const
1111

1212
bool useTtf = false;
1313

14-
useTtf = !std::regex_match(desc2, std::regex("^[a-zA-Z0-9\\s%:-]*$"));
14+
useTtf = !std::regex_match(desc2, std::regex(ENGLISH_REGEX));
1515

1616
if (useTtf)
1717
{

src/UI/TransLabelBMFont.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void TransLabelBMFont::updateTTFVisible()
123123
}
124124
else
125125
{
126-
useTtf = !std::regex_match(text, std::regex("^[a-zA-Z0-9\\s%:-]*$"));
126+
useTtf = !std::regex_match(text, std::regex(ENGLISH_REGEX));
127127
}
128128

129129
label->setString(text.c_str());

src/UI/TransLabelBMFont.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
using namespace geode::prelude;
66

7+
#define ENGLISH_REGEX "^[a-zA-Z0-9\\s%:-]*$"
8+
79
// they call this my gender
810
class TransLabelBMFont : public CCNode
911
{
@@ -28,9 +30,10 @@ class TransLabelBMFont : public CCNode
2830
CCLabelTTF* createTTF(std::string font, float fontSize);
2931
void updateTTFVisible();
3032

33+
~TransLabelBMFont();
34+
3135
public:
3236
bool init(std::string text, std::string font);
33-
~TransLabelBMFont();
3437

3538
void limitLabelWidth(float width, float defaultScale, float minScale);
3639

0 commit comments

Comments
 (0)