2022-10-11 09:45:56 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../loader/Mod.hpp"
|
2024-07-29 08:58:02 -04:00
|
|
|
#include <Geode/binding/FLAlertLayer.hpp>
|
2024-10-02 18:51:06 -04:00
|
|
|
#include <Geode/ui/Popup.hpp>
|
2022-10-11 09:45:56 -04:00
|
|
|
|
2024-07-29 08:14:49 -04:00
|
|
|
class ModPopup;
|
|
|
|
class ModItem;
|
|
|
|
class ModLogoSprite;
|
2024-07-29 08:58:47 -04:00
|
|
|
class FLAlertLayer; // for macos :3
|
2024-07-29 08:14:49 -04:00
|
|
|
|
2022-10-11 09:45:56 -04:00
|
|
|
namespace geode {
|
2024-07-29 08:14:49 -04:00
|
|
|
/**
|
|
|
|
* Event posted whenever a popup is opened for a mod. Allows mods to modify
|
|
|
|
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
|
|
|
* for **very important notes on these events**!
|
|
|
|
*/
|
|
|
|
class GEODE_DLL ModPopupUIEvent final : public Event {
|
|
|
|
private:
|
|
|
|
class Impl;
|
|
|
|
std::unique_ptr<Impl> m_impl;
|
|
|
|
|
|
|
|
friend class ::ModPopup;
|
|
|
|
|
|
|
|
ModPopupUIEvent(std::unique_ptr<Impl>&& impl);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~ModPopupUIEvent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the popup itself
|
|
|
|
*/
|
|
|
|
FLAlertLayer* getPopup() const;
|
|
|
|
/**
|
|
|
|
* Get the ID of the mod this popup is for
|
|
|
|
*/
|
|
|
|
std::string getModID() const;
|
|
|
|
/**
|
|
|
|
* If this popup is of an installed mod, get it
|
|
|
|
*/
|
|
|
|
std::optional<Mod*> getMod() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event posted whenever a logo sprite is created for a mod. Allows mods to modify
|
|
|
|
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
|
|
|
* for **very important notes on these events**!
|
|
|
|
*/
|
|
|
|
class GEODE_DLL ModItemUIEvent final : public Event {
|
|
|
|
private:
|
|
|
|
class Impl;
|
|
|
|
std::unique_ptr<Impl> m_impl;
|
|
|
|
|
|
|
|
friend class ::ModItem;
|
|
|
|
|
|
|
|
ModItemUIEvent(std::unique_ptr<Impl>&& impl);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~ModItemUIEvent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the item itself
|
|
|
|
*/
|
|
|
|
cocos2d::CCNode* getItem() const;
|
|
|
|
/**
|
|
|
|
* Get the ID of the mod this logo is for
|
|
|
|
*/
|
|
|
|
std::string getModID() const;
|
|
|
|
/**
|
|
|
|
* If this logo is of an installed mod, get it
|
|
|
|
*/
|
|
|
|
std::optional<Mod*> getMod() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event posted whenever a logo sprite is created for a mod. Allows mods to modify
|
|
|
|
* the Geode UI. See the [tutorial on Geode UI modification](https://docs.geode-sdk.org/tutorials/modify-geode)
|
|
|
|
* for **very important notes on these events**!
|
|
|
|
*/
|
|
|
|
class GEODE_DLL ModLogoUIEvent final : public Event {
|
|
|
|
private:
|
|
|
|
class Impl;
|
|
|
|
std::unique_ptr<Impl> m_impl;
|
|
|
|
|
|
|
|
friend class ::ModLogoSprite;
|
|
|
|
|
|
|
|
ModLogoUIEvent(std::unique_ptr<Impl>&& impl);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~ModLogoUIEvent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the sprite itself
|
|
|
|
*/
|
|
|
|
cocos2d::CCNode* getSprite() const;
|
|
|
|
/**
|
|
|
|
* Get the ID of the mod this logo is for
|
|
|
|
*/
|
|
|
|
std::string getModID() const;
|
|
|
|
/**
|
|
|
|
* If this logo is of an installed mod, get it
|
|
|
|
*/
|
|
|
|
std::optional<Mod*> getMod() const;
|
|
|
|
};
|
|
|
|
|
2022-10-11 09:45:56 -04:00
|
|
|
/**
|
|
|
|
* Open the Geode mods list
|
|
|
|
*/
|
|
|
|
GEODE_DLL void openModsList();
|
|
|
|
/**
|
|
|
|
* Open the info popup for a mod
|
|
|
|
*/
|
|
|
|
GEODE_DLL void openInfoPopup(Mod* mod);
|
2024-07-29 05:50:56 -04:00
|
|
|
/**
|
|
|
|
* Open the info popup for a mod based on an ID. If the mod is installed,
|
|
|
|
* its installed popup is opened. Otherwise will check if the servers
|
|
|
|
* have this mod, or if not, show an error popup
|
2024-07-29 06:10:42 -04:00
|
|
|
* @returns A Task that completes to `true` if the mod was found and a
|
|
|
|
* popup was opened, and `false` otherwise. If you wish to modify the
|
|
|
|
* created popup, listen for the Geode UI events listed in `GeodeUI.hpp`
|
2024-07-29 05:50:56 -04:00
|
|
|
*/
|
2024-07-29 06:10:42 -04:00
|
|
|
GEODE_DLL Task<bool> openInfoPopup(std::string const& modID);
|
2024-07-05 17:07:30 -04:00
|
|
|
/**
|
|
|
|
* Open the info popup for a mod on the changelog page
|
|
|
|
*/
|
|
|
|
GEODE_DLL void openChangelogPopup(Mod* mod);
|
2022-12-06 14:22:03 -05:00
|
|
|
/**
|
|
|
|
* Open the issue report popup for a mod
|
|
|
|
*/
|
|
|
|
GEODE_DLL void openIssueReportPopup(Mod* mod);
|
2024-02-10 14:11:59 -05:00
|
|
|
/**
|
|
|
|
* Open the support popup for a mod
|
|
|
|
*/
|
|
|
|
GEODE_DLL void openSupportPopup(Mod* mod);
|
2024-03-23 18:33:46 -04:00
|
|
|
GEODE_DLL void openSupportPopup(ModMetadata const& metadata);
|
2022-10-11 09:45:56 -04:00
|
|
|
/**
|
|
|
|
* Open the settings popup for a mod (if it has any settings)
|
2022-10-30 14:59:20 -04:00
|
|
|
*/
|
2022-10-11 09:45:56 -04:00
|
|
|
GEODE_DLL void openSettingsPopup(Mod* mod);
|
2024-09-21 08:33:59 -04:00
|
|
|
/**
|
|
|
|
* Open the settings popup for a mod (if it has any settings)
|
|
|
|
* @param mod Mod the open the popup for
|
|
|
|
* @param disableGeodeTheme If false, the popup follows the user's chosen
|
|
|
|
* theme options. If true, the popup is always in the GD theme (not Geode's
|
|
|
|
* dark purple colors)
|
|
|
|
* @returns A pointer to the created Popup, or null if the mod has no
|
|
|
|
* settings
|
|
|
|
*/
|
|
|
|
GEODE_DLL Popup<Mod*>* openSettingsPopup(Mod* mod, bool disableGeodeTheme);
|
2022-12-06 14:22:03 -05:00
|
|
|
/**
|
|
|
|
* Create a default logo sprite
|
|
|
|
*/
|
2024-02-21 19:04:38 -05:00
|
|
|
GEODE_DLL cocos2d::CCNode* createDefaultLogo();
|
2022-12-06 14:22:03 -05:00
|
|
|
/**
|
|
|
|
* Create a logo sprite for a mod
|
|
|
|
*/
|
2024-02-21 19:04:38 -05:00
|
|
|
GEODE_DLL cocos2d::CCNode* createModLogo(Mod* mod);
|
2022-12-06 14:22:03 -05:00
|
|
|
/**
|
2024-02-26 17:55:33 -05:00
|
|
|
* Create a logo sprite for a mod downloaded from the Geode servers. The
|
|
|
|
* logo is initially a loading circle, with the actual sprite downloaded
|
|
|
|
* asynchronously
|
2022-12-06 14:22:03 -05:00
|
|
|
*/
|
2024-02-28 14:33:58 -05:00
|
|
|
GEODE_DLL cocos2d::CCNode* createServerModLogo(std::string const& id);
|
2022-10-11 09:45:56 -04:00
|
|
|
}
|