diff --git a/resources/objects.jsonc b/resources/objects.jsonc new file mode 100644 index 00000000..43a1ab63 --- /dev/null +++ b/resources/objects.jsonc @@ -0,0 +1,48 @@ +{ + "tags": [ + // Solid objects you can interact with + "Solid", + // A whole block + "Block", + // A half-block (or spike) + "Slab", + // A mini block (or spike) + "Mini", + // Breakable objects (aka breakable blocks) + "Breakable", + // A slope + "Slope", + // Decoration objects + "Decoration", + // Interactive objects like orbs, portals, pickupable items + "Interactive", + // Coins, potions, etc. + "Pickupable", + // Portals + "Portal", + // Orbs + "Orb", + // All deadly objects + "Hazard", + // Spikes + "Spike", + // Sawblades + "Saw", + // Monsters + "Monster", + // This object connects to other objects + "Ground", + // This object floats + "Air", + // Trigger + "Trigger", + // Animated objects + "Animated" + ], + "objects": { + "1": { + "description": "Default block", + "tags": ["Solid", "Block"] + } + } +} diff --git a/src/features/scaling/EditorUIScaling.cpp b/src/features/scaling/EditorUIScaling.cpp index 16b89a38..9b909706 100644 --- a/src/features/scaling/EditorUIScaling.cpp +++ b/src/features/scaling/EditorUIScaling.cpp @@ -1,4 +1,7 @@ -#include +#include "Geode/cocos/sprite_nodes/CCSprite.h" +#include +#include +#include #include using namespace geode::prelude; @@ -11,18 +14,12 @@ class $modify(EditorUI) { float scale = Mod::get()->getSettingValue("scale-factor"); auto size = CCDirector::get()->getWinSize(); - auto slider = reinterpret_cast(this->getChildren()->objectAtIndex(0)); + auto slider = getChildOfType(this, 0); slider->ignoreAnchorPointForPosition(false); slider->setContentSize(ccp(0, 0)); slider->setScale(scale); slider->setPositionY(size.height - (size.height - slider->getPositionY()) * scale); - auto sliderO = this->getChildByID("position-slider"); - - sliderO->setPositionY(size.height - (size.height - sliderO->getPositionY()) * scale); - sliderO->setContentSize(ccp(0, 0)); - sliderO->setScale(scale); - auto settingsMenu = this->getChildByID("settings-menu"); settingsMenu->setPosition(size); @@ -68,8 +65,9 @@ class $modify(EditorUI) { linkMenu->setScale(scale); // i am very sorry for using object indexes but no id + // doggo for the love of god at least use getChildOfType - auto objBG = static_cast(this->getChildren()->objectAtIndex(1)); + auto objBG = getChildOfType(this, 0); objBG->setScaleY(scale); auto objTabs = this->getChildByID("build-tabs-menu"); @@ -91,11 +89,11 @@ class $modify(EditorUI) { rightTabs->setPosition(ccp(rightTabs->getPositionX() + rightTabs->getContentSize().width / 2, 0)); rightTabs->setScale(scale); - auto leftLine = static_cast(this->getChildren()->objectAtIndex(4)); + auto leftLine = getChildOfType(this, 1); leftLine->setScale(scale); leftLine->setPosition(leftLine->getPosition() * scale); - auto rightLine = static_cast(this->getChildren()->objectAtIndex(5)); + auto rightLine = getChildOfType(this, 2); rightLine->setScale(scale); rightLine->setPosition(ccp(size.width - (size.width - rightLine->getPositionX()) * scale, rightLine->getPositionY() * scale));