Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions loader/include/Geode/loader/SettingV3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <optional>
#include <concepts>
#include <cocos2d.h>
#include <Geode/ui/Label.hpp>
#include "../utils/cocos.hpp"
#include "../utils/file.hpp"
// this unfortunately has to be included because of C++ templates
Expand Down Expand Up @@ -654,9 +655,9 @@ namespace geode {
// Can / should be used to do alternating BG
void setDefaultBGColor(cocos2d::ccColor4B color);

cocos2d::CCLabelBMFont* getNameLabel() const;
geode::Label* getNameLabel() const;
CCMenuItemSpriteExtra* getDescriptionButton() const;
cocos2d::CCLabelBMFont* getStatusLabel() const;
geode::Label* getStatusLabel() const;
cocos2d::CCMenu* getNameMenu() const;
cocos2d::CCMenu* getButtonMenu() const;
cocos2d::CCLayerColor* getBG() const;
Expand Down Expand Up @@ -700,7 +701,7 @@ namespace geode {
auto validate = this->getSetting()->isValid(m_impl->currentValue);
if (!validate) {
this->getStatusLabel()->setVisible(true);
this->getStatusLabel()->setString(validate.unwrapErr().c_str());
this->getStatusLabel()->setText(validate.unwrapErr());
this->getStatusLabel()->setColor(cocos2d::ccc3(235, 35, 52));
}
}
Expand Down
3 changes: 2 additions & 1 deletion loader/include/Geode/ui/IconButtonSprite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cocos2d.h>
#include <Geode/ui/NineSlice.hpp>
#include <Geode/ui/Label.hpp>

namespace geode {
class GEODE_DLL IconButtonSprite : public cocos2d::CCSprite, public cocos2d::CCLabelProtocol {
Expand Down Expand Up @@ -39,7 +40,7 @@ namespace geode {
void setColor(cocos2d::ccColor3B const& color) override;
void setOpacity(GLubyte opacity) override;
NineSlice* getBg();
cocos2d::CCLabelBMFont* getLabel();
Label* getLabel();
cocos2d::CCNode* getIcon();
};
}
3 changes: 2 additions & 1 deletion loader/include/Geode/ui/Notification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cocos-ext.h>
#include <Geode/binding/TextAlertPopup.hpp>
#include <Geode/ui/NineSlice.hpp>
#include <Geode/ui/Label.hpp>

namespace geode {
constexpr auto NOTIFICATION_DEFAULT_TIME = 1.8f;
Expand Down Expand Up @@ -34,7 +35,7 @@ namespace geode {
void waitThenHide();

NineSlice* getBG();
cocos2d::CCLabelBMFont* getLabel();
geode::Label* getLabel();
cocos2d::CCNodeRGBA* getContent();

public:
Expand Down
3 changes: 2 additions & 1 deletion loader/include/Geode/ui/Popup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/ZStringView.hpp>
#include <Geode/utils/function.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/ui/Layout.hpp>
#include <Geode/ui/NineSlice.hpp>

Expand All @@ -22,7 +23,7 @@ namespace geode {
protected:
cocos2d::CCSize m_size;
NineSlice* m_bgSprite;
cocos2d::CCLabelBMFont* m_title = nullptr;
geode::Label* m_title = nullptr;
CCMenuItemSpriteExtra* m_closeBtn;

~Popup();
Expand Down
6 changes: 4 additions & 2 deletions loader/include/Geode/ui/ProgressBar.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <cocos2d.h>

#include <Geode/ui/Label.hpp>

namespace geode {
// Enum for progress bar style
enum class ProgressBarStyle {
Expand Down Expand Up @@ -74,7 +76,7 @@ namespace geode {
/**
* Get the progress percentage text label node
*/
cocos2d::CCLabelBMFont* getProgressLabel() const noexcept;
geode::Label* getProgressLabel() const noexcept;

/**
* Get the current style of the progress bar
Expand All @@ -91,4 +93,4 @@ namespace geode {
*/
size_t getPrecision() const noexcept;
};
};
};
9 changes: 5 additions & 4 deletions loader/include/Geode/ui/SelectList.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/utils/function.hpp>

namespace geode {
Expand All @@ -16,7 +17,7 @@ namespace geode {
std::vector<T> m_list;
size_t m_index = 0;
geode::Function<void(T const&, size_t)> m_onChange;
cocos2d::CCLabelBMFont* m_label;
geode::Label* m_label;
CCMenuItemSpriteExtra* m_prevBtn;
CCMenuItemSpriteExtra* m_nextBtn;

Expand Down Expand Up @@ -47,7 +48,7 @@ namespace geode {
m_nextBtn->setPosition(width / 2 - 10.f, 0.f);
this->addChild(m_nextBtn);

m_label = cocos2d::CCLabelBMFont::create("", "bigFont.fnt");
m_label = geode::Label::create("", "bigFont.fnt");
this->addChild(m_label);

this->updateLabel();
Expand All @@ -59,7 +60,7 @@ namespace geode {

void updateLabel() {
if (m_list.size()) {
m_label->setString(Stringify(m_list.at(m_index)).c_str());
m_label->setText(Stringify(m_list.at(m_index)));
m_prevBtn->setEnabled(true);
m_nextBtn->setEnabled(true);
}
Expand All @@ -68,7 +69,7 @@ namespace geode {
m_prevBtn->setEnabled(false);
m_nextBtn->setEnabled(false);
}
m_label->limitLabelWidth(m_obContentSize.width - 40.f, .6f, .1f);
m_label->setLimitLabelWidth(m_obContentSize.width - 40.f, .6f, .1f);
}

void onPrev(CCObject* sender) {
Expand Down
9 changes: 5 additions & 4 deletions loader/include/Geode/ui/SliderNode.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Geode/ui/NineSlice.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/ui/TextInput.hpp>
#include <Geode/utils/function.hpp>
#include <Geode/utils/ZStringView.hpp>
Expand Down Expand Up @@ -106,7 +107,7 @@ namespace geode {
* Link a label. This will make the label automatically update whenever
* the slider is dragged.
*/
void linkLabel(cocos2d::CCLabelBMFont* label, unsigned int precision);
void linkLabel(geode::Label* label, unsigned int precision);

/**
* Unlink a linked label
Expand All @@ -119,7 +120,7 @@ namespace geode {
void setLabelPrecision(unsigned int precision);

unsigned int getLabelPrecision();
cocos2d::CCLabelBMFont* getLinkedLabel();
geode::Label* getLinkedLabel();

/**
* Set the slider as read only. This will hide the thumb and will disallow edits made
Expand Down Expand Up @@ -159,7 +160,7 @@ namespace geode {

bool initCustom(cocos2d::CCSprite* thumb, cocos2d::CCSprite* thumbSelected, NineSlice* groove, ZStringView bar, SliderCallback callback, cocos2d::CCSize const& barOffset);
bool initStandard(SliderCallback callback, bool alt);

void updateSize();
void updateFromTouch(cocos2d::CCTouch* touch);

Expand All @@ -171,4 +172,4 @@ namespace geode {
class Impl;
std::unique_ptr<Impl> m_impl;
};
}
}
3 changes: 2 additions & 1 deletion loader/include/Geode/ui/TextArea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <Geode/DefaultInclude.hpp>
#include <Geode/utils/function.hpp>
#include <Geode/ui/Label.hpp>
#include <memory>
#include <cocos2d.h>

Expand Down Expand Up @@ -50,7 +51,7 @@ namespace geode {
float getScale() override;
void setLinePadding(float padding);
float getLinePadding();
std::vector<cocos2d::CCLabelBMFont*> getLines();
std::vector<geode::Label*> getLines();
float getHeight();
float getLineHeight();

Expand Down
9 changes: 5 additions & 4 deletions loader/src/hooks/LoadingLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
#include <loader/console.hpp>
#include <loader/updater.hpp>
#include <Geode/utils/NodeIDs.hpp>
#include <Geode/ui/Label.hpp>

using namespace geode::prelude;

struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
struct Fields {
bool m_menuDisabled = false;
CCLabelBMFont* m_smallLabel = nullptr;
CCLabelBMFont* m_smallLabel2 = nullptr;
Label* m_smallLabel = nullptr;
Label* m_smallLabel2 = nullptr;
int m_geodeLoadStep = 0;
int m_totalMods = 0;
~Fields() {
Expand Down Expand Up @@ -72,13 +73,13 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {

auto winSize = CCDirector::sharedDirector()->getWinSize();

m_fields->m_smallLabel = CCLabelBMFont::create("", "goldFont.fnt");
m_fields->m_smallLabel = Label::create("", "goldFont.fnt");
m_fields->m_smallLabel->setPosition(winSize.width / 2, 30.f);
m_fields->m_smallLabel->setScale(.45f);
m_fields->m_smallLabel->setID("geode-small-label");
this->addChild(m_fields->m_smallLabel);

m_fields->m_smallLabel2 = CCLabelBMFont::create("", "goldFont.fnt");
m_fields->m_smallLabel2 = Label::create("", "goldFont.fnt");
m_fields->m_smallLabel2->setPosition(winSize.width / 2, 15.f);
m_fields->m_smallLabel2->setScale(.45f);
m_fields->m_smallLabel2->setID("geode-small-label-2");
Expand Down
3 changes: 2 additions & 1 deletion loader/src/hooks/MenuLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <Geode/utils/NodeIDs.hpp>
#include <Geode/ui/BasedButtonSprite.hpp>
#include <Geode/ui/Notification.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/ui/Popup.hpp>
#include <Geode/ui/PopupManager.hpp>
#include <Geode/ui/MDPopup.hpp>
Expand Down Expand Up @@ -302,7 +303,7 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
icon->setScale(.65f);

if (count > 0) {
auto countLabel = CCLabelBMFont::create(std::to_string(count).c_str(), "bigFont.fnt");
auto countLabel = Label::create(std::to_string(count), "bigFont.fnt");
countLabel->setScale(.5f);
icon->addChildAtPosition(countLabel, Anchor::Center);
}
Expand Down
3 changes: 2 additions & 1 deletion loader/src/ui/GeodeUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Geode/ui/GeodeUI.hpp>
#include <Geode/ui/MDPopup.hpp>
#include <Geode/ui/LoadingSpinner.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/ui/LazySprite.hpp>
#include <Geode/utils/ColorProvider.hpp>
#include <Geode/utils/web.hpp>
Expand Down Expand Up @@ -346,7 +347,7 @@ class ModLogoSprite : public CCNodeRGBA {

void onLoadFailed(bool postEvent) {
// Fallback to default logo if the image failed to load
auto sprite = CCLabelBMFont::create("N/A", "bigFont.fnt");
auto sprite = Label::create("N/A", "bigFont.fnt");
sprite->setPosition(this->getScaledContentSize() / 2.f + CCSize{1.f, 2.f});
sprite->setOpacity(90);
limitNodeSize(sprite, m_obContentSize, 99.f, 0.f);
Expand Down
7 changes: 4 additions & 3 deletions loader/src/ui/mods/GeodeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Geode/binding/ButtonSprite.hpp>
#include <Geode/ui/LoadingSpinner.hpp>
#include <Geode/ui/NineSlice.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/loader/Priority.hpp>

$on_mod(Loaded) {
Expand Down Expand Up @@ -37,7 +38,7 @@
ColorProvider::get()->define("mod-problems-item-bg"_spr, { 255, 255, 255, 15 });
ColorProvider::get()->define("mod-developer-item-bg"_spr, { 255, 255, 255, 15 });
ColorProvider::get()->define("mod-list-paid-color"_spr, { 0, 255, 63, 255 });

ColorProvider::get()->define("keybinds-list-category-label"_spr, ccc3(148, 116, 155));

// Only used when GD theme is active
Expand Down Expand Up @@ -364,8 +365,8 @@ bool GeodeTabSprite::init(const char* iconFrame, const char* text, float width,
limitNodeSize(m_icon, iconSize, 3.f, .1f);
this->addChildAtPosition(m_icon, Anchor::Left, ccp(16, 0), false);

m_label = CCLabelBMFont::create(text, "bigFont.fnt");
m_label->limitLabelWidth(this->getContentWidth() - 45, std::clamp(width * .0045f, .35f, .55f), .1f);
m_label = Label::create(text, "bigFont.fnt");
m_label->setLimitLabelWidth(this->getContentWidth() - 45, std::clamp(width * .0045f, .35f, .55f), .1f);
m_label->setAnchorPoint({ .5f, .5f });
this->addChildAtPosition(m_label, Anchor::Left, ccp((itemSize.width - iconSize.width) / 2 + iconSize.width, 0), false);

Expand Down
3 changes: 2 additions & 1 deletion loader/src/ui/mods/GeodeStyle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <Geode/ui/Popup.hpp>
#include <Geode/ui/ScrollLayer.hpp>
#include <Geode/ui/NineSlice.hpp>
#include <Geode/ui/Label.hpp>
#include <Geode/utils/ZStringView.hpp>
#include <Geode/loader/Mod.hpp>
#include <server/Server.hpp>
Expand Down Expand Up @@ -101,7 +102,7 @@ class GeodeTabSprite : public CCNode {
NineSlice* m_deselectedBG;
NineSlice* m_selectedBG;
CCSprite* m_icon;
CCLabelBMFont* m_label;
geode::Label* m_label;

bool init(const char* iconFrame, const char* text, float width, bool altColor);

Expand Down
Loading
Loading