-
-
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.
- Loading branch information
Showing
16 changed files
with
283 additions
and
18 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
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 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,68 @@ | ||
#include <Geode/modify/CreateParticlePopup.hpp> | ||
|
||
using namespace geode::prelude; | ||
|
||
class $modify(CopyParticleStringPopup, CreateParticlePopup) { | ||
$override | ||
bool init(ParticleGameObject* obj, CCArray* objs, gd::string str) { | ||
if (!CreateParticlePopup::init(obj, objs, str)) | ||
return false; | ||
|
||
if (!Mod::get()->template getSettingValue<bool>("dev-mode")) { | ||
return true; | ||
} | ||
|
||
auto menu = CCMenu::create(); | ||
menu->setID("side-menu"_spr); | ||
menu->setPosition(m_obContentSize.width / 2 - 100, 30); | ||
|
||
if (obj) { | ||
auto copySpr = ButtonSprite::create("CS", "bigFont.fnt", "GJ_button_05.png", .8f); | ||
auto copyBtn = CCMenuItemSpriteExtra::create( | ||
copySpr, this, menu_selector(CopyParticleStringPopup::onCopyString) | ||
); | ||
menu->addChild(copyBtn); | ||
|
||
auto pasteSpr = ButtonSprite::create("PS", "bigFont.fnt", "GJ_button_05.png", .8f); | ||
auto pasteBtn = CCMenuItemSpriteExtra::create( | ||
pasteSpr, this, menu_selector(CopyParticleStringPopup::onPasteString) | ||
); | ||
menu->addChild(pasteBtn); | ||
} | ||
|
||
menu->setLayout(RowLayout::create()->setDefaultScaleLimits(.1f, .3f)); | ||
m_mainLayer->addChild(menu); | ||
|
||
handleTouchPriority(this); | ||
|
||
return true; | ||
} | ||
|
||
void onCopyString(CCObject*) { | ||
if (m_targetObject) { | ||
if (clipboard::write(GameToolbox::saveParticleToString(m_particle))) { | ||
Notification::create( | ||
"Copied Particle String to Clipboard", | ||
NotificationIcon::Success | ||
)->show(); | ||
} | ||
else { | ||
Notification::create( | ||
"Unable to copy Particle String", | ||
NotificationIcon::Error | ||
)->show(); | ||
} | ||
} | ||
} | ||
void onPasteString(CCObject*) { | ||
if (auto obj = m_targetObject) { | ||
this->onClose(nullptr); | ||
obj->setParticleString(clipboard::read()); | ||
CreateParticlePopup::create(obj, nullptr)->show(); | ||
Notification::create( | ||
"Pasted Particle String from Clipboard", | ||
NotificationIcon::Success | ||
)->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
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
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 "SupportPopup.hpp" | ||
#include <Geode/utils/web.hpp> | ||
|
||
bool SupportPopup::setup(bool showDontShowAgain) { | ||
m_bgSprite->setVisible(false); | ||
|
||
auto bg = CCSprite::create("support-popup.png"_spr); | ||
m_mainLayer->addChildAtPosition(bg, Anchor::Center); | ||
|
||
auto invisibleSupportSpr = ButtonSprite::create("Support", "goldFont.fnt", "GJ_button_01.png", .8f); | ||
invisibleSupportSpr->setScale(1.8f); | ||
invisibleSupportSpr->setVisible(false); | ||
auto invisibleSupportBtn = CCMenuItemSpriteExtra::create( | ||
invisibleSupportSpr, this, menu_selector(SupportPopup::onKofi) | ||
); | ||
m_buttonMenu->addChildAtPosition(invisibleSupportBtn, Anchor::Center, ccp(0, 20)); | ||
|
||
|
||
auto bottomMenu = CCMenu::create(); | ||
bottomMenu->setContentWidth(100); | ||
bottomMenu->setAnchorPoint({ .5f, .5f }); | ||
|
||
auto supportSpr = ButtonSprite::create("Support", "goldFont.fnt", "GJ_button_01.png", .8f); | ||
auto supportBtn = CCMenuItemSpriteExtra::create( | ||
supportSpr, this, menu_selector(SupportPopup::onKofi) | ||
); | ||
bottomMenu->addChild(supportBtn); | ||
|
||
bottomMenu->setLayout(RowLayout::create()->setDefaultScaleLimits(.1f, 1.f)); | ||
m_mainLayer->addChildAtPosition(bottomMenu, Anchor::Bottom, ccp(0, 18)); | ||
|
||
|
||
if (showDontShowAgain) { | ||
auto shutupMenu = CCMenu::create(); | ||
shutupMenu->setContentWidth(100); | ||
shutupMenu->setAnchorPoint({ 1, .5f }); | ||
|
||
auto shutupSpr = ButtonSprite::create("Don't Show Again", "goldFont.fnt", "GJ_button_01.png", .8f); | ||
auto shutupBtn = CCMenuItemSpriteExtra::create( | ||
shutupSpr, this, menu_selector(SupportPopup::onDontShowAgain) | ||
); | ||
shutupMenu->addChild(shutupBtn); | ||
|
||
shutupMenu->setLayout(RowLayout::create()->setDefaultScaleLimits(.1f, .5f)); | ||
m_mainLayer->addChildAtPosition(shutupMenu, Anchor::TopRight, ccp(15, 5)); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void SupportPopup::onKofi(CCObject*) { | ||
web::openLinkInBrowser("https://ko-fi.com/HJfod"); | ||
} | ||
|
||
void SupportPopup::onDontShowAgain(CCObject*) { | ||
Mod::get()->setSavedValue("dont-show-support-button", true); | ||
this->onClose(nullptr); | ||
if (auto btn = CCScene::get()->querySelector("support-be-btn"_spr)) { | ||
btn->removeFromParent(); | ||
} | ||
FLAlertLayer::create( | ||
"Support", | ||
"If you want to <cy>support BetterEdit in the future</c>, you can find the " | ||
"support button in the <cj>About</c> popup!\n\n" | ||
"<cp>This button won't be shown again :)</c>", | ||
"OK" | ||
)->show(); | ||
} | ||
|
||
SupportPopup* SupportPopup::create(bool showDontShowAgain) { | ||
auto ret = new SupportPopup(); | ||
if (ret && ret->initAnchored(410, 270, showDontShowAgain)) { | ||
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,16 @@ | ||
#pragma once | ||
|
||
#include <Geode/ui/Popup.hpp> | ||
|
||
using namespace geode::prelude; | ||
|
||
class SupportPopup : public Popup<bool> { | ||
protected: | ||
bool setup(bool showDontShowAgain) override; | ||
|
||
void onKofi(CCObject*); | ||
void onDontShowAgain(CCObject*); | ||
|
||
public: | ||
static SupportPopup* create(bool showDontShowAgain); | ||
}; |
Oops, something went wrong.