mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-10 21:27:52 -04:00
Merge branch 'main' of https://github.com/geode-sdk/geode
This commit is contained in:
commit
0cf0a6d9d3
7 changed files with 75 additions and 32 deletions
|
@ -7,6 +7,7 @@ name = "Geode"
|
||||||
version = "v1.0.0-beta"
|
version = "v1.0.0-beta"
|
||||||
repository = "https://github.com/geode-sdk/geode"
|
repository = "https://github.com/geode-sdk/geode"
|
||||||
tree = "https://github.com/geode-sdk/geode/tree/main"
|
tree = "https://github.com/geode-sdk/geode/tree/main"
|
||||||
|
icon = "loader/resources/logos/geode-circle.png"
|
||||||
|
|
||||||
[[sources]]
|
[[sources]]
|
||||||
name = "Geode"
|
name = "Geode"
|
||||||
|
|
|
@ -23,6 +23,7 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
|
||||||
src/loader/*.cpp
|
src/loader/*.cpp
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/utils/*.cpp
|
src/utils/*.cpp
|
||||||
|
src/ui/*.cpp
|
||||||
src/ui/nodes/*.cpp
|
src/ui/nodes/*.cpp
|
||||||
src/ui/internal/*.cpp
|
src/ui/internal/*.cpp
|
||||||
src/ui/internal/credits/*.cpp
|
src/ui/internal/credits/*.cpp
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace geode {
|
||||||
/**
|
/**
|
||||||
* Support info for the mod; this means anything to show ways to
|
* Support info for the mod; this means anything to show ways to
|
||||||
* support the mod's development, like donations. Written in Markdown
|
* 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;
|
std::optional<std::string> supportInfo;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace geode {
|
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.
|
* for details on what features of MD are supported.
|
||||||
*/
|
*/
|
||||||
class MDPopup :
|
class MDPopup :
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace geode {
|
||||||
* - Bold & italic
|
* - Bold & italic
|
||||||
* - Horizontal rules
|
* - Horizontal rules
|
||||||
* - Lists
|
* - Lists
|
||||||
|
*
|
||||||
* Note that links also have some special protocols.
|
* Note that links also have some special protocols.
|
||||||
* Use `user:<id>` or `user:<name>` to link to a GD
|
* Use `user:<id>` or `user:<name>` to link to a GD
|
||||||
* account; `level:<id>` to link to a GD level and
|
* account; `level:<id>` to link to a GD level and
|
||||||
|
|
|
@ -196,12 +196,7 @@ namespace geode {
|
||||||
*
|
*
|
||||||
* @tparam T A type that inherits from CCObject.
|
* @tparam T A type that inherits from CCObject.
|
||||||
*
|
*
|
||||||
* @example[flash]
|
* @example
|
||||||
* #include <Geode/utils/cocos.hpp>
|
|
||||||
*
|
|
||||||
* USE_GEODE_NAMESPACE();
|
|
||||||
*
|
|
||||||
* //!flash-snippet-start
|
|
||||||
* class MyNode : public CCNode {
|
* class MyNode : public CCNode {
|
||||||
* protected:
|
* protected:
|
||||||
* // no need to manually call retain or
|
* // no need to manually call retain or
|
||||||
|
@ -219,20 +214,8 @@ namespace geode {
|
||||||
* return true;
|
* return true;
|
||||||
* }
|
* }
|
||||||
* };
|
* };
|
||||||
* //!flash-snippet-end
|
|
||||||
*
|
*
|
||||||
* @example[flash]
|
* @example
|
||||||
* #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
|
|
||||||
* // Save a child from the current layer into a menu
|
* // Save a child from the current layer into a menu
|
||||||
* Ref<CCMenu> menu = static_cast<CCMenu*>(this->getChildByID("main-menu"));
|
* Ref<CCMenu> menu = static_cast<CCMenu*>(this->getChildByID("main-menu"));
|
||||||
*
|
*
|
||||||
|
@ -240,11 +223,6 @@ namespace geode {
|
||||||
* menu->removeFromParent();
|
* menu->removeFromParent();
|
||||||
*
|
*
|
||||||
* // Menu will still point to a valid CCMenu as long as the menu variable exist
|
* // Menu will still point to a valid CCMenu as long as the menu variable exist
|
||||||
* //!flash-snippet-end
|
|
||||||
*
|
|
||||||
* return true;
|
|
||||||
* }
|
|
||||||
* };
|
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
class Ref final {
|
class Ref final {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <Geode/ui/GeodeUI.hpp>
|
#include <Geode/ui/GeodeUI.hpp>
|
||||||
#include <Geode/ui/Notification.hpp>
|
#include <Geode/ui/Notification.hpp>
|
||||||
#include <Geode/ui/Popup.hpp>
|
#include <Geode/ui/Popup.hpp>
|
||||||
|
#include <Geode/ui/MDPopup.hpp>
|
||||||
#include <Geode/utils/cocos.hpp>
|
#include <Geode/utils/cocos.hpp>
|
||||||
#include <loader/ModImpl.hpp>
|
#include <loader/ModImpl.hpp>
|
||||||
#include <loader/LoaderImpl.hpp>
|
#include <loader/LoaderImpl.hpp>
|
||||||
|
@ -68,14 +69,17 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
|
||||||
CircleBaseColor::Green,
|
CircleBaseColor::Green,
|
||||||
CircleBaseSize::Medium2
|
CircleBaseSize::Medium2
|
||||||
);
|
);
|
||||||
|
auto geodeBtnSelector = &CustomMenuLayer::onGeode;
|
||||||
if (!m_fields->m_geodeButton) {
|
if (!m_fields->m_geodeButton) {
|
||||||
|
geodeBtnSelector = &CustomMenuLayer::onMissingTextures;
|
||||||
m_fields->m_geodeButton = ButtonSprite::create("!!");
|
m_fields->m_geodeButton = ButtonSprite::create("!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bottomMenu = static_cast<CCMenu*>(this->getChildByID("bottom-menu"));
|
auto bottomMenu = static_cast<CCMenu*>(this->getChildByID("bottom-menu"));
|
||||||
|
|
||||||
auto btn = CCMenuItemSpriteExtra::create(
|
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);
|
btn->setID("geode-button"_spr);
|
||||||
bottomMenu->addChild(btn);
|
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*) {
|
void onGeode(CCObject*) {
|
||||||
ModListLayer::scene();
|
ModListLayer::scene();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue