-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move settings to a dedicated About popup
- Loading branch information
Showing
10 changed files
with
220 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
#include <Geode/modify/EditorPauseLayer.hpp> | ||
#include <Geode/ui/BasedButtonSprite.hpp> | ||
#include "AboutBEPopup.hpp" | ||
|
||
using namespace geode::prelude; | ||
|
||
class $modify(AboutBEPauseLayer, EditorPauseLayer) { | ||
$override | ||
bool init(LevelEditorLayer* lel) { | ||
if (!EditorPauseLayer::init(lel)) | ||
return false; | ||
|
||
auto menu = this->getChildByID("guidelines-menu"); | ||
|
||
auto spr = CCSprite::createWithSpriteFrameName("be-button.png"_spr); | ||
spr->setScale(.92f); | ||
auto btn = CCMenuItemSpriteExtra::create( | ||
spr, this, menu_selector(AboutBEPauseLayer::onAbout) | ||
); | ||
btn->setID("about"_spr); | ||
menu->addChild(btn); | ||
menu->updateLayout(); | ||
|
||
if (!Mod::get()->template getSavedValue<bool>("highlighted-be-button")) { | ||
auto overlay = CCLayerColor::create({ 0, 0, 0, 150 }); | ||
overlay->setOpacity(0); | ||
overlay->runAction(CCFadeTo::create(.25f, 185)); | ||
overlay->setZOrder(500); | ||
overlay->setID("be-highlight-overlay"_spr); | ||
this->addChild(overlay); | ||
|
||
btn->setPosition(btn->getParent()->convertToWorldSpace(btn->getPosition())); | ||
{ | ||
auto ref = Ref(btn); | ||
btn->removeFromParent(); | ||
overlay->addChild(btn); | ||
} | ||
|
||
btn->runAction(CCSequence::create( | ||
CCDelayTime::create(.1f), | ||
CCEaseElasticOut::create(CCScaleTo::create(.75f, 2.f), 2.f), | ||
CCTintTo::create(.15f, 0, 155, 255), | ||
CCTintTo::create(.15f, 255, 255, 255), | ||
CCDelayTime::create(.1f), | ||
CCTintTo::create(.15f, 0, 155, 255), | ||
CCTintTo::create(.15f, 255, 255, 255), | ||
CCEaseElasticIn::create(CCScaleTo::create(.75f, .92f), 2.f), | ||
CCCallFunc::create(this, callfunc_selector(AboutBEPauseLayer::markButtonAsHighlighted)), | ||
nullptr | ||
)); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void markButtonAsHighlighted() { | ||
Mod::get()->setSavedValue("highlighted-be-button", true); | ||
auto overlay = this->getChildByID("be-highlight-overlay"_spr); | ||
{ | ||
auto btn = overlay->getChildByID("about"_spr); | ||
auto menu = this->getChildByID("guidelines-menu"); | ||
auto ref = Ref(btn); | ||
btn->removeFromParent(); | ||
menu->addChild(btn); | ||
menu->updateLayout(); | ||
} | ||
overlay->runAction(CCSequence::create( | ||
CCFadeTo::create(.25f, 0), | ||
CCRemoveSelf::create(), | ||
nullptr | ||
)); | ||
} | ||
|
||
void onAbout(CCObject*) { | ||
AboutBEPopup::create()->show(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#include "AboutBEPopup.hpp" | ||
#include <Geode/ui/GeodeUI.hpp> | ||
|
||
bool AboutBEPopup::setup() { | ||
m_noElasticity = true; | ||
|
||
this->setTitle("About BetterEdit"); | ||
|
||
auto cornerBL = CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png"); | ||
m_mainLayer->addChildAtPosition(cornerBL, Anchor::BottomLeft, ccp(25, 25)); | ||
|
||
auto cornerBR = CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png"); | ||
cornerBR->setFlipX(true); | ||
m_mainLayer->addChildAtPosition(cornerBR, Anchor::BottomRight, ccp(-25, 25)); | ||
|
||
auto cornerTL = CCSprite::createWithSpriteFrameName("rewardCorner_001.png"); | ||
cornerTL->setFlipY(true); | ||
m_mainLayer->addChildAtPosition(cornerTL, Anchor::TopLeft, ccp(25, -25)); | ||
|
||
auto cornerTR = CCSprite::createWithSpriteFrameName("rewardCorner_001.png"); | ||
cornerTR->setFlipY(true); | ||
cornerTR->setFlipX(true); | ||
m_mainLayer->addChildAtPosition(cornerTR, Anchor::TopRight, ccp(-25, -25)); | ||
|
||
auto developedBy = CCLabelBMFont::create("Developed by", "goldFont.fnt"); | ||
developedBy->setScale(.7f); | ||
m_mainLayer->addChildAtPosition(developedBy, Anchor::Center, ccp(0, 65)); | ||
|
||
auto hjfod = CCLabelBMFont::create("HJfod", "bigFont.fnt"); | ||
hjfod->setScale(.65f); | ||
m_mainLayer->addChildAtPosition(hjfod, Anchor::Center, ccp(0, 40)); | ||
|
||
auto credits = CCLabelBMFont::create("Credits", "goldFont.fnt"); | ||
credits->setScale(.6f); | ||
m_mainLayer->addChildAtPosition(credits, Anchor::Center, ccp(0, 0)); | ||
|
||
auto devs = CCNode::create(); | ||
devs->setContentSize({ 300.f, 90.f }); | ||
devs->setAnchorPoint({ .5f, .5f }); | ||
for (auto dev : { "ninXout", "TheSillyDoggo", "Fleym" }) { | ||
auto label = CCLabelBMFont::create(dev, "bigFont.fnt"); | ||
label->setLayoutOptions(AxisLayoutOptions::create()->setMaxScale(.45f)); | ||
devs->addChild(label); | ||
} | ||
devs->setLayout( | ||
RowLayout::create() | ||
->setCrossAxisOverflow(true) | ||
->setGap(50.f) | ||
); | ||
m_mainLayer->addChildAtPosition(devs, Anchor::Center, ccp(0, -25)); | ||
|
||
auto supportSpr = ButtonSprite::create("Support BE!", "goldFont.fnt", "GJ_button_05.png"); | ||
supportSpr->setScale(.8f); | ||
auto supportBtn = CCMenuItemSpriteExtra::create( | ||
supportSpr, this, menu_selector(AboutBEPopup::onSupport) | ||
); | ||
m_buttonMenu->addChildAtPosition(supportBtn, Anchor::Center, ccp(0, -85)); | ||
|
||
auto spr = CCSprite::createWithSpriteFrameName("GJ_optionsBtn02_001.png"); | ||
auto btn = CCMenuItemSpriteExtra::create( | ||
spr, this, menu_selector(AboutBEPopup::onSettings) | ||
); | ||
btn->setID("settings"_spr); | ||
m_buttonMenu->addChildAtPosition(btn, Anchor::TopRight, ccp(-3, -3)); | ||
|
||
return true; | ||
} | ||
|
||
void AboutBEPopup::onSupport(CCObject*) { | ||
createQuickPopup( | ||
"Support BetterEdit", | ||
"BetterEdit is first and foremost <cy>a passion project</c>, " | ||
"but if you would like to support development, <cg>I have a Ko-fi</c>!\n\n" | ||
"I'm also planning on making a <cb>Pro version</c> in the future with some " | ||
"cool extra features :)\n\n" | ||
"However, please <cr>don't donate just for the purpose of getting Pro</c>! " | ||
"While I fully do intend to make it, I know from past experience that " | ||
"something might come in the way, and <cr>I do not want to receive money " | ||
"for a product until I can guarantee it exists</c>.", | ||
"Cancel", "Open Ko-fi", | ||
400.f, | ||
[](auto layer, bool btn2) { | ||
if (btn2) { | ||
web::openLinkInBrowser("https://ko-fi.com/hjfod"); | ||
} | ||
} | ||
); | ||
|
||
// todo: on next Geode release, just use this instead | ||
// openSupportPopup(Mod::get()); | ||
} | ||
|
||
void AboutBEPopup::onSettings(CCObject*) { | ||
openSettingsPopup(Mod::get()); | ||
} | ||
|
||
AboutBEPopup* AboutBEPopup::create() { | ||
auto ret = new AboutBEPopup(); | ||
if (ret && ret->initAnchored(358.f, 250.f, "GJ_square02.png")) { | ||
ret->autorelease(); | ||
return ret; | ||
} | ||
CC_SAFE_DELETE(ret); | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include <Geode/DefaultInclude.hpp> | ||
#include <Geode/ui/Popup.hpp> | ||
|
||
using namespace geode::prelude; | ||
|
||
class AboutBEPopup : public Popup<> { | ||
protected: | ||
bool setup() override; | ||
|
||
public: | ||
static AboutBEPopup* create(); | ||
|
||
void onSettings(CCObject*); | ||
void onSupport(CCObject*); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
BetterEdit is first and foremost <cy>a passion project</c>, but if you would like to support development, I have a Ko-fi! | ||
|
||
[Link to my Ko-fi](https://ko-fi.com/hjfod) | ||
|
||
I'm also planning on making a <cb>paid Pro version</c> in the future with some cool extra features :) | ||
|
||
However, please <cr>don't donate just for the purpose of getting Pro</c>! While I fully intended to make it, I know from past experience that something might come in the way, and <cr>I do not want to receive money for a product until I can guarantee it exists</c>. | ||
|
||
## <cy>Do not donate any money you need yourself</c>. | ||
|
||
I don't want starving students to give me their last pennies! Take care of yourself first! |