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

Application does not detect mouse motion events on macOS #68

Closed
asandroq opened this issue Jun 9, 2018 · 4 comments
Closed

Application does not detect mouse motion events on macOS #68

asandroq opened this issue Jun 9, 2018 · 4 comments
Labels

Comments

@asandroq
Copy link

asandroq commented Jun 9, 2018

Problem

Right after startup the application does not respond to mouse motion events. Clicking to start the ball works but the ball goes straight up and leaves the window through the top. All keyboard events go to the terminal that started haskanoid.

System info

macOS 10.13.15
Darwin lorien.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64

GHC: x86_64-osx-ghc-8.0.2
Clang: Apple LLVM version 9.1.0 (clang-902.0.39.2)
SDL: 1.2.15

@ivanperez-keera
Copy link
Owner

I don't see anything in the code that would hint to why this may be happening.

Are you getting mouse motion events? (can you modify Input.hs to print them if they occur).

Can you somehow add a print here:

https://github.com/ivanperez-keera/haskanoid/blob/master/src/Input.hs#L232

So that, if you are getting mouse motion as a different event, you can see what it is?

Does this program work for you?

https://github.com/keera-studios/haskell-game-programming/blob/zuriHac2018/tutorials/sdl/sdl1/input/example1.hs

@asandroq
Copy link
Author

asandroq commented Jun 10, 2018

There no other different events being fired except for LostFocus and GetFocus events. After some more investigation, there seems to be two issues here:

  1. The MouseMotion SDL event seems to be only detected if the trackpad is pressed.

  2. The calculation of the velocity in Game.hs:519 is returning invalid values for some reason, always very small floating point numbers close to 0.0.

(-2.5236576396411892e69,0.0)
(6.309144099102973e69,0.0)
(-1.388011701802654e70,0.0)
(2.914824573785573e70,0.0)
(-6.704096519706819e70,0.0)
(1.4749012343355003e71,0.0)
(-3.5397629624052006e71,0.0)
(6.72554962856988e71,0.0)
(-1.2778544294282774e72,0.0)
(2.427923415913727e72,0.0)
(-5.341431515010199e72,0.0)
(1.2819435636024478e73,0.0)
(-2.8202758399253852e73,0.0)

@asandroq
Copy link
Author

When trying the input example I still see problem 1, so it seems to be an SDL problem. But after clicking, I can move the ball without problems.

@chriz-zeller
Copy link
Contributor

This issue contains two issues. We split them in #70 and #71, and close this issue.
Thank you @asandroq for mentioning and helping to debug them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants