Skip to content

Commit

Permalink
hgkh
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Feb 7, 2024
1 parent 831f740 commit c1809e1
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ClientUtils

static void SetupBypass()
{
Window* bypass = new Window();
Window* bypass = new Universal();
bypass->name = "Universal";
bypass->id = "bypass-window";
bypass->windowPos = ImVec2(50 + (50 + (Client::instance->tileSize.x)) * 0, 50);
Expand Down
32 changes: 24 additions & 8 deletions src/Client/Dropdown.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <Geode/Geode.hpp>
#include "CCContentSizeTo.h"

Expand Down Expand Up @@ -42,7 +44,7 @@ class Dropdown : public CCMenu {

void setVis(bool n)
{
CCPoint s = ccp(size.width, size.height * (1 + (open ? strs.size() : 0)));
CCPoint s = ccp(size.width, size.height * (1 + (open ? (std::min<float>(6, strs.size())) : 0)));
bg->stopAllActions();
bg->runAction(CCEaseInOut::create( CCContentSizeTo::create(0.35f, s), 2.0f));

Expand All @@ -52,7 +54,7 @@ class Dropdown : public CCMenu {
{
btns[i]->stopAllActions();

btns[i]->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.1f * i), CCEaseInOut::create(CCScaleTo::create(0.5f, 1), 2)));
btns[i]->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.02f * i), CCEaseInOut::create(CCScaleTo::create(0.5f, 1), 2)));
}
}
else
Expand All @@ -63,7 +65,7 @@ class Dropdown : public CCMenu {
{
btns[i]->stopAllActions();

btns[i]->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.1f * i), CCEaseInOut::create(CCScaleTo::create(0.35f, 0), 2)));
btns[i]->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.02f * i), CCEaseInOut::create(CCScaleTo::create(0.35f, 0), 2)));
}

std::reverse(btns.begin(), btns.end());
Expand Down Expand Up @@ -113,27 +115,41 @@ class Dropdown : public CCMenu {
tex->limitLabelWidth(size.width - 10 - (7.5f + sprBtn->getContentSize().width), 0.7f, 0.05f);
this->addChild(tex);

auto scl = geode::ScrollLayer::create({ size.width, size.height * std::min<float>(6, strs.size()) });
scl->setPositionY(-1 * scl->getContentSize().height);
scl->m_contentLayer->setContentSize(ccp(scl->getContentSize().width, size.height * strs.size()));
scl->moveToTop();

auto m = CCMenu::create();

for (size_t s = 0; s < strs.size(); s++)
{
auto lbl = CCLabelBMFont::create(strs[s].c_str(), "bigFont.fnt");
lbl->limitLabelWidth(size.width, 0.7f, 0.01f);
lbl->limitLabelWidth(size.width - 10 - 10, 0.7f, 0.01f);

auto btn = CCMenuItemSpriteExtra::create(lbl, this, menu_selector(Dropdown::onPress));
btn->setPosition(ccp(size.width / 2, (size.height * (s + 1) * -1) + size.height / 2 ));
btn->setPosition(ccp(size.width / 2, scl->m_contentLayer->getContentSize().height + ((size.height * (s + 1) * -1) + size.height / 2 )));
btn->setScale(0);
btn->setTag(s);
this->addChild(btn);
btn->setSizeMult(1.1f);
m->addChild(btn);

btns.push_back(btn);
}


scl->m_contentLayer->addChild(m);
scl->setTouchPriority(-555);

this->addChild(scl);

this->registerWithTouchDispatcher();
cocos::handleTouchPriority(this);
//cocos::handleTouchPriority(this); // maybe this fixes it

return true;
}

int getSelectedIndex() { return selected; }

void setSelected(int sh)
{
selected = sh;
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Module
auto dat = static_cast<Module*>(static_cast<CCNode*>(sender)->getUserData());

//fucking force priority kill yourself
auto al = FLAlertLayer::create(dat->name.c_str(), dat->description.c_str(), "Ok");
auto al = FLAlertLayer::create(dat->name.c_str(), dat->description.c_str(), "OK");
al->show();
}

Expand Down
30 changes: 29 additions & 1 deletion src/Client/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Geode/modify/GJBaseGameLayer.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include "../Layers/SetupFadeSetting.h"
#include "../Layers/SetupTransitionCustomizer.h"

class Client;

Expand Down Expand Up @@ -1183,4 +1184,31 @@ class IconEffects : public Window
generateType(menu, i);
}
}
};
};

class Universal : public Window
{
public:
void onTransCustomizer(CCObject*)
{
SetupTransCustom::addToScene();
}

void cocosCreate(CCMenu* menu)
{
Window::cocosCreate(menu);

auto pos = ccp(menu->getContentSize().width, 0) + ccp(-58, 22);

return;

auto btnS = ButtonSprite::create("Transition\nCustomizer", 90, false, "bigFont.fnt", "GJ_button_05.png", 35, 0.75f);
as<CCNode*>(btnS->getChildren()->objectAtIndex(0))->setScale(0.375f);
as<CCLabelBMFont*>(btnS->getChildren()->objectAtIndex(0))->setAlignment(CCTextAlignment::kCCTextAlignmentCenter);
as<CCLabelBMFont*>(btnS->getChildren()->objectAtIndex(0))->updateLabel();
auto btn = CCMenuItemSpriteExtra::create(btnS, menu, menu_selector(Universal::onTransCustomizer));
btn->setSizeMult(1.15f);
btn->setPosition(pos);
menu->addChild(btn);
}
};
2 changes: 1 addition & 1 deletion src/Layers/SetupFadeSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class SetupFadeSetting : public FLAlertLayer
title->setScale(0.5f);
l->addChild(title);

auto ok = CCMenuItemSpriteExtra::create(ButtonSprite::create("Ok"), this, menu_selector(SetupFadeSetting::onClose));
auto ok = CCMenuItemSpriteExtra::create(ButtonSprite::create("OK"), this, menu_selector(SetupFadeSetting::onClose));
ok->setPosition(l->getContentSize() / 2 + ccp(0, -85));
l->addChild(ok);

Expand Down
85 changes: 85 additions & 0 deletions src/Layers/SetupTransitionCustomizer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include "../Client/Dropdown.h"
#include <Geode/ui/GeodeUI.hpp>

using namespace geode::prelude;

class SetupTransCustom : public FLAlertLayer
{
public:
void onClose(CCObject*)
{
this->removeFromParent();
}

virtual void keyBackClicked()
{
onClose(nullptr);
}

bool init()
{
if (!FLAlertLayer::init(0))
return false;

this->runAction(CCFadeTo::create(1, 100));
//this->setTouchEnabled(true);
this->setKeypadEnabled(true);

auto l = CCMenu::create();
l->setContentSize(ccp(330, 210));
l->setPosition(CCDirector::get()->getWinSize() / 2);
l->ignoreAnchorPointForPosition(false);
l->setTouchPriority(-514);

std::stringstream ss;
ss << "GJ_square0";
ss << Mod::get()->getSavedValue<int>("theme", 5);
ss << ".png";

auto panel = CCScale9Sprite::create(ss.str().c_str());
panel->setContentSize(l->getContentSize());
panel->setAnchorPoint(ccp(0, 0));
panel->setID("panel");
l->addChild(panel);

auto title = CCLabelBMFont::create("Setup Transition Customizer", "bigFont.fnt");
title->setPosition(l->getContentSize() / 2 + ccp(0, 90));
title->setOpacity(100);
title->setScale(0.5f);
l->addChild(title);

auto ok = CCMenuItemSpriteExtra::create(ButtonSprite::create("OK"), this, menu_selector(SetupTransCustom::onClose));
ok->setPosition(l->getContentSize() / 2 + ccp(0, -85));
l->addChild(ok);

auto dd = Dropdown::create({130, 30}, {"Fade", "Cross Fade", "Fade Bottom Left", "Fade Top Right", "Fade Up", "Fade Down", "Flip Angular", "Flip X", "Flip Y", "Jump Zoom", "Move In Top", "Move In Bottom", "Move In Left", "Move In Right", "Rotate Zoom", "Shrink Grow", "Slide In Top", "Slide In Bottom", "Slide In Left", "Slide In Right", "Split Rows", "Split Columns", "Tiles"}, nullptr);
dd->setTouchPriority(-550);
l->addChild(dd);

this->addChild(l);

l->setScale(0.1f);
l->runAction(CCEaseElasticOut::create(CCScaleTo::create(1, 1)));

return true;
}

static SetupTransCustom* create()
{
SetupTransCustom* pRet = new SetupTransCustom();
if (pRet && pRet->init()) {
pRet->autorelease();
return pRet;
} else {
delete pRet;
return nullptr;
}
}

static void addToScene()
{
auto pRet = SetupTransCustom::create();

CCScene::get()->addChild(pRet, 99999);
}
};

0 comments on commit c1809e1

Please sign in to comment.