Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Scaling and mouseMoved #9

Open
francofusco opened this issue Jan 23, 2021 · 0 comments · May be fixed by #12
Open

Scaling and mouseMoved #9

francofusco opened this issue Jan 23, 2021 · 0 comments · May be fixed by #12

Comments

@francofusco
Copy link

Let's consider as an example a window of size 500x500 pixels.

If I manually resize the window used by piksel, the scaling to be used while drawing is adapted automatically, which is amazing 👍 What I means is that if I say to draw a rectangle using rect(0,0,250,250) I will always see a rectangle that takes exactly a quarter of the window.

The only issue I have is with the method mouseMoved. Since it gets called with (x,y) being the position of the mouse in pixels, before resizing the screen the middle of my window corresponds to (250,250), however after manually changing the window size this is no longer true. Note that since the new size of the window is unknown to the class we are writing (at least to my knowledge, I might be wrong!) mouse positions cannot be mapped "properly" on the screen anymore.

I think it would be nice to either:

  • Change mouseMoved so that it gets called with float parameters (not int). The coordinates should be given already with the new scale factor taken into account. (this would be the best option IMO 😃)
  • Prevent the window to be scaled (at least as an option, in case we need to handle mouse inputs).
  • Allow to get the scale factor using a method.
@MarcinKonowalczyk MarcinKonowalczyk linked a pull request Jul 9, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant