Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerometer #21

Closed
slime73 opened this issue Jan 20, 2014 · 7 comments
Closed

Accelerometer #21

slime73 opened this issue Jan 20, 2014 · 7 comments
Labels
bug Something isn't working

Comments

@slime73
Copy link
Member

slime73 commented Jan 20, 2014

Original report by Ranguna (Bitbucket: Ranguna, GitHub: Ranguna).


We can get the accelerometer (x,y,z) values with the joystick API, they are set as Axis (Axis 1,2,3 -> Accelerometer x,y,z) but they all output 0, I'm guessing it has something to do with this function, maybe it needs to be called somewhere ?

@slime73
Copy link
Member Author

slime73 commented Jan 20, 2014

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


That function is called when events are pumped in SDL, which happens every frame by default in LÖVE.

@slime73
Copy link
Member Author

slime73 commented Jan 20, 2014

Original comment by Ranguna (Bitbucket: Ranguna, GitHub: Ranguna).


Hmmm... Well, for some reason the Axis aren't updating and if that isn't the problem then I have no idea what could be

@slime73
Copy link
Member Author

slime73 commented Jan 20, 2014

Original comment by Jairo Luiz (Bitbucket: tangzero, GitHub: tangzero).


I have the answer.
You need to notify SDL about the accel event on the onSensorChanged method.

https://bitbucket.org/MartinFelis/love-android-sdl2/src/ab51b4cc9bc0275ca4c09487f16b9e7781b00499/src/org/libsdl/app/SDLActivity.java?at=master#cl-755.

Maybe you need to convert this SensorEvent in to a MotionEvent and then, call the SDLActivity.handleJoystickMotionEvent(event)

I can do that, if you give me a couple hours. :)

@slime73
Copy link
Member Author

slime73 commented Jan 20, 2014

Original comment by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


Patches are always welcome! :D

@slime73
Copy link
Member Author

slime73 commented Jan 22, 2014

Original comment by Jairo Luiz (Bitbucket: tangzero, GitHub: tangzero).


I solved!!! It's a bug on SDL.
I'll post a build for tests.

@slime73
Copy link
Member Author

slime73 commented Jan 22, 2014

@slime73
Copy link
Member Author

slime73 commented Jan 23, 2014

Original comment by Martin Felis (Bitbucket: MartinFelis, GitHub: MartinFelis).


Fixed as of f475455. Kudos to @tangzero!

@slime73 slime73 closed this as completed Jan 23, 2014
@slime73 slime73 added major bug Something isn't working labels Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant