mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
silly alk revert
This commit is contained in:
parent
038788bf57
commit
a3beed16f5
2 changed files with 12 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "SettingV3.hpp"
|
#include "SettingV3.hpp"
|
||||||
|
|
||||||
namespace geode {
|
namespace geode {
|
||||||
|
@ -26,9 +27,6 @@ namespace geode {
|
||||||
using SettingNodeSizeChangeEvent = SettingNodeSizeChangeEventV3;
|
using SettingNodeSizeChangeEvent = SettingNodeSizeChangeEventV3;
|
||||||
using SettingNodeValueChangeEvent = SettingNodeValueChangeEventV3;
|
using SettingNodeValueChangeEvent = SettingNodeValueChangeEventV3;
|
||||||
|
|
||||||
template <class T>
|
|
||||||
using SettingTypeForValueType = SettingTypeForValueTypeV3<T>;
|
|
||||||
|
|
||||||
template <class T, class Lambda>
|
template <class T, class Lambda>
|
||||||
EventListener<SettingChangedFilter>* listenForSettingChanges(std::string_view settingKey, Lambda&& callback, Mod* mod = getMod()) {
|
EventListener<SettingChangedFilter>* listenForSettingChanges(std::string_view settingKey, Lambda&& callback, Mod* mod = getMod()) {
|
||||||
return listenForSettingChangesV3<T>(settingKey, std::forward<Lambda>(callback), mod);
|
return listenForSettingChangesV3<T>(settingKey, std::forward<Lambda>(callback), mod);
|
||||||
|
|
|
@ -694,45 +694,45 @@ namespace geode {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct SettingTypeForValueTypeV3 {
|
struct SettingTypeForValueType {
|
||||||
static_assert(
|
static_assert(
|
||||||
!std::is_same_v<T, T>,
|
!std::is_same_v<T, T>,
|
||||||
"specialize the SettingTypeForValueTypeV3 class to use Mod::getSettingValue for custom settings"
|
"specialize the SettingTypeForValueType class to use Mod::getSettingValue for custom settings"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<bool> {
|
struct SettingTypeForValueType<bool> {
|
||||||
using SettingType = BoolSettingV3;
|
using SettingType = BoolSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<int64_t> {
|
struct SettingTypeForValueType<int64_t> {
|
||||||
using SettingType = IntSettingV3;
|
using SettingType = IntSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<double> {
|
struct SettingTypeForValueType<double> {
|
||||||
using SettingType = FloatSettingV3;
|
using SettingType = FloatSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<std::string> {
|
struct SettingTypeForValueType<std::string> {
|
||||||
using SettingType = StringSettingV3;
|
using SettingType = StringSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<std::filesystem::path> {
|
struct SettingTypeForValueType<std::filesystem::path> {
|
||||||
using SettingType = FileSettingV3;
|
using SettingType = FileSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<cocos2d::ccColor3B> {
|
struct SettingTypeForValueType<cocos2d::ccColor3B> {
|
||||||
using SettingType = Color3BSettingV3;
|
using SettingType = Color3BSettingV3;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct SettingTypeForValueTypeV3<cocos2d::ccColor4B> {
|
struct SettingTypeForValueType<cocos2d::ccColor4B> {
|
||||||
using SettingType = Color4BSettingV3;
|
using SettingType = Color4BSettingV3;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
EventListener<SettingChangedFilterV3>* listenForSettingChangesV3(std::string_view settingKey, auto&& callback, Mod* mod = getMod()) {
|
EventListener<SettingChangedFilterV3>* listenForSettingChangesV3(std::string_view settingKey, auto&& callback, Mod* mod = getMod()) {
|
||||||
using Ty = typename SettingTypeForValueTypeV3<T>::SettingType;
|
using Ty = typename SettingTypeForValueType<T>::SettingType;
|
||||||
return new EventListener(
|
return new EventListener(
|
||||||
[callback = std::move(callback)](std::shared_ptr<SettingV3> setting) {
|
[callback = std::move(callback)](std::shared_ptr<SettingV3> setting) {
|
||||||
if (auto ty = geode::cast::typeinfo_pointer_cast<Ty>(setting)) {
|
if (auto ty = geode::cast::typeinfo_pointer_cast<Ty>(setting)) {
|
||||||
|
|
Loading…
Reference in a new issue