Skip to content

Commit

Permalink
Merge branch 'v6' of https://github.com/HJfod/BetterEdit into v6
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Feb 7, 2024
2 parents e5f7e3e + 25f5ecb commit 3ed99dc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 11 deletions.
48 changes: 48 additions & 0 deletions resources/objects.jsonc
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
20 changes: 9 additions & 11 deletions src/features/scaling/EditorUIScaling.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include <Geode/Bindings.hpp>
#include "Geode/cocos/sprite_nodes/CCSprite.h"
#include <Geode/binding/EditorUI.hpp>
#include <Geode/binding/Slider.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/modify/EditorUI.hpp>

using namespace geode::prelude;
Expand All @@ -11,18 +14,12 @@ class $modify(EditorUI) {
float scale = Mod::get()->getSettingValue<double>("scale-factor");
auto size = CCDirector::get()->getWinSize();

auto slider = reinterpret_cast<Slider*>(this->getChildren()->objectAtIndex(0));
auto slider = getChildOfType<Slider>(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);
Expand Down Expand Up @@ -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<CCSprite*>(this->getChildren()->objectAtIndex(1));
auto objBG = getChildOfType<CCSprite>(this, 0);
objBG->setScaleY(scale);

auto objTabs = this->getChildByID("build-tabs-menu");
Expand All @@ -91,11 +89,11 @@ class $modify(EditorUI) {
rightTabs->setPosition(ccp(rightTabs->getPositionX() + rightTabs->getContentSize().width / 2, 0));
rightTabs->setScale(scale);

auto leftLine = static_cast<CCSprite*>(this->getChildren()->objectAtIndex(4));
auto leftLine = getChildOfType<CCSprite>(this, 1);
leftLine->setScale(scale);
leftLine->setPosition(leftLine->getPosition() * scale);

auto rightLine = static_cast<CCSprite*>(this->getChildren()->objectAtIndex(5));
auto rightLine = getChildOfType<CCSprite>(this, 2);
rightLine->setScale(scale);
rightLine->setPosition(ccp(size.width - (size.width - rightLine->getPositionX()) * scale, rightLine->getPositionY() * scale));

Expand Down

0 comments on commit 3ed99dc

Please sign in to comment.