mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-21 23:18: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
|
||||
|
||||
#include "SettingV3.hpp"
|
||||
|
||||
namespace geode {
|
||||
|
@ -26,9 +27,6 @@ namespace geode {
|
|||
using SettingNodeSizeChangeEvent = SettingNodeSizeChangeEventV3;
|
||||
using SettingNodeValueChangeEvent = SettingNodeValueChangeEventV3;
|
||||
|
||||
template <class T>
|
||||
using SettingTypeForValueType = SettingTypeForValueTypeV3<T>;
|
||||
|
||||
template <class T, class Lambda>
|
||||
EventListener<SettingChangedFilter>* listenForSettingChanges(std::string_view settingKey, Lambda&& callback, Mod* mod = getMod()) {
|
||||
return listenForSettingChangesV3<T>(settingKey, std::forward<Lambda>(callback), mod);
|
||||
|
@ -45,4 +43,4 @@ namespace geode {
|
|||
) {
|
||||
return listenForAllSettingChangesV3(callback, mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -694,45 +694,45 @@ namespace geode {
|
|||
};
|
||||
|
||||
template <class T>
|
||||
struct SettingTypeForValueTypeV3 {
|
||||
struct SettingTypeForValueType {
|
||||
static_assert(
|
||||
!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 <>
|
||||
struct SettingTypeForValueTypeV3<bool> {
|
||||
struct SettingTypeForValueType<bool> {
|
||||
using SettingType = BoolSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<int64_t> {
|
||||
struct SettingTypeForValueType<int64_t> {
|
||||
using SettingType = IntSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<double> {
|
||||
struct SettingTypeForValueType<double> {
|
||||
using SettingType = FloatSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<std::string> {
|
||||
struct SettingTypeForValueType<std::string> {
|
||||
using SettingType = StringSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<std::filesystem::path> {
|
||||
struct SettingTypeForValueType<std::filesystem::path> {
|
||||
using SettingType = FileSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<cocos2d::ccColor3B> {
|
||||
struct SettingTypeForValueType<cocos2d::ccColor3B> {
|
||||
using SettingType = Color3BSettingV3;
|
||||
};
|
||||
template <>
|
||||
struct SettingTypeForValueTypeV3<cocos2d::ccColor4B> {
|
||||
struct SettingTypeForValueType<cocos2d::ccColor4B> {
|
||||
using SettingType = Color4BSettingV3;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
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(
|
||||
[callback = std::move(callback)](std::shared_ptr<SettingV3> setting) {
|
||||
if (auto ty = geode::cast::typeinfo_pointer_cast<Ty>(setting)) {
|
||||
|
|
Loading…
Reference in a new issue