Skip to content

Commit

Permalink
mac support?
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Feb 18, 2024
1 parent e13f635 commit 375b6e9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 50 deletions.
34 changes: 2 additions & 32 deletions src/MyLayerGradient.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MyLayerGradient.h"
/*#include "MyLayerGradient.h"
bool MyLayerGradient::init()
{
Expand Down Expand Up @@ -78,35 +78,5 @@ void MyLayerGradient::draw()
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
/*CC_NODE_DRAW_SETUP();
ccColor3B start = _startColor;
ccColor3B end = _endColor;
CCPoint vertices[] = {
ccp(0, 0),
ccp(getContentSize().width, 0),
ccp(0, getContentSize().height),
ccp(getContentSize().width, getContentSize().height),
};
for (int i = 0; i < 4; ++i)
{
CCPoint dir = ccpMult(_vector, ccpDot(vertices[i], _vector));
vertices[i] = dir;
}
GLfloat colors[] = {
start.r / 255.0f, start.g / 255.0f, start.b / 255.0f, _startOpacity / 255.0f * (this->getOpacity() / 255.0f),
end.r / 255.0f, end.g / 255.0f, end.b / 255.0f, _endOpacity / 255.0f * (this->getOpacity() / 255.0f),
start.r / 255.0f, start.g / 255.0f, start.b / 255.0f, _startOpacity / 255.0f * (this->getOpacity() / 255.0f),
end.r / 255.0f, end.g / 255.0f, end.b / 255.0f, _endOpacity / 255.0f * (this->getOpacity() / 255.0f),
};
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, colors);
//ccGLBlendFunc(this->getBlendFunc().src, this->getBlendFunc().dst);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);*/
}
*/
4 changes: 2 additions & 2 deletions src/MyLayerGradient.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Geode/Geode.hpp>
/*#include <Geode/Geode.hpp>
using namespace geode::prelude;
Expand All @@ -24,4 +24,4 @@ class MyLayerGradient : public cocos2d::CCLayerColor
GLubyte _startOpacity;
GLubyte _endOpacity;
cocos2d::CCPoint _vector;
};
};*/
41 changes: 25 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@

using namespace geode::prelude;

#include "MyLayerGradient.h"
//#include "CCLayerGradient.h"

class GradientPages
{
public:
static inline GJUserScore* score = nullptr;

static CCNode* createGradientWithSize(CCPoint size)
{


return nullptr;
}
};

class $modify(ProfilePage) {
Expand All @@ -44,8 +51,8 @@ class $modify(ProfilePage) {

auto l = reinterpret_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));

//auto gradient = MyLayerGradient::create();
auto gradient = MyLayerGradient::create();
//auto gradient = CCLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -98,8 +105,10 @@ class $modify(ProfilePage) {
virtual void loadPageFromUserInfo(GJUserScore* score)
{
GradientPages::score = score;
//score->m_commentHistoryStatus = 0;

ProfilePage::loadPageFromUserInfo(score);
//score->m_commentHistoryStatus = 0;

if (!Mod::get()->getSettingValue<bool>("apply-profiles") || Loader::get()->getLoadedMod("bitz.customprofiles"))
return;
Expand All @@ -113,7 +122,7 @@ class $modify(ProfilePage) {

if (l)
{
auto g = reinterpret_cast<MyLayerGradient*>(l->getChildByID("gradient"_spr));
auto g = reinterpret_cast<CCLayerGradient*>(l->getChildByID("gradient"_spr));
auto d = reinterpret_cast<CCScale9Sprite*>(l->getChildByID("darken"_spr));

if (g)
Expand Down Expand Up @@ -161,7 +170,7 @@ class $modify (GJAccountSettingsLayer)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -225,7 +234,7 @@ class $modify(FRequestProfilePage) {

auto l = reinterpret_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -290,7 +299,7 @@ class $modify(MessagesProfilePage) {

auto l = reinterpret_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -355,7 +364,7 @@ class $modify(FriendsProfilePage) {

auto l = reinterpret_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -420,7 +429,7 @@ class $modify(InfoLayer) {

auto l = reinterpret_cast<CCLayer*>(this->getChildren()->objectAtIndex(0));

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -521,7 +530,7 @@ class $modify (ItemInfoPopup)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -587,7 +596,7 @@ class $modify (ShardsPage)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -653,7 +662,7 @@ class $modify (CommunityCreditsPage)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -719,7 +728,7 @@ class $modify (DemonFilterSelectLayer)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -785,7 +794,7 @@ class $modify (MoreSearchLayer)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -851,7 +860,7 @@ class $modify (ChallengesPage)
l->sortAllChildren();
reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0))->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down Expand Up @@ -918,7 +927,7 @@ class $modify (SetIDPopup)
auto v = reinterpret_cast<CCNode*>(l->getChildren()->objectAtIndex(0));
v->setVisible(false);

auto gradient = MyLayerGradient::create();
auto gradient = CCLayerGradient::create();

gradient->setStartColor({255, 0, 0});
gradient->setEndColor({0, 255, 0});
Expand Down

0 comments on commit 375b6e9

Please sign in to comment.