now using float for wheel

This commit is contained in:
meowtech 2026-05-26 10:46:32 +00:00
parent 30ba0b2ae0
commit 9e990680dc
6 changed files with 19 additions and 19 deletions

View file

@ -96,12 +96,12 @@ RB_METHOD(inputMouseY){
// wheel :3
RB_METHOD(inputWheelX) {
RB_UNUSED_PARAM;
return rb_fix_new(shState->input().wheelX());
return rb_float_new(shState->input().wheelX());
}
RB_METHOD(inputWheelY) {
RB_UNUSED_PARAM;
return rb_fix_new(shState->input().wheelY());
return rb_float_new(shState->input().wheelY());
}
RB_METHOD(inputWheelFlipped) {
@ -165,9 +165,9 @@ void inputBindingInit(){
_rb_define_module_function(module, "mouse_y", inputMouseY);
// wheel support :P
_rb_define_module_function(module, "mouse_wheel_x", inputWheelX);
_rb_define_module_function(module, "mouse_wheel_y", inputWheelY);
_rb_define_module_function(module, "mouse_wheel_flipped", inputWheelFlipped);
_rb_define_module_function(module, "wheel_x", inputWheelX);
_rb_define_module_function(module, "wheel_y", inputWheelY);
_rb_define_module_function(module, "wheel_flipped", inputWheelFlipped);
_rb_define_module_function(module, "quit?", inputQuit);

View file

@ -281,6 +281,10 @@ class Window_Settings
def update
if @visible
@version.bitmap.clear
@version.bitmap.draw_text(0, 0, @version.bitmap.width, @version.bitmap.height, Input.wheel_y.to_s)
end
@version.opacity = 128
@ -350,12 +354,8 @@ class Window_Settings
end
end
if Input.mouse_wheel_y > 0
@index = (@index - 1) % @data.size
$game_system.se_play($data_system.cursor_se)
end
if Input.mouse_wheel_y < 0
@index = (@index + 1) % @data.size
if Input.wheel_y != 0
@index = (@index - Input.wheel_y.round) % @data.size
$game_system.se_play($data_system.cursor_se)
end

View file

@ -434,8 +434,8 @@ void EventThread::process(RGSSThreadData &rtData){
case SDL_EVENT_MOUSE_WHEEL:
{
mouseState.wheelFlipped = event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED;
mouseState.wheelX += event.wheel.integer_x;
mouseState.wheelY += event.wheel.integer_y;
mouseState.wheelX += event.wheel.x;
mouseState.wheelY += event.wheel.y;
}
break;

View file

@ -66,7 +66,7 @@ public:
// mouse wheel support for sunshine
bool wheelFlipped;
int wheelX, wheelY;
float wheelX, wheelY;
};
struct FingerState{

View file

@ -280,7 +280,7 @@ static const Input::ButtonCode otherDirs[4][3] = {
// storing wheel as buffer cause yes.
struct MouseFrameState {
int wheelX, wheelY;
float wheelX, wheelY;
bool wheelFlipped;
};
@ -704,8 +704,8 @@ int Input::mouseY(){
}
// wheel support :3
int Input::wheelX() { return p->mouseWheelState.wheelX; }
int Input::wheelY() { return p->mouseWheelState.wheelY; }
float Input::wheelX() { return p->mouseWheelState.wheelX; }
float Input::wheelY() { return p->mouseWheelState.wheelY; }
bool Input::wheelFlipped() { return p->mouseWheelState.wheelFlipped; }
bool Input::hasQuit(){

View file

@ -63,8 +63,8 @@ public:
int mouseY();
// more non-standard extensions
int wheelX();
int wheelY();
float wheelX();
float wheelY();
bool wheelFlipped();
bool hasQuit();