Silly API

Fei

Silly API

a bunch of utils for my mods to make my life easier

if ur not a dev this is useless to u

theres a documentation for pretty much everything in headers, otherwise heres a feature list and half finished docs !

the setting stuff is out of date and alot of it is deprecated, but if u js wanna use setting cache, remove settingsmanager->load call, change "Setting" to "SettingCache", and include nwo5/cache instead of nwo5/setting

Features

  • geode setting/saved value cache (by making them inline variables so also ide autocomplete)
  • plethora of editor utils (like 100+ functions or smth)
  • tooltips using user objects
  • uibuilder ripoff
  • compile time info about every trigger in the game
  • bad drawnode rewrite
  • named constants for game textures
  • array/color utils
  • a bunch more stuff (mainly for sillyedit lol)

Editor

make fw the editor hopefully easier :3

u can include with

#include 

editor utils are split into a couple different namespaces

  • editor
    • object
    • selection
    • constants
    • triggers

Editor

uncategorized/general utils related to the editor

one of the most important functions from here is nwo5::editor::update() most/all editor functions in the api dont actually update stuff like editor buttons or info label so you need to do that with this function :3

(assuming you included nwo5::editor::prelude) u can use editor::ui() and editor::layer() to get editorlayer/ui ptr (or pass a template argument to reinterpret cast the ptr)

also theres an overcomplicated system (thats kinda shittly implemented) for adding new edit tab buttons so no more createmovemenu hooks !

Selection

a bunch of utils for working with the editor selection

Object

everything related to getting data from/manipulating objs

for example to scale an object

#include 
#include 

using namespace geode::prelude;

class $modify(EditorUI) {
    void customScaleObjects(CCArray* objects, float scale) {
        // scale objects to scale (biggest obj scale will be scale, everything else gets scaled accordingly) with undo enabled
        nwo5::editor::object::scale(objects, scale, true);

        nwo5::editor::update();
    }
};

Triggers

i spent almost 10 hours on this im too lazy to write docs

basically an easy way to change trigger groups/duration and query some info abt a trigger (like if it has a center group or smth) read more in editor/trigger.hpp but mayb collapse line 186

UI

very opinionated ui builder alternative + some other ui functions

Settings Cache

part of this mod is a way to cache/easily access geode settings thru inline variables

u can use generate-settings.py to port over ur mod.json settings :3c (i js wanted an excuse to learn python)

Basics

u set up a setting like this

#include 

namespace Settings {
    // define a bool setting that corresponds to mod setting "silly-setting"
    inline nwo5::settings::Setting sillySetting{"silly-setting"};
}

and u can use it like so

#include 
#include "settings.hpp"

using namespace geode::prelude;

class $modify(MenuLayer) {
    bool init() {
        if (!MenuLayer::init()) {
            return false;
        }

        // settings also have a conversion operator which works fine for most cases
        // but id recommend just using .get(); its more explicit anyway so :3
        if (Settings::sillySetting.get()) {
            log::info("haiiii :3");
        }

        return true;
    };
};

somewhere in ur mod u have to load settings

#include 

$on_mod(Loaded) {
    nwo5::settings::SettingsManager::get()->load();
}

Categories

settings can be categorized, u can define ur categories before loading settings

#include 

$on_mod(Loaded) {
    nwo5::settings::SettingsManager::get()->registerCategories(
        // simply define a category
        {"Silly Category"},
        // define a category with a description and set its priority
        // u can use an enum as priority itll be automatically casted
        {"Sillier Category", "is a sillier category than silly category", 10},
        // define a category with no description but with a logo
        {"Silliest Category", std::nullopt, "silliest-category-logo.png"_spr}

        // SettingsManager::get()::getCategories returns a vector of category* sorted by priority
        // category priority is by default 0
    );

    nwo5::settings::SettingsManager::get()->load();
}

u can add a setting to a category like so

#include 

namespace Settings {
    inline nwo5::settings::Setting sillyCategorizedSetting{"silly-categorized-setting", "Silly Category"};
}

Data

if u wanna add some extra data to ur settings you can either inherit setting to add constructors or use an alias

struct SillyData {
    bool isSilly = true;
};

template
class SillySetting : public nwo5::settings::Setting {
public:
    SillySetting(std::string_view key, SillyData data)
        : nwo5::settings::Setting(key) 
    {
        this->data() = data;
    }
};

// alternatively just make an alias and set data whenever
template
using MySillySetting = Setting

Saved Settings

there are also saved settings that use geode saved values if u want to implement settings in ur mod completely from scratch (like silly edit)

#include 

namespace Settings {
    // key is automatically generated with category + name
    inline nwo5::settings::SavedSetting sillySavedSetting{"Silly Saved Setting", "Silly Category", true, "a silly saved setting"};
}

Utils

the rest of the utils in this mod are prolly useless to u but i use them in my mods usually :3

utils has setupnode function which is bad and dumb and stupid, dont use it, use the ui stuffs at the very least (or js actually use the real ui builder) its js there so i dont have to update the entire sillyedit codebase for the time being, it will be removed soon™

v3.1.0

Added

  • more slider node setup functions
  • listen method to SettingCache

Fixed

  • .string/.text with geode::labels in setup

v3.0.0

Added

  • nodes namespace (moved tooltip and sillydrawnode)
  • reworked nwo5::settings (now nwo5::cache)
  • cached settings automatically load
  • cached settings are now memory managed a bit more sanely so now they dont have to strictly be static initialized
  • saved value cache
  • a bunch of setup functions

Changed

  • all ui button functions return geode::Button now (and toggler functions return geode::Toggler)
  • moved ui::sprite/frame to ui::resources::sprite/frame
  • renamed ui::spr/sprFrame to ui::sprite/frame
  • use geode object id names instead of my own constants (if that pr actually gets merged :pray:)
  • made ui utils all inline so they can mayb get optimized
  • m_impl nodes

Removed

  • deprecated obj functions
  • dumb edit button api </3
  • some ui syntax functions which were js unnecessary verbosity
  • saved settings, setting categories, and settings manager

Fixed

  • selection get ccarray specialization
  • collision blocks in trigger header

Internal

  • rewrote setup (ide autocomplete should work better and also just scrolling thru the header is a bit more reasonable)
  • changed all parameters to be in camelCase
  • reorganized utils and ui namespaces

v2.2.3

Added

  • more setup functions whats new

Fixed

  • ui::input

v2.2.2

Fixed

  • can select layer
  • a crash in layer locked ???

v2.2.1

Fixed

  • editor utils prolly
  • tooltip getmaxwidth
  • drawnode drawellipse/circle thickness

v2.2.0

Added

  • more editor utils

Fixed

  • some editor util crashes
  • some group stuff (might replace later idk)

v2.1.1

Fixed

  • tooltipinfo create function and made documentation a bit clearer

v2.1.0

Added

  • rebranded a bit
  • better area trigger support
  • node utils

Fixed

  • i dont even remember lol

v2.0.1

Fixed

  • easing again
  • more stuff but like fuck documenting right

v2.0.0

Added

  • a couple editor events
  • renamed a couple Setup functions
  • make all ui/node functions return setup
  • reworked a couple ui/node functions
  • some more ui/node functions
  • more color utils
  • make ui functions use geode::Label
  • make nwo5::utils have alias misc in prelude instead of nutils
  • deprecated a few ui functions
  • reworked getchildquery (now nwo5::utils::Query)
  • more docs

Fixed

  • make tooltips not break words by default
  • typo in gensettings
  • made saved setting events final
  • easing
  • smth smth function call ambiguous (fuck you ?????)

Internal

  • update todo list and make it appear on repo

v1.12.0

Added

  • for each obj
  • priority param to setupkeybind
  • a few new textures

Fixed

  • make group labels properly update with trigger functions
  • tooltip anchor
  • some editor::triggers functions

v1.11.0

Added

  • tooltips ! (in ui namespace)
  • a bunch more setup functions
  • a couple ui layout utils
  • some geode label support (full support coming in v2 cuz i cant make breaking changes)
  • texture constants namespace(s) in ui
  • include feature list in metadata

Fixed

  • make ui layout functions not disable autoscale
  • some setup layout functions

v1.10.5

Fixed

  • more setup fixes whats new

v1.10.4

Fixed

  • settings cache not updating before settings changed listener for some mods
  • some other editor things i forgot
  • something

Removed

  • tinker options

v1.10.3

Fixed

  • some editor functions (ty ninkaz)

v1.10.2

Fixed

  • even dumber sillydrawnode crash

v1.10.1

Fixed

  • that or im stupid

v1.10.0

Added

  • easier time making layout with ui
  • some color utils
  • some misc utils
  • fully deprecate old ui system

Fixed

  • sillydrawnode crash
  • fix editor selection utils omg why were they so broken

v1.9.1

Added

  • listener for saved settings using addeventlistener

Fixed

  • some saved setting listener thing
  • setup id string view fr fr

v1.9.0

Added

  • allow for setting the callbacks of more stuff with setup
  • make ui header include some of geodes ui stuff
  • events for saved settings
  • little changes to readme

Fixed

  • allow setup id to take string view

v1.8.0

Added

  • editor obj str stuffs
  • saved setting tweaks

v1.7.0

Added

  • some trigger changes
  • dumbass font scaling

Fixed

  • mirror gd behaviour it grid snapped pos
  • numtostring impl to use fmt properly
  • make EditorValid true slightly earlier

v1.6.1

Fixed

  • editor ui loaded function
  • register edit tab button

v1.6.0

Added

  • more editor functions as always
  • editor scale compat functions
  • update editor tab buttons in registeredittabbutton so it can b used post hook
  • include ranges header with utils

Fixed

  • dumb stupid ui bug

v1.5.1

Fixed

  • added node ids dependency cuz lowk edit tab buttons depends on it but also kinda works without it
  • editor::trigger issues

v1.5.0

Added

  • a couple editor functions
  • some documentation for editor funcs

Fixed

  • fix a silly with get chroma when only including color.hpp
  • some changelog typos
  • setup id formating overload
  • constexpr enum_cast

Internal

  • added a lil python script for setting cache

v1.4.1

fucked up the version oops

v1.4.0

Added

  • hsv/rgb utils !

Fixed

  • defaults for ui::menu layout overload for it to make a bit more sense

v1.3.0

Added

  • a few more functions to setup
  • disable ignore anchor for position for ccmenus/cclayers when setting anchor point with setup
  • fixed togglewithcallback for togglers
  • some more editor viewport utils
  • silly draw node
  • more editor initialized function
  • editor tab button reload

Fixed

  • numtostring rounding again
  • setting cache again

Removed

  • deprecated setupnode and some misc utils functions (still usable but will be removed when sillyedit is fully updated)

v1.2.1

Added

  • readme ui thing

Fixed

  • fuck windows (im js stupid)

v1.2.0

Added

  • ui namespace (u can still in include old bad setup node stuff in nwo5::utils::setup)
  • reorganized namespaces
  • color/enum_cast

Fixed

  • numtostring rounding
  • some editor functions not being available in editorui::init
  • made span ptrs const

v1.1.0

Added

  • mod specific settings
  • a bunch of trigger utils
  • make (some) editor functions safer (remind me to do this for more of them)
  • templated easing functions and made them copy cocos easing functions
  • array utils rework
  • renamed category decl macro
  • some more editor color utils
  • better edit highway robbery
  • conditional editor tab button function

Fixed

  • editor tab buttons
  • update editor updating duration lines
  • str count
  • editor::selection::get
  • category macro

v1.0.0

  • initial release

Original Site made by HJfod. Geode 2 parody-ish by MeFinity.

Geode-SDK is the property of the Geode Team.


This website (Geode 2, Codename Malachite) is not affiliated with the Geode Team in any way shape or form.