-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1702179
commit 8b51e86
Showing
5 changed files
with
124 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "keybind_setting.hpp" | ||
|
||
#include <managers/keybinds.hpp> | ||
|
||
using namespace geode::prelude; | ||
|
||
void KeybindSettingNode::onButton(CCObject*) { | ||
|
||
} | ||
|
||
KeybindSettingNode* KeybindSettingNode::create(std::shared_ptr<KeybindSetting> setting, float width) { | ||
auto ret = new KeybindSettingNode(); | ||
if (ret && ret->init(setting, width)) { | ||
ret->autorelese(); | ||
return ret; | ||
} | ||
CC_SAFE_DELETE(ret); | ||
return nullptr; | ||
} | ||
|
||
SettingNodeV3* KeybindSetting::createNode(float width) { | ||
return KeybindSettingNode::create( | ||
std::static_pointer_cast<KeybindSetting>(shared_from_this()), | ||
width | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include <Geode/loader/SettingV3.hpp> | ||
#include <Geode/loader/Mod.hpp> | ||
|
||
#include <Geode/binding/ButtonSprite.hpp> | ||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp> | ||
|
||
class KeybindSetting : public geode::SettingV3 { | ||
public: | ||
static geode::Result<std::shared_ptr<geode::SettingV3>> parse(std::string const& key, std::string const& modID, matjson::Value const& json); | ||
bool load(matjson::Value const& json) override { | ||
return true; | ||
} | ||
bool save(matjson::Value& json) const override { | ||
return true; | ||
} | ||
bool isDefaultValue() const override { | ||
return true; | ||
} | ||
void reset() override {} | ||
|
||
geode::SettingNodeV3* createNode(float width) override; | ||
}; | ||
|
||
class KeybindSettingNode : public geode::SettingNodeV3 { | ||
protected: | ||
ButtonSprite* m_buttonSprite; | ||
CCMenuItemSpriteExtra* m_button; | ||
|
||
bool init(std::shared_ptr<KeybindSetting> setting, float width); | ||
void updateState(cocos2d::CCNode* invoker) override; | ||
void onButton(cocos2d::CCObject*); | ||
void onCommit() override {} | ||
void onResetToDefault() override {} | ||
|
||
public: | ||
static KeybindSettingNode* create(std::shared_ptr<KeybindSetting> setting, float width); | ||
bool hasUncommittedChanges() const override { | ||
return false; | ||
} | ||
bool hasNonDefaultValue() const override { | ||
return false; | ||
} | ||
std::shared_ptr<KeybindSetting> getSetting() const { | ||
return std::static_pointer_cast<KeybindSetting>(geode::SettingNodeV3::getSetting()); | ||
} | ||
}; | ||
|