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
Handle Mouse button differentiation, handle button release & only send one event #146
Conversation
@faide, my laptop just died. I might take a bit to review this. |
Nice PR 😄. I have reviewed all commits, and commented on the code. Feel free to ask any questions you may have, and I will do my best to answer them. |
@@ -16,6 +16,16 @@ type SpaceComponent struct { | |||
Height float32 | |||
} | |||
|
|||
// Center positions the space component according to its center instead of its | |||
// top-left point (this avoids doing the same math each time in your systems) | |||
func (sc *SpaceComponent) Center(p Point) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I'm not sure this is the best way to approach this problem.
For example:
Sprite A:
- Position:
0, 0
- System:
DoesNotCallCenter
- Width:
20
Sprite B:
- Position:
0, 0
- System:
CallsCenter
- Width:
20
If this code was run, Sprite B would end up at position (10, 10)
, while Sprite A kept the same position - Even if the system made no other changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the name that you don't like? Maybe we should call it PositionCenter
The whole point of this method is to be able to move an entity by placing "it's center" to a desired point, but the name does not fully reflect that. An since this is just a helper I can place it anywhere in my own code but I felt like it could be interesting to reuse.
@faide I've given your code a review and left some small comments. Once we have those resolved, I'll be happy to merge it in. Thanks for your persistence! |
Paked I agree we could move the value affectation into each file (js & glfw) but this would create many duplicates because only a small subset is redefined in glfw... Would this be acceptable? |
@faide Ah ha. Now I see the problem. OK, I'd leave it as it is then. Make any final changes, then I'm happy to merge this in. |
I think I finished what I could in this PR, let's see what will be the next one :) |
Handle Mouse button differentiation, handle button release & only send one event
@faide Thanks for the PR. It is awesome to see other people contributing! |
No description provided.