mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
Compare commits
6 commits
7ae4b1573e
...
23ba26b200
Author | SHA1 | Date | |
---|---|---|---|
|
23ba26b200 | ||
|
df24b24c44 | ||
|
ed97f3b040 | ||
|
aee27805e5 | ||
|
bd6bfb661f | ||
|
03e8220dfe |
6 changed files with 114 additions and 6 deletions
|
@ -1,5 +1,8 @@
|
||||||
# Geode Changelog
|
# Geode Changelog
|
||||||
|
|
||||||
|
## v4.0.1
|
||||||
|
* Add cutoff constructor for CCRenderTexture (#1171)
|
||||||
|
|
||||||
## v4.0.0
|
## v4.0.0
|
||||||
* Make chosen display type in mod list be saved between startups (07d92a3)
|
* Make chosen display type in mod list be saved between startups (07d92a3)
|
||||||
* Fix `Task::all` not returning results in order (227adb0)
|
* Fix `Task::all` not returning results in order (227adb0)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
4.0.0
|
4.0.1
|
||||||
|
|
|
@ -61,6 +61,8 @@ class CC_DLL CCRenderTexture : public CCNode
|
||||||
*/
|
*/
|
||||||
CC_PROPERTY(CCSprite*, m_pSprite, Sprite)
|
CC_PROPERTY(CCSprite*, m_pSprite, Sprite)
|
||||||
public:
|
public:
|
||||||
|
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCRenderTexture, CCNode)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -155,12 +155,12 @@ namespace cocos2d
|
||||||
static gd::string base64EncodeEnc(gd::string const&, gd::string);
|
static gd::string base64EncodeEnc(gd::string const&, gd::string);
|
||||||
static gd::string base64URLDecode(gd::string const&);
|
static gd::string base64URLDecode(gd::string const&);
|
||||||
static gd::string base64URLEncode(gd::string const&);
|
static gd::string base64URLEncode(gd::string const&);
|
||||||
static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**);
|
static int ccDeflateMemory(unsigned char* data, unsigned int size, unsigned char** out);
|
||||||
static int ccDeflateMemoryWithHint(unsigned char*, unsigned int, unsigned char**, unsigned int);
|
static int ccDeflateMemoryWithHint(unsigned char*, unsigned int, unsigned char**, unsigned int);
|
||||||
static gd::string compressString(gd::string const&, bool, int);
|
static gd::string compressString(gd::string const& data, bool encrypt, int encryptionKey);
|
||||||
static gd::string decompressString(gd::string const&, bool, int);
|
static gd::string decompressString(gd::string const& data, bool encrypt, int encryptionKey);
|
||||||
static gd::string decompressString2(unsigned char*, bool, int, int);
|
static gd::string decompressString2(unsigned char* data, bool encrypt, int size, int encryptionKey);
|
||||||
static gd::string encryptDecrypt(gd::string const&, int);
|
static gd::string encryptDecrypt(gd::string const& data, int encryptionKey);
|
||||||
static gd::string encryptDecryptWKey(gd::string const&, gd::string);
|
static gd::string encryptDecryptWKey(gd::string const&, gd::string);
|
||||||
static unsigned char hexToChar(const gd::string&);
|
static unsigned char hexToChar(const gd::string&);
|
||||||
static gd::string urlDecode(const gd::string&);
|
static gd::string urlDecode(const gd::string&);
|
||||||
|
|
41
loader/include/Geode/ui/OverlayManager.hpp
Normal file
41
loader/include/Geode/ui/OverlayManager.hpp
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../DefaultInclude.hpp"
|
||||||
|
|
||||||
|
#include <cocos2d.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <span>
|
||||||
|
#include <Geode/utils/cocos.hpp>
|
||||||
|
|
||||||
|
namespace geode
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Because cocos only allows for one notification node (a node drawn last, above the fps counter and everything),
|
||||||
|
I added this, a simple class to add nodes to a general notification node so that mods dont interfere with each other.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GEODE_DLL OverlayManager : private cocos2d::CCNode
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::vector<cocos2d::CCNode*> nodes;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// @brief Get the overlay manager instance, and if it doesnt exist, sets the notification node to it
|
||||||
|
static OverlayManager* get();
|
||||||
|
|
||||||
|
/// @brief Adds a node to the overlay manager, overlays are sorted by ZOrder, the higher the order is the later it draws. This will retain the node
|
||||||
|
void addNode(cocos2d::CCNode* node);
|
||||||
|
|
||||||
|
/// @brief Removes a node from the overlay manager, stopping it from being drawn. This will release the node
|
||||||
|
void removeNode(cocos2d::CCNode* node);
|
||||||
|
|
||||||
|
/// @brief Util to get the highest ZOrder of all nodes
|
||||||
|
int getHighestOverlayZOrder();
|
||||||
|
|
||||||
|
/// @brief Util to get the lowest ZOrder of all nodes
|
||||||
|
int getLowestOverlayZOrder();
|
||||||
|
|
||||||
|
/// @brief Gets all the overlays
|
||||||
|
std::vector<cocos2d::CCNode*> getOverlays();
|
||||||
|
};
|
||||||
|
};
|
62
loader/src/ui/nodes/OverlayManager.cpp
Normal file
62
loader/src/ui/nodes/OverlayManager.cpp
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
#include <Geode/ui/OverlayManager.hpp>
|
||||||
|
|
||||||
|
using namespace geode::prelude;
|
||||||
|
|
||||||
|
OverlayManager* OverlayManager::get()
|
||||||
|
{
|
||||||
|
static OverlayManager* instance;
|
||||||
|
|
||||||
|
if (!instance)
|
||||||
|
{
|
||||||
|
instance = new OverlayManager();
|
||||||
|
|
||||||
|
CCDirector::get()->setNotificationNode(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverlayManager::addNode(CCNode* node)
|
||||||
|
{
|
||||||
|
this->addChild(node);
|
||||||
|
|
||||||
|
nodes.push_back(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverlayManager::removeNode(CCNode* node)
|
||||||
|
{
|
||||||
|
this->removeChild(node);
|
||||||
|
|
||||||
|
std::erase(nodes, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
int OverlayManager::getHighestOverlayZOrder()
|
||||||
|
{
|
||||||
|
int z = INT_MIN;
|
||||||
|
|
||||||
|
for (auto node : nodes)
|
||||||
|
{
|
||||||
|
if (node->getZOrder() > z)
|
||||||
|
z = node->getZOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
int OverlayManager::getLowestOverlayZOrder()
|
||||||
|
{
|
||||||
|
int z = INT_MAX;
|
||||||
|
|
||||||
|
for (auto node : nodes)
|
||||||
|
{
|
||||||
|
if (node->getZOrder() < z)
|
||||||
|
z = node->getZOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CCNode*> OverlayManager::getOverlays()
|
||||||
|
{
|
||||||
|
return nodes;
|
||||||
|
}
|
Loading…
Reference in a new issue