Description:
Move over more input handling.
(grafted from 1ad8dee9e756c89314d136926c9dac5e84649354)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -7,7 +7,7 | |||
|
7 | 7 | |
|
8 | 8 | namespace isometricparkfna.Engines { |
|
9 | 9 | |
|
10 | [Receives(typeof(ToggleWindowMessage))] | |
|
10 | [Receives(typeof(ToggleWindowMessage), typeof(ToggleVisibilityMessage))] | |
|
11 | 11 | class GameBridgeEngine : Engine |
|
12 | 12 | { |
|
13 | 13 | |
@@ -37,11 +37,19 | |||
|
37 | 37 | break; |
|
38 | 38 | |
|
39 | 39 | } |
|
40 | ||
|
41 | ||
|
42 | 40 | } |
|
43 | ||
|
44 | ||
|
41 | foreach (ref readonly var visibilityMessage in ReadMessages<ToggleVisibilityMessage>()) | |
|
42 | { | |
|
43 | ||
|
44 | switch (visibilityMessage.Element) { | |
|
45 | case Element.Grid: | |
|
46 | game.showGrid = !game.showGrid; | |
|
47 | break; | |
|
48 | case Element.Trees: | |
|
49 | game.showTrees = !game.showTrees; | |
|
50 | break; | |
|
51 | } | |
|
52 | } | |
|
45 | 53 | |
|
46 | 54 | } |
|
47 | 55 | } |
@@ -9,7 +9,7 | |||
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | |
|
12 | [Sends(typeof(ToggleWindowMessage))] | |
|
12 | [Sends(typeof(ToggleWindowMessage), typeof(ToggleVisibilityMessage))] | |
|
13 | 13 | public class InputEngine : Engine |
|
14 | 14 | { |
|
15 | 15 | private KeyboardState keyboardPrev; |
@@ -44,8 +44,17 | |||
|
44 | 44 | SendMessage(new ToggleWindowMessage{Window = Window.News}); |
|
45 | 45 | |
|
46 | 46 | } |
|
47 | if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) | |
|
48 | { | |
|
49 | SendMessage(new ToggleVisibilityMessage{Element = Element.Grid}); | |
|
47 | 50 | |
|
51 | } | |
|
52 | #if DEBUG | |
|
53 | if (keyboardCur.IsKeyDown(Keys.T) && keyboardPrev.IsKeyUp(Keys.T)) | |
|
54 | { | |
|
55 | SendMessage(new ToggleVisibilityMessage{Element = Element.Trees}); | |
|
48 | 56 | |
|
57 | } | |
|
49 | 58 | #endif |
|
50 | 59 | #endregion misc_keys |
|
51 | 60 |
@@ -368,18 +368,6 | |||
|
368 | 368 | System.Console.WriteLine("Quitting"); |
|
369 | 369 | Environment.Exit(0); |
|
370 | 370 | } |
|
371 | if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) | |
|
372 | { | |
|
373 | this.showGrid = !this.showGrid; | |
|
374 | ||
|
375 | } | |
|
376 | #if DEBUG | |
|
377 | if (keyboardCur.IsKeyDown(Keys.T) && keyboardPrev.IsKeyUp(Keys.T)) | |
|
378 | { | |
|
379 | this.showTrees = !this.showTrees; | |
|
380 | ||
|
381 | } | |
|
382 | #endif | |
|
383 | 371 | if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C)) |
|
384 | 372 | { |
|
385 | 373 | this.camera.Jump(Vector2.Zero); |
You need to be logged in to leave comments.
Login now