Skip to content

Commit

Permalink
slider windows
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Jan 24, 2024
1 parent 28ab1ac commit 3c0d7bd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Hacks/SliderLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SliderBypass*>(a)->m_fields->ev = p1;

return a;
}
};

Expand All @@ -32,7 +38,11 @@ class $modify (SliderTouchLogic)
float w = 100;
float x = (this->convertTouchToNodeSpace(p0).x + 100) / 2;

auto v = (static_cast<SliderBypass*>(this->m_slider))->m_fields->ev;

this->m_slider->setValue(x / w);
#ifdef GEODE_IS_ANDROID
this->ccTouchEnded(p0, p1);
#endif
}
};

0 comments on commit 3c0d7bd

Please sign in to comment.