Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiLko authored Feb 11, 2024
1 parent 47241ff commit 0e1783d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ float leftOver = 0.f; // For CCScheduler
double prevSpeed = 1.0f;

int fixedFps = 240;
int androidFps = 60;

#ifdef GEODE_IS_ANDROID
int offset = 0x320;
Expand Down Expand Up @@ -205,6 +206,16 @@ class RecordLayer : public geode::Popup<std::string const&> {
menu_selector(RecordLayer::openSettingsMenu)
);
btn->setPosition(winSize/2.f-ccp(m_size.width/2.f,m_size.height/2.f) + ccp(325, 20));
menu->addChild(btn);

auto spr = CCSprite::createWithSpriteFrameName("gj_discordIcon_001.png");
spr->setScale(0.8f);
auto btn = CCMenuItemSpriteExtra::create(
spr,
this,
menu_selector(RecordLayer::discordPopup)
);
btn->setPosition(winSize/2.f-ccp(-m_size.width/2.f,m_size.height/2.f) + ccp(-325, 20));
menu->addChild(btn);

if (!isAndroid) {
Expand Down Expand Up @@ -289,6 +300,18 @@ class RecordLayer : public geode::Popup<std::string const&> {
geode::openSettingsPopup(Mod::get());
}

void discordPopup(CCObject*) {
geode::createQuickPopup(
"Join Discord",
"Join the <cb>Discord</c> server?",
"No", "Yes",
[this](auto, bool btn2) {
if (btn2) {
geode::utils::web::openLinkInBrowser("https://discord.gg/dwk5whfeu2");
}
});
}

void keyInfo(CCObject*) {
FLAlertLayer::create(
"Shortcuts",
Expand Down Expand Up @@ -973,7 +996,8 @@ class $modify(GJBaseGameLayer) {
if (Mod::get()->getSettingValue<bool>("frame_stepper") && stepFrame == false)
return;
else if (stepFrame) {
GJBaseGameLayer::update(1.f/fixedFps);
int fps = (isAndroid) ? androidFps : fixedFps;
GJBaseGameLayer::update(1.f/fps);
stepFrame = false;
recorder.syncMusic();
} else GJBaseGameLayer::update(dt);
Expand Down Expand Up @@ -1223,7 +1247,7 @@ class $modify(CCScheduler) {
} else
wasAndroid = true;

int fps = (isAndroid && wasAndroid) ? 60 : fixedFps;
int fps = (isAndroid && wasAndroid) ? androidFps : fixedFps;
float dt2 = (1.f / fps);
dt = (recorder.state == state::recording) ? dt * speedhackValue : dt;
auto startTime = std::chrono::high_resolution_clock::now();
Expand Down

0 comments on commit 0e1783d

Please sign in to comment.