From 3c0d7bd2c62ca5abb8ea120600f8b815cc3f3b04 Mon Sep 17 00:00:00 2001 From: Explodingbill Date: Wed, 24 Jan 2024 12:45:58 +1100 Subject: [PATCH] slider windows --- src/Hacks/SliderLimit.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Hacks/SliderLimit.cpp b/src/Hacks/SliderLimit.cpp index bf60ffa..aeece9a 100644 --- a/src/Hacks/SliderLimit.cpp +++ b/src/Hacks/SliderLimit.cpp @@ -10,11 +10,17 @@ const char* get_node_name(CCNode* node) { // "class cocos2d::CCNode" + 6 == "cocos2d::CCNode" return typeid(*node).name() + 6; } -class $modify (Slider) +class $modify (SliderBypass, Slider) { + cocos2d::SEL_MenuHandler ev; + static Slider* create(cocos2d::CCNode* p0, cocos2d::SEL_MenuHandler p1, char const* p2, char const* p3, char const* p4, char const* p5, float p6) { + auto a = Slider::create(p0, p1, p2, p3, p4, p5, p6); + + reinterpret_cast(a)->m_fields->ev = p1; + return a; } }; @@ -32,7 +38,11 @@ class $modify (SliderTouchLogic) float w = 100; float x = (this->convertTouchToNodeSpace(p0).x + 100) / 2; + auto v = (static_cast(this->m_slider))->m_fields->ev; + this->m_slider->setValue(x / w); + #ifdef GEODE_IS_ANDROID this->ccTouchEnded(p0, p1); + #endif } }; \ No newline at end of file