Description:
Some refactoring.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r159:111182ff6d2d -

@@ -7,7 +7,7
7 7
8 8 namespace isometricparkfna.Engines {
9 9
10 [Receives(typeof(ToggleDebugWindowMessage))]
10 [Receives(typeof(ToggleWindowMessage))]
11 11 class GameBridgeEngine : Engine
12 12 {
13 13
@@ -20,10 +20,24
20 20 public override void Update(double dt)
21 21 {
22 22
23 foreach (ref readonly var motionMessage in ReadMessages<ToggleDebugWindowMessage>())
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(ToggleDebugWindowMessage))]
12 [Sends(typeof(ToggleWindowMessage))]
13 13 public class InputEngine : Engine
14 14 {
15 15 private KeyboardState keyboardPrev;
@@ -23,15 +23,32
23 23
24 24 var keyboardCur = Keyboard.GetState();
25 25
26 #region misc_keys
26 27 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash))
27 28 {
28 // this.show_another_window = !this.show_another_window;
29 //
30 SendMessage(new ToggleDebugWindowMessage());
29 SendMessage(new ToggleWindowMessage{Window = Window.Debug});
30
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 52 this.keyboardPrev = keyboardCur;
36 53 }
37 54 }
@@ -74,15 +74,15
74 74 private List<NewsItem> newsItems;
75 75
76 76
77 private bool showGrid;
78 private bool showTrees;
77 public bool showGrid;
78 public bool showTrees;
79 79 private Grammar grammar;
80 80 private string output;
81 81 private GraphicsDeviceManager gdm;
82 private bool showBudget;
82 public bool showBudget;
83 83 private BudgetWindow budgetWindow;
84 private bool showForest;
85 private bool showNews;
84 public bool showForest;
85 public bool showNews;
86 86
87 87 //Encompass
88 88 private WorldBuilder WorldBuilder = new WorldBuilder();
@@ -380,12 +380,6
380 380 System.Console.WriteLine("Quitting");
381 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 383 if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G))
390 384 {
391 385 this.showGrid = !this.showGrid;
@@ -398,21 +392,6
398 392
399 393 }
400 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 395 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
417 396 {
418 397 this.camera.Jump(Vector2.Zero);
@@ -489,12 +468,14
489 468 this.camera.Move(new Vector2(0, 4));
490 469 }
491 470
471 #if DEBUG
492 472 if (mouseCur.RightButton == ButtonState.Pressed)
493 473 {
494 474 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
495 475 Vector2 delta = this.camera.position - this.original_point;
496 476 this.camera.Jump(this.original_point);
497 477 }
478 #endif
498 479
499 480 #endregion input
500 481
@@ -2,11 +2,16
2 2
3 3 namespace isometricparkfna.Messages {
4 4
5 // public enum Window {
6 // DEBUG
7 // }
5 public enum Window {
6 Debug,
7 Budget,
8 Forest,
9 News
10 }
8 11
9 public struct ToggleDebugWindowMessage : IMessage//, IHasEntity
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