Description:
Some refactoring.
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 | namespace isometricparkfna.Engines { |
|
8 | namespace isometricparkfna.Engines { |
|
9 |
|
9 | ||
|
10 |
[Receives(typeof(Toggle |
|
10 | [Receives(typeof(ToggleWindowMessage))] |
|
11 | class GameBridgeEngine : Engine |
|
11 | class GameBridgeEngine : Engine |
|
12 | { |
|
12 | { |
|
13 |
|
13 | ||
@@ -20,10 +20,24 | |||||
|
20 | public override void Update(double dt) |
|
20 | public override void Update(double dt) |
|
21 | { |
|
21 | { |
|
22 |
|
22 | ||
|
23 |
foreach (ref readonly var |
|
23 | foreach (ref readonly var windowMessage in ReadMessages<ToggleWindowMessage>()) |
|
24 | { |
|
24 | { |
|
|
25 | switch (windowMessage.Window) { | ||
|
|
26 | case Window.Debug: | ||
|
|
27 | game.show_another_window = !game.show_another_window; | ||
|
|
28 | break; | ||
|
|
29 | case Window.Budget: | ||
|
|
30 | game.showBudget = !game.showBudget; | ||
|
|
31 | break; | ||
|
|
32 | case Window.Forest: | ||
|
|
33 | game.showForest = !game.showForest; | ||
|
|
34 | break; | ||
|
|
35 | case Window.News: | ||
|
|
36 | game.showNews = !game.showNews; | ||
|
|
37 | break; | ||
|
25 |
|
38 | ||
|
26 | game.show_another_window = !game.show_another_window; |
|
39 | } |
|
|
40 | |||
|
27 |
|
41 | ||
|
28 | } |
|
42 | } |
|
29 |
|
43 |
@@ -9,7 +9,7 | |||||
|
9 |
|
9 | ||
|
10 |
|
10 | ||
|
11 |
|
11 | ||
|
12 |
[Sends(typeof(Toggle |
|
12 | [Sends(typeof(ToggleWindowMessage))] |
|
13 | public class InputEngine : Engine |
|
13 | public class InputEngine : Engine |
|
14 | { |
|
14 | { |
|
15 | private KeyboardState keyboardPrev; |
|
15 | private KeyboardState keyboardPrev; |
@@ -23,15 +23,32 | |||||
|
23 |
|
23 | ||
|
24 | var keyboardCur = Keyboard.GetState(); |
|
24 | var keyboardCur = Keyboard.GetState(); |
|
25 |
|
25 | ||
|
|
26 | #region misc_keys | ||
|
26 | if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash)) |
|
27 | if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash)) |
|
27 | { |
|
28 | { |
|
28 | // this.show_another_window = !this.show_another_window; |
|
29 | SendMessage(new ToggleWindowMessage{Window = Window.Debug}); |
|
29 | // |
|
30 | |
|
30 | SendMessage(new ToggleDebugWindowMessage()); |
|
31 | } |
|
|
32 | if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B)) | ||
|
|
33 | { | ||
|
|
34 | SendMessage(new ToggleWindowMessage{Window = Window.Budget}); | ||
|
|
35 | |||
|
|
36 | } | ||
|
|
37 | if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F)) | ||
|
|
38 | { | ||
|
|
39 | SendMessage(new ToggleWindowMessage{Window = Window.Forest}); | ||
|
|
40 | |||
|
|
41 | } | ||
|
|
42 | if (keyboardCur.IsKeyDown(Keys.N) && keyboardPrev.IsKeyUp(Keys.N)) | ||
|
|
43 | { | ||
|
|
44 | SendMessage(new ToggleWindowMessage{Window = Window.News}); | ||
|
31 |
|
45 | ||
|
32 | } |
|
46 | } |
|
33 |
|
47 | ||
|
34 |
|
48 | ||
|
|
49 | #endif | ||
|
|
50 | #endregion misc_keys | ||
|
|
51 | |||
|
35 | this.keyboardPrev = keyboardCur; |
|
52 | this.keyboardPrev = keyboardCur; |
|
36 | } |
|
53 | } |
|
37 | } |
|
54 | } |
@@ -74,15 +74,15 | |||||
|
74 | private List<NewsItem> newsItems; |
|
74 | private List<NewsItem> newsItems; |
|
75 |
|
75 | ||
|
76 |
|
76 | ||
|
77 |
p |
|
77 | public bool showGrid; |
|
78 |
p |
|
78 | public bool showTrees; |
|
79 | private Grammar grammar; |
|
79 | private Grammar grammar; |
|
80 | private string output; |
|
80 | private string output; |
|
81 | private GraphicsDeviceManager gdm; |
|
81 | private GraphicsDeviceManager gdm; |
|
82 |
p |
|
82 | public bool showBudget; |
|
83 | private BudgetWindow budgetWindow; |
|
83 | private BudgetWindow budgetWindow; |
|
84 |
p |
|
84 | public bool showForest; |
|
85 |
p |
|
85 | public bool showNews; |
|
86 |
|
86 | ||
|
87 | //Encompass |
|
87 | //Encompass |
|
88 | private WorldBuilder WorldBuilder = new WorldBuilder(); |
|
88 | private WorldBuilder WorldBuilder = new WorldBuilder(); |
@@ -380,12 +380,6 | |||||
|
380 | System.Console.WriteLine("Quitting"); |
|
380 | System.Console.WriteLine("Quitting"); |
|
381 | Environment.Exit(0); |
|
381 | Environment.Exit(0); |
|
382 | } |
|
382 | } |
|
383 | if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash)) |
|
||
|
384 | { |
|
||
|
385 | // this.show_another_window = !this.show_another_window; |
|
||
|
386 |
|
|||
|
387 | } |
|
||
|
388 |
|
|||
|
389 | if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) |
|
383 | if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) |
|
390 | { |
|
384 | { |
|
391 | this.showGrid = !this.showGrid; |
|
385 | this.showGrid = !this.showGrid; |
@@ -398,21 +392,6 | |||||
|
398 |
|
392 | ||
|
399 | } |
|
393 | } |
|
400 | #endif |
|
394 | #endif |
|
401 | if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B)) |
|
||
|
402 | { |
|
||
|
403 | this.showBudget = !this.showBudget; |
|
||
|
404 |
|
|||
|
405 | } |
|
||
|
406 | if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F)) |
|
||
|
407 | { |
|
||
|
408 | this.showForest = !this.showForest; |
|
||
|
409 |
|
|||
|
410 | } |
|
||
|
411 | if (keyboardCur.IsKeyDown(Keys.N) && keyboardPrev.IsKeyUp(Keys.N)) |
|
||
|
412 | { |
|
||
|
413 | this.showNews = !this.showNews; |
|
||
|
414 |
|
|||
|
415 | } |
|
||
|
416 | if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C)) |
|
395 | if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C)) |
|
417 | { |
|
396 | { |
|
418 | this.camera.Jump(Vector2.Zero); |
|
397 | this.camera.Jump(Vector2.Zero); |
@@ -489,12 +468,14 | |||||
|
489 | this.camera.Move(new Vector2(0, 4)); |
|
468 | this.camera.Move(new Vector2(0, 4)); |
|
490 | } |
|
469 | } |
|
491 |
|
470 | ||
|
|
471 | #if DEBUG | ||
|
492 | if (mouseCur.RightButton == ButtonState.Pressed) |
|
472 | if (mouseCur.RightButton == ButtonState.Pressed) |
|
493 | { |
|
473 | { |
|
494 | Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); |
|
474 | Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); |
|
495 | Vector2 delta = this.camera.position - this.original_point; |
|
475 | Vector2 delta = this.camera.position - this.original_point; |
|
496 | this.camera.Jump(this.original_point); |
|
476 | this.camera.Jump(this.original_point); |
|
497 | } |
|
477 | } |
|
|
478 | #endif | ||
|
498 |
|
479 | ||
|
499 | #endregion input |
|
480 | #endregion input |
|
500 |
|
481 |
@@ -2,11 +2,16 | |||||
|
2 |
|
2 | ||
|
3 | namespace isometricparkfna.Messages { |
|
3 | namespace isometricparkfna.Messages { |
|
4 |
|
4 | ||
|
5 |
|
|
5 | public enum Window { |
|
6 | // DEBUG |
|
6 | Debug, |
|
7 | // } |
|
7 | Budget, |
|
|
8 | Forest, | ||
|
|
9 | News | ||
|
|
10 | } | ||
|
8 |
|
11 | ||
|
9 |
public struct Toggle |
|
12 | public struct ToggleWindowMessage : IMessage//, IHasEntity |
|
10 | { |
|
13 | { |
|
|
14 | |||
|
|
15 | public Window Window; | ||
|
11 | } |
|
16 | } |
|
12 | } |
|
17 | } |
You need to be logged in to leave comments.
Login now