Description:
Fix right click to jump.
Apparently I had it right the whole time, it's just that it would get triggered
many times because I wasn't checking that the mouse was previously released.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -30,6 +30,7 | |||||
|
30 | class FNAGame : Game |
|
30 | class FNAGame : Game |
|
31 | { |
|
31 | { |
|
32 | private KeyboardState keyboardPrev = new KeyboardState(); |
|
32 | private KeyboardState keyboardPrev = new KeyboardState(); |
|
|
33 | private MouseState mousePrev = new MouseState(); | ||
|
33 |
|
34 | ||
|
34 | private SpriteBatch batch; |
|
35 | private SpriteBatch batch; |
|
35 | private SoundEffect sound; |
|
36 | private SoundEffect sound; |
@@ -448,10 +449,8 | |||||
|
448 |
|
449 | ||
|
449 |
|
450 | ||
|
450 | #if DEBUG |
|
451 | #if DEBUG |
|
451 | if (mouseCur.RightButton == ButtonState.Pressed) |
|
452 | if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released) |
|
452 | { |
|
453 | { |
|
453 | Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); |
|
||
|
454 | Vector2 delta = this.camera.position - this.original_point; |
|
||
|
455 | this.camera.Jump(this.original_point); |
|
454 | this.camera.Jump(this.original_point); |
|
456 | } |
|
455 | } |
|
457 | #endif |
|
456 | #endif |
@@ -495,6 +494,7 | |||||
|
495 | } |
|
494 | } |
|
496 |
|
495 | ||
|
497 | this.keyboardPrev = keyboardCur; |
|
496 | this.keyboardPrev = keyboardCur; |
|
|
497 | this.mousePrev = mouseCur; | ||
|
498 |
|
498 | ||
|
499 | stopWatch.Stop(); |
|
499 | stopWatch.Stop(); |
|
500 | this.updateTime = stopWatch.Elapsed; |
|
500 | this.updateTime = stopWatch.Elapsed; |
You need to be logged in to leave comments.
Login now