Compare commits

...

19 commits

Author SHA1 Message Date
Justin Pridgen
3222c12e90 texture revamp by @Alphalaneous 2024-08-19 07:38:14 -04:00
Justin Pridgen
f45b8b7128 almost forgot 2024-08-19 07:02:55 -04:00
Justin Pridgen
0da9cef29f made it slightly better 2024-08-19 07:01:50 -04:00
Justin Pridgen
9a46231420 Merge branch 'main' of https://github.com/geode-sdk/geode into copy-mods 2024-08-19 06:06:46 -04:00
mat
e5dd2c9c40
update json
cda9807f63
2024-08-16 18:13:49 -03:00
Cvolton
cd5a66c1d1 add Notification::Cancel 2024-08-15 15:43:45 +02:00
HJfod
ff8de4eec6
Merge pull request #1036 from Prevter/lightning
cocos2d::CCLightning
2024-08-13 21:26:25 +03:00
HJfod
1b5ae86f7b fix s_idCounter missing definition 2024-08-13 13:42:24 +03:00
HJfod
1f2aa2ced7 how did i not notice- 2024-08-13 13:37:41 +03:00
HJfod
00e191accb
Merge pull request #1040 from SMJSGaming/main
Added IDs to web request to prevent incompatibilities between web mods
2024-08-13 11:35:49 +03:00
SMJSGaming
58402e9b7b Made the ID system thread safe 2024-08-13 10:11:54 +02:00
SMJSGaming
a5bbf6a40c Added IDs to web request to prevent incompatibilities between web mods 2024-08-13 09:05:59 +02:00
Oleksandr Nemesh
3ea6001ca4
fix members 2024-08-10 18:58:32 +03:00
Oleksandr Nemesh
bcff1652b8
Merge branch 'geode-sdk:main' into lightning 2024-08-10 13:37:18 +03:00
Oleksandr Nemesh
fca774adbf
cleanup the header 2024-08-10 13:37:08 +03:00
Oleksandr Nemesh
94dc60a7f2
fix whitespace 2024-07-24 12:34:55 +03:00
Oleksandr Nemesh
e46353908d
fix ccColor 2024-07-11 14:50:09 +03:00
Oleksandr Nemesh
0ee2b5beb2
add include 2024-07-11 14:46:55 +03:00
Oleksandr Nemesh
360827e766
add cclightning 2024-07-11 14:45:03 +03:00
9 changed files with 133 additions and 30 deletions

View file

@ -213,7 +213,7 @@ if (ANDROID)
endif()
set(MAT_JSON_AS_INTERFACE ON)
CPMAddPackage("gh:geode-sdk/json#3a79c51")
CPMAddPackage("gh:geode-sdk/json#cda9807")
CPMAddPackage("gh:fmtlib/fmt#10.2.1")
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)

View file

@ -325,6 +325,8 @@ THE SOFTWARE.
#include "../robtop/scene_nodes/CCSceneTransitionDelegate.h"
#include "../robtop/special_nodes/CCLightning.h"
#include "../robtop/xml/DS_Dictionary.h"
#include "../robtop/xml/ObjectDecoder.h"

View file

@ -0,0 +1,70 @@
#ifndef __CCLIGHTNING_H__
#define __CCLIGHTNING_H__
#include "../../include/ccMacros.h"
#include "../../base_nodes/CCNode.h"
NS_CC_BEGIN
// @note RobTop Addition
class CCLightning : public CCNode, public CCRGBAProtocol {
public:
CCLightning();
virtual ~CCLightning();
static CCLightning* lightningWithStrikePoint(CCPoint strikePoint, CCPoint strikePoint2, float duration);
static CCLightning* lightningWithStrikePoint(CCPoint strikePoint);
bool initWithStrikePoint(CCPoint strikePoint, CCPoint strikePoint2, float duration);
bool initWithStrikePoint(CCPoint strikePoint);
void strike();
void strikeFinished();
void strikeRandom();
void strikeWithSeed(uint64_t seed);
void draw();
// cocos2d::CCRGBAProtocol
bool isOpacityModifyRGB();
void setOpacityModifyRGB(bool);
unsigned char getOpacity();
unsigned char getDisplayedOpacity();
void setOpacity(unsigned char);
void updateDisplayedOpacity(unsigned char);
bool isCascadeColorEnabled();
void setCascadeOpacityEnabled(bool);
ccColor3B const& getColor();
ccColor3B const& getDisplayedColor();
void setColor(ccColor3B const&);
void updateDisplayedColor(ccColor3B const&);
bool isCascadeOpacityEnabled();
void setCascadeColorEnabled(bool);
protected:
CCPoint m_strikePoint;
CCPoint m_strikePoint2;
bool m_split;
int m_displacement;
int m_minDisplacement;
uint64_t m_seed;
float m_lineWidth;
bool m_unkBool;
bool m_removeAfterFinished;
float m_duration;
float m_opacityModify;
std::array<CCPoint, 200>* m_lightningPoints;
uint32_t m_numPoints;
uint8_t m_displayedOpacity;
uint8_t m_opacity;
ccColor3B m_displayedColor;
ccColor3B m_color;
bool m_cascadeColorEnabled;
bool m_cascadeOpacityEnabled;
bool m_opacityModifyEnabled;
};
NS_CC_END
#endif //__CCLIGHTNING_H__

View file

@ -93,5 +93,11 @@ namespace geode {
* to prematurily hide the notification
*/
void hide();
/**
* Cancels the showing of the notification if it's in the queue.
* Otherwise, it hides the notification if it's currently showing.
*/
void cancel();
};
}

View file

@ -113,7 +113,6 @@ namespace geode::utils::web {
class Impl;
std::shared_ptr<Impl> m_impl;
public:
WebRequest();
~WebRequest();
@ -253,6 +252,13 @@ namespace geode::utils::web {
*/
WebRequest& bodyJSON(matjson::Value const& json);
/**
* Gets the unique request ID
*
* @return size_t
*/
size_t getID() const;
/**
* Gets the request method as a string

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -714,37 +714,37 @@ void ModsLayer::onSettings(CCObject*) {
}
void ModsLayer::onCopy(CCObject*) {
auto text = "No mods installed";
auto mods = Loader::get()->getAllMods();
if (!mods.empty()) {
text = "Mods list copied to clipboard!";
std::sort(mods.begin(), mods.end(), [](Mod* a, Mod* b) {
auto const s1 = a->getID();
auto const s2 = b->getID();
return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](auto a, auto b) {
return std::tolower(a) < std::tolower(b);
});
});
std::stringstream ss;
using namespace std::string_view_literals;
for (int i = 0; i < mods.size(); i++) {
auto& mod = mods[i];
ss << fmt::format("{} | [{}] {}",
mod->isEnabled() ? "x"sv :
mod->hasProblems() ? "!"sv :
" "sv,
mod->getVersion().toVString(), mod->getID()
);
if (i != mods.size() - 1) {
ss << "\n";
}
}
clipboard::write(ss.str());
if (mods.empty()) {
Notification::create("No mods installed", NotificationIcon::Info, 0.5f)->show();
return;
}
auto popup = TextAlertPopup::create(text, 0.5f, 0.6f, 150, "bigFont.fnt");
this->addChild(popup, 100);
std::sort(mods.begin(), mods.end(), [](Mod* a, Mod* b) {
auto const s1 = a->getID();
auto const s2 = b->getID();
return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](auto a, auto b) {
return std::tolower(a) < std::tolower(b);
});
});
std::stringstream ss;
using namespace std::string_view_literals;
for (int i = 0; i < mods.size(); i++) {
auto& mod = mods[i];
ss << fmt::format("{} | [{}] {}",
mod->isEnabled() ? "x"sv :
mod->hasProblems() ? "!"sv :
" "sv,
mod->getVersion().toVString(), mod->getID()
);
if (i != mods.size() - 1) {
ss << "\n";
}
}
clipboard::write(ss.str());
Notification::create("Mods list copied to clipboard", NotificationIcon::Info, 0.5f)->show();
}
ModsLayer* ModsLayer::create() {

View file

@ -211,3 +211,11 @@ void Notification::hide() {
nullptr
));
}
void Notification::cancel() {
if(m_pParent) return this->hide();
if (s_queue->containsObject(this)) {
s_queue->removeObject(this);
}
}

View file

@ -188,6 +188,8 @@ std::optional<float> WebProgress::uploadProgress() const {
class WebRequest::Impl {
public:
static std::atomic_size_t s_idCounter;
std::string m_method;
std::string m_url;
std::unordered_map<std::string, std::string> m_headers;
@ -203,6 +205,9 @@ public:
std::string m_CABundleContent;
ProxyOpts m_proxyOpts = {};
HttpVersion m_httpVersion = HttpVersion::DEFAULT;
size_t m_id;
Impl() : m_id(s_idCounter++) {}
WebResponse makeError(int code, std::string const& msg) {
auto res = WebResponse();
@ -212,6 +217,8 @@ public:
}
};
std::atomic_size_t WebRequest::Impl::s_idCounter = 0;
WebRequest::WebRequest() : m_impl(std::make_shared<Impl>()) {}
WebRequest::~WebRequest() {}
@ -584,6 +591,10 @@ WebRequest& WebRequest::bodyJSON(matjson::Value const& json) {
return *this;
}
size_t WebRequest::getID() const {
return m_impl->m_id;
}
std::string WebRequest::getMethod() const {
return m_impl->m_method;
}