SDL: fixed scroll wheel input for Bluetooth mouse
This commit is contained in:
@@ -1163,14 +1163,19 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
|
||||
DifferentTouchInput.capturedMouseY = this.getHeight() - 1;
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): X " + DifferentTouchInput.capturedMouseX + " Y " + DifferentTouchInput.capturedMouseY +
|
||||
//Log.v("SDL", "SDL DemoGLSurfaceView::onCapturedPointerEvent(): X " + DifferentTouchInput.capturedMouseX + " Y " + DifferentTouchInput.capturedMouseY +
|
||||
// " W " + this.getWidth() + " H " + this.getHeight() + " getX " + event.getX() + " getY " + event.getY() +
|
||||
// " RelX " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_X) + " RelY " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y) );
|
||||
|
||||
event.setLocation(DifferentTouchInput.capturedMouseX, DifferentTouchInput.capturedMouseY);
|
||||
event.setAction(MotionEvent.ACTION_HOVER_MOVE);
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): XY " + event.getX() + " " + event.getY() + " action " + event.getAction());
|
||||
int scrollX = Math.round(event.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||
int scrollY = Math.round(event.getAxisValue(MotionEvent.AXIS_VSCROLL));
|
||||
if (scrollX != 0 || scrollY != 0)
|
||||
DemoGLSurfaceView.nativeMouseWheel(scrollX, scrollY);
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): XY " + event.getX() + " " + event.getY() + " action " + event.getAction() + " scroll " + scrollX + " " + scrollY);
|
||||
|
||||
return this.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
|
||||
|
||||
extern int create_server_socket(int portno);
|
||||
|
||||
|
||||
/*----------------------------------------------------------
|
||||
Definitions...
|
||||
@@ -716,6 +714,22 @@ int main(int argc, char* argv[])
|
||||
if(evt.type == SDL_MOUSEBUTTONUP || evt.type == SDL_MOUSEBUTTONDOWN)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL mouse button event: evt %s state %s button %d coords %d:%d", evt.type == SDL_MOUSEBUTTONUP ? "UP " : "DOWN" , evt.button.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.button.button, (int)evt.button.x, (int)evt.button.y);
|
||||
if (evt.type == SDL_MOUSEBUTTONDOWN && evt.button.button == SDL_BUTTON_WHEELDOWN)
|
||||
{
|
||||
y_offs += 10000;
|
||||
}
|
||||
if (evt.type == SDL_MOUSEBUTTONDOWN && evt.button.button == SDL_BUTTON_WHEELUP)
|
||||
{
|
||||
y_offs -= 10000;
|
||||
}
|
||||
if (evt.type == SDL_MOUSEBUTTONDOWN && evt.button.button == SDL_BUTTON_X1)
|
||||
{
|
||||
x_offs += 10000;
|
||||
}
|
||||
if (evt.type == SDL_MOUSEBUTTONDOWN && evt.button.button == SDL_BUTTON_X2)
|
||||
{
|
||||
x_offs -= 10000;
|
||||
}
|
||||
}
|
||||
if(evt.type == SDL_VIDEORESIZE)
|
||||
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL resize event: %d x %d", evt.resize.w, evt.resize.h);
|
||||
|
||||
Reference in New Issue
Block a user