Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
TestChangeofcodestuc
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmella-v committed Oct 19, 2023
1 parent e49e92e commit 9b04a89
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 192 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "1.3.0",
"version": "v1.0.4-beta.5",
"version": "v1.0.4-beta.6",
"id": "muhammadgames.bettermenu",
"name": "Better Menu",
"developer": "MuhammadGames",
Expand Down
192 changes: 192 additions & 0 deletions src/LoadingMenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/modify/CreatorLayer.hpp>
#include <Geode/binding/EndLevelLayer.hpp>
#include <Geode/cocos/base_nodes/Layout.hpp>

using namespace geode::prelude;
auto Mainbooter = true;
auto FirstBoot = false;

struct $modify(newer,MenuLayer) {


// Creates the level click buttons function
void onMyLevelsClick(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onOnlineLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onMyLevels(target);
#endif

}
void SearchButtonClicked(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onOnlineLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onOnlineLevels(target);
#endif
}
void onSavedLevelsClick(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onSavedLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onSavedLevels(target);
#endif
}
// ints the main menu code
bool init() {
if (!MenuLayer::init() ) {
return false;
};
if (!Mod::get()->getSettingValue<bool>("RunMainMenu")) {
return true;
};
auto winSize = CCDirector::get()->getWinSize();
if (Mod::get()->getSettingValue<bool>("MoveMenuPos")) {
auto close = this->getChildByID("close-menu");
close->setLayout(
RowLayout::create()
->setGap(5.f)
->setAutoScale(true)
->setAxis(Axis::Row)
->setAxisAlignment(AxisAlignment::End)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);
auto profilePos = (winSize.height-20);
close->setPosition(winSize.width-100,profilePos);
auto RightSideMenu = this->getChildByID("right-side-menu");
RightSideMenu->setLayout(
RowLayout::create()
->setGap(2.f)
->setAutoScale(true)
->setAxis(Axis::Row)
->setAxisAlignment(AxisAlignment::Even)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);
RightSideMenu->setPosition(0.5*winSize.width,winSize.height/4.2);
RightSideMenu->setScale(1.225);
RightSideMenu->setContentSize({ 223.749, 69.000 });
RightSideMenu->updateLayout();
/*
auto title = this->getChildByID("main-title");
title->setPosition(0, 0);
title->setScale(0);
Title Remover LOL
*/

auto bottommenu = this->getChildByID("bottom-menu");
bottommenu->setScale(0.95);
bottommenu->setLayout(
RowLayout::create()
->setGap(3.5)
->setAutoScale(true)
->setAxis(Axis::Column)
->setAxisAlignment(AxisAlignment::Center)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);

bottommenu->setContentSize({ 35.f, 198.f });

auto profile = this->getChildByID("profile-menu");

profile->setPosition((44+4),winSize.height-20);
profile->setScale(0.575);
auto profileUser = this->getChildByID("player-username");
profileUser->setPosition(76,391);
profileUser->setScale(1);
// FIXES STUFF
bottommenu->setPosition((17+4),(profilePos - 114));
bottommenu->updateLayout();
};

if (Mod::get()->getSettingValue<bool>("HideName")) {
auto profileUser = this->getChildByID("player-username");
profileUser->setPosition(-121212,121212);
profileUser->setScale(0);
};
auto ByeBye = this->getChildByID("social-media-menu");
ByeBye->setPosition(-121212,121212);

auto menu = CCMenu::create();
menu->setID("bettermenu/Shortcuts");
int Offset = 0;
// Shortcut Search thingy
if (Mod::get()->getSettingValue<bool>("ShortcutSearch")) {
auto SearchIcon = CCSprite::createWithSpriteFrameName("GJ_searchBtn_001.png");
SearchIcon->setScale(0.7f);
auto Search = CCMenuItemSpriteExtra::create(SearchIcon, this, menu_selector(newer::SearchButtonClicked));
auto more=this->getChildByID("more-games-menu");
menu->addChild(Search);
more-> setPosition(-122222,-120);
Search->setPosition(winSize.width-63.125,19.500);
Search->setID("bettermenu/Search/MoreGamesReplacement");
}
// accountBtn_myLevels_001.png
// GJ_editBtn_001.png
// 1
this->addChild(menu);
menu->setPosition((17+4),22);
menu->setContentSize({ 0, 0 });
menu->setAnchorPoint({0,0});

if (Mod::get()->getSettingValue<bool>("ShortcutMyLevel")) {
auto Profiler = CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
Profiler->setScale(0.4f);
auto onMyLevels = CCMenuItemSpriteExtra::create(Profiler, this, menu_selector(newer::onMyLevelsClick));
menu->addChild(onMyLevels);


onMyLevels->setPosition(0,0);
onMyLevels->setID("bettermenu/shortcut/onMyLevels");
Offset=Offset+5+onMyLevels->getContentSize().width;
}
// 2
if (Mod::get()->getSettingValue<bool>("ShortcutSavedLevels")) {
this->addChild(menu);
auto onSavedLevelsIcon = CCSprite::createWithSpriteFrameName("accountBtn_myLevels_001.png");
onSavedLevelsIcon->setScale(0.7f);
auto onSavedLevels = CCMenuItemSpriteExtra::create(onSavedLevelsIcon, this, menu_selector(newer::onSavedLevelsClick));
menu->addChild(onSavedLevels);
onSavedLevels->setPosition(0+Offset,0);
onSavedLevels->setID("bettermenu/shortcut/onSavedLevels");
Offset=Offset+5+onSavedLevels->getContentSize().width;
}
//


// profile->setAttribute("geode.mouse-api/tooltip", profileUser->getString() );
if (Mainbooter) {
FirstBoot = Mod::get()->getSettingValue<bool>("BootMessage");
Mainbooter=false;
};
if (FirstBoot) {
FirstBoot=false;

auto alert = FLAlertLayer::create(
"Warning! (From Better Menu)",
"<cr>This mod is Still in beta, Please report bugs if you find some.</c>",
"Sure!"
);
alert->m_scene = this;
alert->show();

/*
auto alert = FLAlertLayer::create(
"You what that means",
"<cb>FISH</c>",
""
);
alert->m_scene = this;
alert->show();
*/
};
return true;
}
};
192 changes: 1 addition & 191 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,192 +1,2 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/modify/CreatorLayer.hpp>
#include <Geode/binding/EndLevelLayer.hpp>
#include <Geode/cocos/base_nodes/Layout.hpp>

using namespace geode::prelude;
auto Mainbooter = true;
auto FirstBoot = false;

struct $modify(newer,MenuLayer) {


// Creates the level click buttons function
void onMyLevelsClick(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onOnlineLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onMyLevels(target);
#endif

}
void SearchButtonClicked(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onOnlineLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onOnlineLevels(target);
#endif
}
void onSavedLevelsClick(CCObject* target) {
#ifdef GEODE_IS_MACOS
reinterpret_cast<CreatorLayer*>(this)->onSavedLevels(target);
#else
auto CreatorLayer = CreatorLayer::create();
CreatorLayer->onSavedLevels(target);
#endif
}
// ints the main menu code
bool init() {
if (!MenuLayer::init() ) {
return false;
};
if (!Mod::get()->getSettingValue<bool>("RunMainMenu")) {
return true;
};
auto winSize = CCDirector::get()->getWinSize();
if (Mod::get()->getSettingValue<bool>("MoveMenuPos")) {
auto close = this->getChildByID("close-menu");
close->setLayout(
RowLayout::create()
->setGap(5.f)
->setAutoScale(true)
->setAxis(Axis::Row)
->setAxisAlignment(AxisAlignment::End)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);
auto profilePos = (winSize.height-20);
close->setPosition(winSize.width-100,profilePos);
auto RightSideMenu = this->getChildByID("right-side-menu");
RightSideMenu->setLayout(
RowLayout::create()
->setGap(2.f)
->setAutoScale(true)
->setAxis(Axis::Row)
->setAxisAlignment(AxisAlignment::Even)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);
RightSideMenu->setPosition(0.5*winSize.width,winSize.height/4.2);
RightSideMenu->setScale(1.225);
RightSideMenu->setContentSize({ 223.749, 69.000 });
RightSideMenu->updateLayout();
/*
auto title = this->getChildByID("main-title");
title->setPosition(0, 0);
title->setScale(0);
Title Remover LOL
*/

auto bottommenu = this->getChildByID("bottom-menu");
bottommenu->setScale(0.95);
bottommenu->setLayout(
RowLayout::create()
->setGap(3.5)
->setAutoScale(true)
->setAxis(Axis::Column)
->setAxisAlignment(AxisAlignment::Center)
->setCrossAxisAlignment(AxisAlignment::Center)
->setCrossAxisLineAlignment(AxisAlignment::Center)
);

bottommenu->setContentSize({ 35.f, 198.f });

auto profile = this->getChildByID("profile-menu");

profile->setPosition((44+4),winSize.height-20);
profile->setScale(0.575);
auto profileUser = this->getChildByID("player-username");
profileUser->setPosition(76,391);
profileUser->setScale(1);
// FIXES STUFF
bottommenu->setPosition((17+4),(profilePos - 114));
bottommenu->updateLayout();
};

if (Mod::get()->getSettingValue<bool>("HideName")) {
auto profileUser = this->getChildByID("player-username");
profileUser->setPosition(-121212,121212);
profileUser->setScale(0);
};
auto ByeBye = this->getChildByID("social-media-menu");
ByeBye->setPosition(-121212,121212);

auto menu = CCMenu::create();
menu->setID("bettermenu/Shortcuts");
int Offset = 0;
// Shortcut Search thingy
if (Mod::get()->getSettingValue<bool>("ShortcutSearch")) {
auto SearchIcon = CCSprite::createWithSpriteFrameName("GJ_searchBtn_001.png");
SearchIcon->setScale(0.7f);
auto Search = CCMenuItemSpriteExtra::create(SearchIcon, this, menu_selector(newer::SearchButtonClicked));
auto more=this->getChildByID("more-games-menu");
menu->addChild(Search);
more-> setPosition(-122222,-120);
Search->setPosition(winSize.width-63.125,19.500);
Search->setID("bettermenu/Search/MoreGamesReplacement");
}
// accountBtn_myLevels_001.png
// GJ_editBtn_001.png
// 1
this->addChild(menu);
menu->setPosition((17+4),22);
menu->setContentSize({ 0, 0 });
menu->setAnchorPoint({0,0});

if (Mod::get()->getSettingValue<bool>("ShortcutMyLevel")) {
auto Profiler = CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
Profiler->setScale(0.4f);
auto onMyLevels = CCMenuItemSpriteExtra::create(Profiler, this, menu_selector(newer::onMyLevelsClick));
menu->addChild(onMyLevels);


onMyLevels->setPosition(0,0);
onMyLevels->setID("bettermenu/shortcut/onMyLevels");
Offset=Offset+5+onMyLevels->getContentSize().width;
}
// 2
if (Mod::get()->getSettingValue<bool>("ShortcutSavedLevels")) {
this->addChild(menu);
auto onSavedLevelsIcon = CCSprite::createWithSpriteFrameName("accountBtn_myLevels_001.png");
onSavedLevelsIcon->setScale(0.7f);
auto onSavedLevels = CCMenuItemSpriteExtra::create(onSavedLevelsIcon, this, menu_selector(newer::onSavedLevelsClick));
menu->addChild(onSavedLevels);
onSavedLevels->setPosition(0+Offset,0);
onSavedLevels->setID("bettermenu/shortcut/onSavedLevels");
Offset=Offset+5+onSavedLevels->getContentSize().width;
}
//


// profile->setAttribute("geode.mouse-api/tooltip", profileUser->getString() );
if (Mainbooter) {
FirstBoot = Mod::get()->getSettingValue<bool>("BootMessage");
Mainbooter=false;
};
if (FirstBoot) {
FirstBoot=false;

auto alert = FLAlertLayer::create(
"Warning! (From Better Menu)",
"<cr>This mod is Still in beta, Please report bugs if you find some.</c>",
"Sure!"
);
alert->m_scene = this;
alert->show();

/*
auto alert = FLAlertLayer::create(
"You what that means",
"<cb>FISH</c>",
""
);
alert->m_scene = this;
alert->show();
*/
};
return true;
}
};
using namespace geode::prelude;

0 comments on commit 9b04a89

Please sign in to comment.