Compare commits

...

12 commits

Author SHA1 Message Date
Justin
26cc9d570c
Merge 793f554cda into adfc942fa0 2024-09-05 14:06:45 -04:00
Chloe
adfc942fa0
add user agent to downloads
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
2024-09-05 10:51:43 -07:00
Chloe
0da931619a
xarch is still generated for appleclang sometimes 2024-09-05 10:42:49 -07:00
Justin
bff34729a7
allow dashes in developer name search (#1023)
Some checks are pending
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
* Update FiltersPopup.cpp

* remove space
2024-09-05 04:05:08 -07:00
Justin Pridgen
793f554cda Merge branch 'main' of https://github.com/hiimjustin000/geode into limit-size 2024-08-16 20:15:27 -04:00
Justin Pridgen
834199ad9c i think that's it for now 2024-08-16 20:11:40 -04:00
Justin Pridgen
bcaa0ab6be first moves 2024-08-16 17:15:29 -04:00
Justin Pridgen
61df8b7d98 Merge branch 'main' of https://github.com/geode-sdk/geode 2024-08-16 14:01:01 -04:00
Justin Pridgen
9c9c75d46b Merge branch 'main' of https://github.com/geode-sdk/geode 2024-07-06 21:14:00 -04:00
Justin Pridgen
d117d50fb0 Merge branch 'main' of https://github.com/geode-sdk/geode 2024-07-06 19:41:27 -04:00
Justin Pridgen
b80efe0517 add ampersand support whoops 2024-07-04 22:59:40 -04:00
Justin Pridgen
7d40c8188f New image arguments format 2024-06-30 18:31:21 -04:00
6 changed files with 53 additions and 2 deletions

View file

@ -132,7 +132,7 @@ endif()
if (DEFINED GEODE_CCACHE_VARIANT)
if (NOT DEFINED GEODE_DISABLE_PRECOMPILED_HEADERS)
if (${GEODE_CCACHE_VARIANT} STREQUAL "sccache" AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
if (${GEODE_CCACHE_VARIANT} STREQUAL "sccache" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (DEFINED CMAKE_OSX_ARCHITECTURES AND (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64;x86_64" OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64;arm64"))
message(NOTICE "Using ${GEODE_CCACHE_VARIANT} with ${CMAKE_CXX_COMPILER_ID} while building multiple architectures, PCH will be disabled due to issues with sccache.")
set(GEODE_DISABLE_PRECOMPILED_HEADERS ON)
@ -146,7 +146,7 @@ if (DEFINED GEODE_CCACHE_VARIANT)
endif()
endif()
else()
if (DEFINED CMAKE_OSX_ARCHITECTURES AND (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64;x86_64" OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64;arm64"))
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# when building for multiple architectures, a caching compiler is not recommended
message(NOTICE "Not using a caching compiler (ccache/sccache).")
else()

View file

@ -713,6 +713,24 @@ namespace geode::cocos {
*/
GEODE_DLL void limitNodeSize(cocos2d::CCNode* node, cocos2d::CCSize const& size, float def, float min);
/**
* Rescale node to fit inside given width
* @param node Node to rescale
* @param width Width to fit inside
* @param def Default scale
* @param min Minimum scale
*/
GEODE_DLL void limitNodeWidth(cocos2d::CCNode* node, float width, float def, float min);
/**
* Rescale node to fit inside given height
* @param node Node to rescale
* @param height Height to fit inside
* @param def Default scale
* @param min Minimum scale
*/
GEODE_DLL void limitNodeHeight(cocos2d::CCNode* node, float height, float def, float min);
/**
* Checks if a node is visible (recursively
* checks parent visibility)

View file

@ -156,6 +156,7 @@ public:
});
auto req = web::WebRequest();
req.userAgent(getServerUserAgent());
m_downloadListener.setFilter(req.get(version.downloadURL));
ModDownloadEvent(m_id).post();
}

View file

@ -103,6 +103,7 @@ bool FiltersPopup::setup(ModListSource* src) {
m_developerNameInput = TextInput::create(inputContainer->getContentWidth(), "Developer Name");
m_developerNameInput->setTextAlign(TextInputAlign::Left);
m_developerNameInput->setFilter("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
m_developerNameInput->setString(src->getQuery().developer.value_or(""));
inputContainer->addChildAtPosition(m_developerNameInput, Anchor::Center);

View file

@ -334,6 +334,8 @@ struct MDParser {
}
float spriteScale = 1.0f;
float spriteWidth = 0.0f;
float spriteHeight = 0.0f;
for (auto [key, value] : imgArguments) {
if (key == "scale") {
@ -342,6 +344,18 @@ struct MDParser {
spriteScale = *scaleRes;
}
}
else if (key == "width") {
auto widthRes = utils::numFromString<float>(value);
if (widthRes) {
spriteWidth = *widthRes;
}
}
else if (key == "height") {
auto heightRes = utils::numFromString<float>(value);
if (heightRes) {
spriteHeight = *heightRes;
}
}
}
if (utils::string::startsWith(s_lastImage, "frame:")) {
@ -357,6 +371,15 @@ struct MDParser {
}
if (spr && spr->getUserObject("geode.texture-loader/fallback") == nullptr) {
spr->setScale(spriteScale);
if (spriteWidth > 0.0f && spriteHeight <= 0.0f) {
limitNodeWidth(spr, spriteWidth, 999.f, .1f);
}
else if (spriteHeight > 0.0f && spriteWidth <= 0.0f) {
limitNodeHeight(spr, spriteHeight, 999.f, .1f);
}
else if (spriteWidth > 0.0f && spriteHeight > 0.0f) {
limitNodeSize(spr, { spriteWidth, spriteHeight }, 999.f, .1f);
}
renderer->renderNode(spr);
}
else {

View file

@ -455,6 +455,14 @@ void geode::cocos::limitNodeSize(CCNode* spr, CCSize const& size, float def, flo
spr->setScale(clamp(std::min(size.height / spr->getContentHeight(), size.width / spr->getContentWidth()), min, def));
}
void geode::cocos::limitNodeWidth(CCNode* spr, float width, float def, float min) {
spr->setScale(clamp(width / spr->getContentSize().width, min, def));
}
void geode::cocos::limitNodeHeight(CCNode* spr, float height, float def, float min) {
spr->setScale(clamp(height / spr->getContentSize().height, min, def));
}
bool geode::cocos::nodeIsVisible(CCNode* node) {
if (!node->isVisible()) {
return false;