Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Jul 17, 2024
1 parent cb18f06 commit 93c9811
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 56 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
- Fixed multiple CPS Counter bugs
- Added Total CPS option to CPS Counter
- Changed how FPS is counted, should be more accurate
- Removed F12 keybind by default
- Fixed more touch issues

# 1.4.7

Expand Down
4 changes: 2 additions & 2 deletions src/Client/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "ColourUtility.h"
#include "DrawUtils.h"

#include <Geode/ui/TextInput.hpp>
#include "../UI/UIComponent.hpp"

using namespace geode::prelude;

Expand All @@ -21,7 +21,7 @@ class ModuleChangeDelegate
}
};

class Module
class Module : public UIComponent
{
protected:
std::vector<geode::Hook*> hooks = {};
Expand Down
23 changes: 7 additions & 16 deletions src/Client/Types/ColourPickModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ void ColourModule::makeAndroid(CCNode* menu, CCPoint pos)
btnSpr = CCSprite::createWithSpriteFrameName("GJ_colorBtn_001.png");
btnSpr->setColor(colour);
btnSpr->setScale(0.75f);
auto btn = CCMenuItemSpriteExtra::create(btnSpr, menu, menu_selector(ColourModule::onPickColourAndroid));
auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(ColourModule::onPickColourAndroid));

btn->setUserData(this);
btn->setPosition(pos + ccp(135, 0) + ccp(-15, 0));

menu->addChild(btn);
Expand All @@ -22,25 +21,17 @@ void ColourModule::makeAndroid(CCNode* menu, CCPoint pos)

void ColourModule::onPickColourAndroid(CCObject* sender)
{
auto v = as<ColourModule*>(as<CCNode*>(sender)->getUserData());
auto men = geode::ColorPickPopup::create(colour);

if (!v->delegate)
{
v->delegate = new ColourModuleDelegate();
v->delegate->mod = v;
}

auto men = geode::ColorPickPopup::create(v->colour);

men->setDelegate(v->delegate);
men->setDelegate(this);
men->show();
}

void ColourModuleDelegate::updateColor(cocos2d::ccColor4B const& color)
void ColourModule::updateColor(cocos2d::ccColor4B const& color)
{
as<ColourModule*>(mod)->colour = ccc3(color.r, color.g, color.b);
as<ColourModule*>(mod)->btnSpr->setColor(as<ColourModule*>(mod)->colour);
as<ColourModule*>(mod)->save();
colour = ccc3(color.r, color.g, color.b);
btnSpr->setColor(colour);
save();
}

ColourModule::ColourModule(std::string name, std::string id, ccColor3B def)
Expand Down
14 changes: 3 additions & 11 deletions src/Client/Types/ColourPickModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,14 @@

using namespace geode::prelude;

class ColourModuleDelegate : public ColorPickPopupDelegate
{
public:
Module* mod;

virtual void updateColor(cocos2d::ccColor4B const& color);
};

class ColourModule : public Module
class ColourModule : public Module, public ColorPickPopupDelegate
{
public:
static inline ColourModule* selected = nullptr;

ccColor3B colour = ccc3(255, 255, 255);
ccColor3B def = ccc3(255, 255, 255);

ColourModuleDelegate* delegate;

CCSprite* btnSpr = nullptr;

ColourModule(std::string name, std::string id, ccColor3B def);
Expand All @@ -33,4 +23,6 @@ class ColourModule : public Module
void onPickColourAndroid(cocos2d::CCObject* sender);

void makeAndroid(CCNode* menu, CCPoint pos);

virtual void updateColor(cocos2d::ccColor4B const& color);
};
7 changes: 2 additions & 5 deletions src/Keybinds/SetBindSetting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SetBindValue : public SettingValue
public:
static inline SetBindValue* instance = nullptr;

std::vector<int> buttons = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_Insert, enumKeyCodes::KEY_F12 };
std::vector<int> buttons = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_Insert };

SetBindValue(std::string const& key, std::string const& modID)
: SettingValue(key, modID) {}
Expand Down Expand Up @@ -97,9 +97,6 @@ class SetBindNode : public SettingNode
if (as<SetBindValue*>(m_value)->buttons[0] != enumKeyCodes::KEY_Insert)
return true;

if (as<SetBindValue*>(m_value)->buttons[0] != enumKeyCodes::KEY_F12)
return true;

return false;
}

Expand All @@ -109,7 +106,7 @@ class SetBindNode : public SettingNode
}

void resetToDefault() override {
as<SetBindValue*>(m_value)->buttons = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_Insert, enumKeyCodes::KEY_F12 };
as<SetBindValue*>(m_value)->buttons = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_Insert };
}

static SetBindNode* create(SetBindValue* value, float width) {
Expand Down
26 changes: 13 additions & 13 deletions src/Layers/SillyBaseLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

bool SillyBaseLayer::setup()
{
return true;
}

bool SillyBaseLayer::initWithSizeAndName(CCPoint size, std::string _title, bool createWithOK, bool animate, bool noBlur)
{
if (!initAnchored(69, 420))
return false;

m_mainLayer->setVisible(false);
this->stopAllActions();
this->setOpacity(0);
Expand All @@ -21,9 +13,6 @@ bool SillyBaseLayer::initWithSizeAndName(CCPoint size, std::string _title, bool
this->addChild(blur);
}

this->size = size;
int priority = -504;

this->runAction(CCFadeTo::create(1, 100));
this->setKeypadEnabled(true);
this->setTouchEnabled(false);
Expand All @@ -32,7 +21,6 @@ bool SillyBaseLayer::initWithSizeAndName(CCPoint size, std::string _title, bool
l->setContentSize(size);
l->setPosition(CCDirector::get()->getWinSize() / 2);
l->ignoreAnchorPointForPosition(false);
l->setTouchPriority(priority);

int theme = Mod::get()->getSavedValue<int>("theme", 5);

Expand Down Expand Up @@ -133,7 +121,19 @@ bool SillyBaseLayer::initWithSizeAndName(CCPoint size, std::string _title, bool

this->customSetup();

handleTouchPriority(this); // sets the priority after setting up the custom layer, this will come back to fuck me in the ass
return true;
}

bool SillyBaseLayer::initWithSizeAndName(CCPoint size, std::string _title, bool createWithOK, bool animate, bool noBlur)
{
this->_title = _title;
this->createWithOK = createWithOK;
this->animate = animate;
this->noBlur = noBlur;
this->size = size;

if (!initAnchored(69, 420))
return false;

return true;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Layers/SillyBaseLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class SillyBaseLayer : public geode::Popup<>
CCMenuItemSpriteExtra* ok = nullptr;
CCPoint size = CCPointZero;
CCBlurLayer* blur = nullptr;
std::string _title;
bool createWithOK;
bool animate;
bool noBlur;

~SillyBaseLayer();

Expand Down
14 changes: 14 additions & 0 deletions src/UI/UIComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "UIComponent.hpp"

void UIComponent::refreshNode()
{

}

void UIComponent::setParent(CCNode* parent)
{
CCNode::setParent(parent);

this->removeAllChildrenWithCleanup(true);
refreshNode();
}
13 changes: 13 additions & 0 deletions src/UI/UIComponent.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Geode/Geode.hpp>

using namespace geode::prelude;

class UIComponent : public CCNode
{
public:
virtual void refreshNode();

virtual void setParent(CCNode* parent);
};
17 changes: 9 additions & 8 deletions src/Utils/CCPastelLabelBMFont.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

using namespace geode::prelude;

class CCPastelLabelBMFont : public CCLabelBMFont {
public:
static CCPastelLabelBMFont* create(const char* text, const char* fontFile);
void update(float dt);
class CCPastelLabelBMFont : public CCLabelBMFont
{
public:
static CCPastelLabelBMFont* create(const char* text, const char* fontFile);
void update(float dt);

protected:
CCPastelLabelBMFont();
virtual ~CCPastelLabelBMFont();
protected:
CCPastelLabelBMFont();
virtual ~CCPastelLabelBMFont();

bool initWithString(const char* text, const char* fontFile);
bool initWithString(const char* text, const char* fontFile);
};
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class $modify (CCKeyboardDispatcher)
{
bool v = false;

std::vector<int> btns = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_F12, enumKeyCodes::KEY_Insert };
std::vector<int> btns = { enumKeyCodes::KEY_Tab, enumKeyCodes::KEY_Insert };

if (SetBindValue::instance)
btns = SetBindValue::instance->buttons;
Expand Down

0 comments on commit 93c9811

Please sign in to comment.