This commit is contained in:
altalk23 2023-01-25 18:10:15 +03:00
commit 0cf0a6d9d3
7 changed files with 75 additions and 32 deletions

View file

@ -7,6 +7,7 @@ name = "Geode"
version = "v1.0.0-beta"
repository = "https://github.com/geode-sdk/geode"
tree = "https://github.com/geode-sdk/geode/tree/main"
icon = "loader/resources/logos/geode-circle.png"
[[sources]]
name = "Geode"

View file

@ -23,6 +23,7 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
src/loader/*.cpp
src/main.cpp
src/utils/*.cpp
src/ui/*.cpp
src/ui/nodes/*.cpp
src/ui/internal/*.cpp
src/ui/internal/credits/*.cpp

View file

@ -89,7 +89,7 @@ namespace geode {
/**
* Support info for the mod; this means anything to show ways to
* support the mod's development, like donations. Written in Markdown
* (see <Geode/ui/MDTextArea.hpp>) for more info
* (see MDTextArea for more info)
*/
std::optional<std::string> supportInfo;
/**

View file

@ -5,7 +5,7 @@
namespace geode {
/**
* FLAlertLayer with support for Markdown. See <Geode/ui/MDTextArea.hpp>
* FLAlertLayer with support for Markdown. See MDTextArea
* for details on what features of MD are supported.
*/
class MDPopup :

View file

@ -24,6 +24,7 @@ namespace geode {
* - Bold & italic
* - Horizontal rules
* - Lists
*
* Note that links also have some special protocols.
* Use `user:<id>` or `user:<name>` to link to a GD
* account; `level:<id>` to link to a GD level and

View file

@ -196,12 +196,7 @@ namespace geode {
*
* @tparam T A type that inherits from CCObject.
*
* @example[flash]
* #include <Geode/utils/cocos.hpp>
*
* USE_GEODE_NAMESPACE();
*
* //!flash-snippet-start
* @example
* class MyNode : public CCNode {
* protected:
* // no need to manually call retain or
@ -219,20 +214,8 @@ namespace geode {
* return true;
* }
* };
* //!flash-snippet-end
*
* @example[flash]
* #include <Geode/utils/cocos.hpp>
* #include <Geode/modify/MenuLayer.hpp>
*
* USE_GEODE_NAMESPACE();
*
* class ModifyMenuLayer : public MenuLayer {
* bool init() {
* if (!MenuLayer::init())
* return false;
*
* //!flash-snippet-start
* @example
* // Save a child from the current layer into a menu
* Ref<CCMenu> menu = static_cast<CCMenu*>(this->getChildByID("main-menu"));
*
@ -240,11 +223,6 @@ namespace geode {
* menu->removeFromParent();
*
* // Menu will still point to a valid CCMenu as long as the menu variable exist
* //!flash-snippet-end
*
* return true;
* }
* };
*/
template <class T>
class Ref final {

View file

@ -9,6 +9,7 @@
#include <Geode/ui/GeodeUI.hpp>
#include <Geode/ui/Notification.hpp>
#include <Geode/ui/Popup.hpp>
#include <Geode/ui/MDPopup.hpp>
#include <Geode/utils/cocos.hpp>
#include <loader/ModImpl.hpp>
#include <loader/LoaderImpl.hpp>
@ -68,14 +69,17 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
CircleBaseColor::Green,
CircleBaseSize::Medium2
);
auto geodeBtnSelector = &CustomMenuLayer::onGeode;
if (!m_fields->m_geodeButton) {
geodeBtnSelector = &CustomMenuLayer::onMissingTextures;
m_fields->m_geodeButton = ButtonSprite::create("!!");
}
auto bottomMenu = static_cast<CCMenu*>(this->getChildByID("bottom-menu"));
auto btn = CCMenuItemSpriteExtra::create(
m_fields->m_geodeButton, this, menu_selector(CustomMenuLayer::onGeode)
m_fields->m_geodeButton, this,
static_cast<SEL_MenuHandler>(geodeBtnSelector)
);
btn->setID("geode-button"_spr);
bottomMenu->addChild(btn);
@ -193,6 +197,64 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
}
}
void onMissingTextures(CCObject*) {
static bool shownInfoPopup = false;
if (shownInfoPopup) {
return this->onGeode(nullptr);
}
shownInfoPopup = true;
#ifdef GEODE_IS_DESKTOP
try {
ghc::filesystem::create_directories(dirs::getGeodeDir() / "update" / "resources");
} catch(...) {}
createQuickPopup(
"Missing Textures",
"You appear to be missing textures, and the automatic texture fixer "
"hasn't fixed the issue.\n"
"Download <cy>resources.zip</c> from the latest release on GitHub, "
"and <cy>unzip its contents</c> into <cb>geode/update/resources</c>.\n"
"Afterwards, <cg>restart the game</c>.\n"
"You may also continue without installing resources, but be aware that "
"the game <cr>will crash</c>.",
"Dismiss", "Open Github",
[](auto, bool btn2) {
if (btn2) {
web::openLinkInBrowser("https://github.com/geode-sdk/geode/releases/latest");
file::openFolder(dirs::getGeodeDir() / "update" / "resources");
FLAlertLayer::create(
"Info",
"Opened GitHub in your browser and the destination in "
"your file browser.\n"
"Download <cy>resources.zip</c>, "
"and <cy>unzip its contents</c> into the destination "
"folder.\n"
"<cb>Don't add any new folders to the destination!</c>",
"OK"
)->show();
}
}
);
#else
// dunno if we can auto-create target directory on mobile, nor if the
// user has access to moving stuff there
FLAlertLayer::create(
"Missing Textures",
"You appear to be missing textures, and the automatic texture fixer "
"hasn't fixed the issue.\n"
"**<cy>Report this bug to the Geode developers</c>**. It is very likely "
"that your game <cr>will crash</c> until the issue is resolved.",
"OK"
)->show();
#endif
}
void onGeode(CCObject*) {
ModListLayer::scene();
}