Skip to content

Commit 901ad3e

Browse files
committed
v1.1.0
* Add menu button at mod settings. * Add show button setting. * Add show labels setting. * Make pause menu button smaller. * Fix time labels. * Stuff.
1 parent f0b8d44 commit 901ad3e

20 files changed

Lines changed: 383 additions & 1017 deletions

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ project(CustomLabels VERSION 1.0.0)
88

99
add_library(${PROJECT_NAME} SHARED
1010
src/main.cpp
11+
src/custom_setting.cpp
1112
src/globals.cpp
1213
src/label_cell.cpp
1314
src/label_list_layer.cpp
1415
src/add_label_layer.cpp
16+
src/settings_layer.cpp
17+
src/default_label_settings.cpp
1518
src/custom_label_settings.cpp
1619
src/clicks_label_settings.cpp
17-
src/attempts_label_settings.cpp
18-
src/testmode_label_settings.cpp
1920
src/time_label_settings.cpp
2021
src/clock_label_settings.cpp
2122
src/jumps_label_settings.cpp

about.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Custom Labels
22

3-
Add as <cl>many labels</c> as you want and <cg>customize</c> them however you want.
3+
Add info labels to your screen and customize them however you want.
44

5-
# Labels
5+
# Usage
6+
7+
1. Access the labels menu via the button located on the pause menus left side, OR from the mods settings.
8+
2. Click the "+" button in the bottom right corner.
9+
3. Choose name (Optional), type, and position.
10+
4. Click "Add".
11+
5. You can modify the label further by clicking the settings button of the new element that got added to the scroll list.
12+
13+
# Label types
614

715
* Custom Text
816
* Attempts
@@ -14,3 +22,12 @@ Add as <cl>many labels</c> as you want and <cg>customize</c> them however you wa
1422
* Testmode
1523

1624
You can suggest more in the [github.](https://github.com/ZiLko/Custom_Labels)
25+
26+
# Customizations
27+
28+
* Position
29+
* Opacity
30+
* Color
31+
* Size
32+
* Font
33+
* Etc

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# v1.1.0
2+
3+
* Add menu button at mod settings.
4+
* Added show button setting.
5+
* Added show labels setting.
6+
* Made pause menu button smaller.
7+
* Fix time labels.
8+
* Stuff.

mod.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,29 @@
33
"gd": {
44
"win": "2.204"
55
},
6-
"version": "v1.0.0",
6+
"version": "v1.1.0",
77
"id": "zilko.custom_labels",
88
"name": "Custom Labels",
99
"developer": "Zilko",
1010
"description": "Add fully customizable labels to your screen!",
1111
"repository": "https://github.com/ZiLko/Custom_Labels",
12+
"settings": {
13+
"labels_enabled": {
14+
"name": "Show Labels",
15+
"description": "Shows all labels that you have added.",
16+
"type": "bool",
17+
"default": true
18+
},
19+
"button_enabled": {
20+
"name": "Show Button",
21+
"description": "Shows the Labels Menu Button on the pause menu.",
22+
"type": "bool",
23+
"default": true
24+
},
25+
"button_menu": {
26+
"type": "custom"
27+
}
28+
},
1229
"resources": {
1330
"sprites": [
1431
"resources/button.png"

src/clicks_label_settings.cpp

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -253,56 +253,6 @@ ClicksLabelSettings* ClicksLabelSettings::create(int labelIndex) {
253253
return nullptr;
254254
}
255255

256-
void ClicksLabelSettings::openMenu(int labelIndex) {
257-
create(labelIndex)->show();
258-
}
259-
260-
void ClicksLabelSettings::updateOpacity(CCObject*) {
261-
opacityLabel->setString(("Opacity (" + std::to_string(static_cast<int>(opacitySlider->getThumb()->getValue() * 100)) + "%)").c_str());
262-
}
263-
264-
void ClicksLabelSettings::updateSize(CCObject*) {
265-
sizeLabel->setString(("Size (" + std::to_string(static_cast<int>(sizeSlider->getThumb()->getValue() * 500)) + "%)").c_str());
266-
}
267-
268-
void ClicksLabelSettings::updateOffsetX(CCObject*) {
269-
offsetXLabel->setString(("OffsetX (" + std::to_string(static_cast<int>((offsetXSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
270-
}
271-
272-
void ClicksLabelSettings::updateOffsetY(CCObject*) {
273-
offsetYLabel->setString(("OffsetY (" + std::to_string(static_cast<int>((offsetYSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
274-
}
275-
276-
void ClicksLabelSettings::switchPos(CCObject* obj) {
277-
auto id = static_cast<CCNode*>(obj)->getID();
278-
auto& lb = Labels::get();
279-
280-
posIndex += (id == "right") ? 1 : -1;
281-
282-
if (posIndex == -1) posIndex = 8;
283-
else if (posIndex == 9) posIndex = 0;
284-
285-
posLabel->setString(positions[posIndex].c_str());
286-
}
287-
288-
void ClicksLabelSettings::switchFont(CCObject* obj) {
289-
auto id = static_cast<CCNode*>(obj)->getID();
290-
auto& lb = Labels::get();
291-
292-
fontIndex += (id == "right") ? 1 : -1;
293-
294-
if (fontIndex == 60) fontIndex = 0;
295-
if (fontIndex == -1) fontIndex = 59;
296-
297-
fontLabel->removeFromParentAndCleanup(true);
298-
299-
auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize();
300-
301-
fontLabel = CCLabelBMFont::create(("Font " + std::to_string(fontIndex + 1)).c_str(), Labels::getFont(fontIndex).c_str());
302-
fontLabel->setPosition(winSize / 2 + ccp(-90, -35));
303-
fontLabel->setScale(0.455f);
304-
m_mainLayer->addChild(fontLabel);
305-
}
306256

307257
void ClicksLabelSettings::saveSettings(CCObject*) {
308258
keyBackClicked();
@@ -328,34 +278,12 @@ void ClicksLabelSettings::saveSettings(CCObject*) {
328278

329279
lb.labels[labelIndex].settings.color = colorSprite->getColor();
330280

331-
CCArray* children = CCDirector::sharedDirector()->getRunningScene()->getChildren();
332-
CCObject* child;
333-
CCARRAY_FOREACH(children, child) {
334-
CustomLabelsLayer* layer = dynamic_cast<CustomLabelsLayer*>(child);
335-
if (layer) {
336-
if (lb.labels.size() >= 5) {
337-
auto listLayer = static_cast<CCNode*>(layer->getChildren()->objectAtIndex(0))->getChildByID("GJCommentListLayer");
338-
auto listView = static_cast<CCNode*>(static_cast<CCNode*>(listLayer)->getChildren()->objectAtIndex(0));
339-
auto tableView = static_cast<CCNode*>(listView->getChildren()->objectAtIndex(0));
340-
auto contentLayer = static_cast<CCLayer*>(tableView->getChildren()->objectAtIndex(0));
341-
342-
lb.previousScroll = contentLayer->getPositionY();
343-
}
344-
345-
layer->refresh(lb.labels.size() >= 5);
346-
}
347-
}
348-
281+
282+
refreshList();
349283
Labels::addLabels();
350284
Labels::save();
351285
}
352286

353-
void ClicksLabelSettings::openColorPicker(CCObject*) {
354-
auto popup = ColorPickPopup::create(colorSprite->getColor());
355-
popup->setColorTarget(colorSprite);
356-
popup->show();
357-
}
358-
359287
void ClicksLabelSettings::toggleCPSOnly(CCObject*) {
360288
showCPSOnly = !showCPSOnly;
361289
totalClicksOnlyToggle->toggle(false);
@@ -366,4 +294,8 @@ void ClicksLabelSettings::toggleTotalClicksOnly(CCObject*) {
366294
showTotalClicksOnly = !showTotalClicksOnly;
367295
cpsOnlyToggle->toggle(false);
368296
showCPSOnly = false;
297+
}
298+
299+
void ClicksLabelSettings::openMenu(int labelIndex) {
300+
create(labelIndex)->show();
369301
}

src/clock_label_settings.cpp

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -253,57 +253,6 @@ ClockLabelSettings* ClockLabelSettings::create(int labelIndex) {
253253
return nullptr;
254254
}
255255

256-
void ClockLabelSettings::openMenu(int labelIndex) {
257-
create(labelIndex)->show();
258-
}
259-
260-
void ClockLabelSettings::updateOpacity(CCObject*) {
261-
opacityLabel->setString(("Opacity (" + std::to_string(static_cast<int>(opacitySlider->getThumb()->getValue() * 100)) + "%)").c_str());
262-
}
263-
264-
void ClockLabelSettings::updateSize(CCObject*) {
265-
sizeLabel->setString(("Size (" + std::to_string(static_cast<int>(sizeSlider->getThumb()->getValue() * 500)) + "%)").c_str());
266-
}
267-
268-
void ClockLabelSettings::updateOffsetX(CCObject*) {
269-
offsetXLabel->setString(("OffsetX (" + std::to_string(static_cast<int>((offsetXSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
270-
}
271-
272-
void ClockLabelSettings::updateOffsetY(CCObject*) {
273-
offsetYLabel->setString(("OffsetY (" + std::to_string(static_cast<int>((offsetYSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
274-
}
275-
276-
void ClockLabelSettings::switchPos(CCObject* obj) {
277-
auto id = static_cast<CCNode*>(obj)->getID();
278-
auto& lb = Labels::get();
279-
280-
posIndex += (id == "right") ? 1 : -1;
281-
282-
if (posIndex == -1) posIndex = 8;
283-
else if (posIndex == 9) posIndex = 0;
284-
285-
posLabel->setString(positions[posIndex].c_str());
286-
}
287-
288-
void ClockLabelSettings::switchFont(CCObject* obj) {
289-
auto id = static_cast<CCNode*>(obj)->getID();
290-
auto& lb = Labels::get();
291-
292-
fontIndex += (id == "right") ? 1 : -1;
293-
294-
if (fontIndex == 60) fontIndex = 0;
295-
if (fontIndex == -1) fontIndex = 59;
296-
297-
fontLabel->removeFromParentAndCleanup(true);
298-
299-
auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize();
300-
301-
fontLabel = CCLabelBMFont::create(("Font " + std::to_string(fontIndex + 1)).c_str(), Labels::getFont(fontIndex).c_str());
302-
fontLabel->setPosition(winSize / 2 + ccp(-90, -35));
303-
fontLabel->setScale(0.455f);
304-
m_mainLayer->addChild(fontLabel);
305-
}
306-
307256
void ClockLabelSettings::saveSettings(CCObject*) {
308257
keyBackClicked();
309258
auto& lb = Labels::get();
@@ -328,33 +277,12 @@ void ClockLabelSettings::saveSettings(CCObject*) {
328277

329278
lb.labels[labelIndex].settings.color = colorSprite->getColor();
330279

331-
CCArray* children = CCDirector::sharedDirector()->getRunningScene()->getChildren();
332-
CCObject* child;
333-
CCARRAY_FOREACH(children, child) {
334-
CustomLabelsLayer* layer = dynamic_cast<CustomLabelsLayer*>(child);
335-
if (layer) {
336-
if (lb.labels.size() >= 5) {
337-
auto listLayer = static_cast<CCNode*>(layer->getChildren()->objectAtIndex(0))->getChildByID("GJCommentListLayer");
338-
auto listView = static_cast<CCNode*>(static_cast<CCNode*>(listLayer)->getChildren()->objectAtIndex(0));
339-
auto tableView = static_cast<CCNode*>(listView->getChildren()->objectAtIndex(0));
340-
auto contentLayer = static_cast<CCLayer*>(tableView->getChildren()->objectAtIndex(0));
341-
342-
lb.previousScroll = contentLayer->getPositionY();
343-
}
344-
345-
layer->refresh(lb.labels.size() >= 5);
346-
}
347-
}
348-
280+
281+
refreshList();
349282
Labels::addLabels();
350283
Labels::save();
351284
}
352285

353-
void ClockLabelSettings::openColorPicker(CCObject*) {
354-
auto popup = ColorPickPopup::create(colorSprite->getColor());
355-
popup->setColorTarget(colorSprite);
356-
popup->show();
357-
}
358286

359287
void ClockLabelSettings::toggle12H(CCObject*) {
360288
if (format12H) {
@@ -374,4 +302,8 @@ void ClockLabelSettings::toggle24H(CCObject*) {
374302
toggle12h->toggle(false);
375303
format12H = false;
376304
}
305+
}
306+
307+
void ClockLabelSettings::openMenu(int labelIndex) {
308+
create(labelIndex)->show();
377309
}

src/custom_label_settings.cpp

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -240,57 +240,6 @@ CustomLabelSettings* CustomLabelSettings::create(int labelIndex) {
240240
return nullptr;
241241
}
242242

243-
void CustomLabelSettings::openMenu(int labelIndex) {
244-
create(labelIndex)->show();
245-
}
246-
247-
void CustomLabelSettings::updateOpacity(CCObject*) {
248-
opacityLabel->setString(("Opacity (" + std::to_string(static_cast<int>(opacitySlider->getThumb()->getValue() * 100)) + "%)").c_str());
249-
}
250-
251-
void CustomLabelSettings::updateSize(CCObject*) {
252-
sizeLabel->setString(("Size (" + std::to_string(static_cast<int>(sizeSlider->getThumb()->getValue() * 500)) + "%)").c_str());
253-
}
254-
255-
void CustomLabelSettings::updateOffsetX(CCObject*) {
256-
offsetXLabel->setString(("OffsetX (" + std::to_string(static_cast<int>((offsetXSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
257-
}
258-
259-
void CustomLabelSettings::updateOffsetY(CCObject*) {
260-
offsetYLabel->setString(("OffsetY (" + std::to_string(static_cast<int>((offsetYSlider->getThumb()->getValue() * 400.f) - 200.f)) + "u)").c_str());
261-
}
262-
263-
void CustomLabelSettings::switchPos(CCObject* obj) {
264-
auto id = static_cast<CCNode*>(obj)->getID();
265-
auto& lb = Labels::get();
266-
267-
posIndex += (id == "right") ? 1 : -1;
268-
269-
if (posIndex == -1) posIndex = 8;
270-
else if (posIndex == 9) posIndex = 0;
271-
272-
posLabel->setString(positions[posIndex].c_str());
273-
}
274-
275-
void CustomLabelSettings::switchFont(CCObject* obj) {
276-
auto id = static_cast<CCNode*>(obj)->getID();
277-
auto& lb = Labels::get();
278-
279-
fontIndex += (id == "right") ? 1 : -1;
280-
281-
if (fontIndex == 60) fontIndex = 0;
282-
if (fontIndex == -1) fontIndex = 59;
283-
284-
fontLabel->removeFromParentAndCleanup(true);
285-
286-
auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize();
287-
288-
fontLabel = CCLabelBMFont::create(("Font " + std::to_string(fontIndex + 1)).c_str(), Labels::getFont(fontIndex).c_str());
289-
fontLabel->setPosition(winSize / 2 + ccp(-90, -35));
290-
fontLabel->setScale(0.455f);
291-
m_mainLayer->addChild(fontLabel);
292-
}
293-
294243
void CustomLabelSettings::saveSettings(CCObject*) {
295244
keyBackClicked();
296245
auto& lb = Labels::get();
@@ -315,30 +264,11 @@ void CustomLabelSettings::saveSettings(CCObject*) {
315264

316265
lb.labels[labelIndex].settings.color = colorSprite->getColor();
317266

318-
CCArray* children = CCDirector::sharedDirector()->getRunningScene()->getChildren();
319-
CCObject* child;
320-
CCARRAY_FOREACH(children, child) {
321-
CustomLabelsLayer* layer = dynamic_cast<CustomLabelsLayer*>(child);
322-
if (layer) {
323-
if (lb.labels.size() >= 5) {
324-
auto listLayer = static_cast<CCNode*>(layer->getChildren()->objectAtIndex(0))->getChildByID("GJCommentListLayer");
325-
auto listView = static_cast<CCNode*>(static_cast<CCNode*>(listLayer)->getChildren()->objectAtIndex(0));
326-
auto tableView = static_cast<CCNode*>(listView->getChildren()->objectAtIndex(0));
327-
auto contentLayer = static_cast<CCLayer*>(tableView->getChildren()->objectAtIndex(0));
328-
329-
lb.previousScroll = contentLayer->getPositionY();
330-
}
331-
332-
layer->refresh(lb.labels.size() >= 5);
333-
}
334-
}
335-
267+
refreshList();
336268
Labels::addLabels();
337269
Labels::save();
338270
}
339271

340-
void CustomLabelSettings::openColorPicker(CCObject*) {
341-
auto popup = ColorPickPopup::create(colorSprite->getColor());
342-
popup->setColorTarget(colorSprite);
343-
popup->show();
272+
void CustomLabelSettings::openMenu(int labelIndex) {
273+
create(labelIndex)->show();
344274
}

0 commit comments

Comments
 (0)