Skip to content

Commit

Permalink
seperate windows into different files for easier build times
Browse files Browse the repository at this point in the history
  • Loading branch information
Capeling committed Jul 12, 2024
1 parent 0dc9714 commit 7967970
Show file tree
Hide file tree
Showing 17 changed files with 626 additions and 590 deletions.
3 changes: 2 additions & 1 deletion src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once

#include "Windows/All.h"
#include "../CustomWindows/Config.h"
#include "Client.h"
#include "HitboxesModule.h"
#include "../Labels/Labels.h"
#include "../CustomWindows/Config.h"
#include "../CustomWindows/Labels.h"
#include "../CustomWindows/IconEffects.h"
#include "../Hacks/SafeMode/SafeMode.hpp"
Expand Down
104 changes: 104 additions & 0 deletions src/Client/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,110 @@ bool Window::touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled
return false;
}

float Window::quadraticEaseInOut(float t) {
if (t < 0.5f)
return 2 * t * t;
else
return (-2 * t * t) + (4 * t) - 1;
}

float Window::clampf(float v, float min, float max) {
if (v < min)
v = min;

if (v > max)
v = max;

return v;
}

int Window::getIndex(std::vector<float> v, float K) {
auto it = std::find(v.begin(), v.end(), K);

// If element was found
if (it != v.end())
{

// calculating the index
// of K
int index = it - v.begin();
return index;
}
else {
// If the element is not
// present in the vector
return -1;
}
}

void Window::cocosCreate(CCMenu* menu) {
auto back = CCScale9Sprite::create("square02b_small.png");
back->setContentSize(menu->getContentSize() / 0.5f);
back->setPosition(ccp(0, 0));
back->setAnchorPoint(ccp(0, 0));
back->setScale(0.5f);
back->setColor(ccc3(0, 0, 0));
back->setOpacity(100);

menu->addChild(back);

int y = 0;

float gap = 28;
float extraGap = 9.69f;
float height = gap * roundUpToMultipleOf2((modules.size() - 1) / 2);
height += gap;

height = std::max<float>(menu->getContentHeight(), height + extraGap);

auto scroll = geode::ScrollLayer::create(menu->getContentSize());
scroll->m_peekLimitTop = 15;
scroll->m_peekLimitBottom = 15;
menu->addChild(scroll);

auto btnMenu = CCMenu::create();
btnMenu->setContentSize(ccp(menu->getContentWidth(), height));
btnMenu->setPosition(ccp(0, 0));
btnMenu->setAnchorPoint(ccp(0, 0));
scroll->m_contentLayer->addChild(btnMenu);

int v = 0;

for (size_t m = 0; m < modules.size(); m++)
{
float x = 20;

if (!(v % 2 == 0))
x = 188;

if (modules[m])
modules[m]->makeAndroid(btnMenu, {x, height - (gap * y) - (gap / 2) - (extraGap / 2)});

if (dynamic_cast<SetValueModule*>(modules[m]))
{
y++;

if (x == 20)
v++;
}
else
{
if ((v - 1) % 2 == 0 && v != 0)
y++;
}

v++;
}

scroll->m_contentLayer->setContentHeight(height);
scroll->moveToTop();
scroll->enableScrollWheel();

//auto scrollbar = geode::Scrollbar::create(scroll);
//scrollbar->setPositionY(menu->getContentHeight() / 2);
//scrollbar->setPositionX(menu->getContentWidth() + 0.5f);
//menu->addChild(scrollbar);
}

/*
bool draw(ImVec2 tileSize, float anim = 1)
Expand Down
Loading

1 comment on commit 7967970

@TheSillyDoggo
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.hpp pls 🙏

Please sign in to comment.