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

r171:bbbf23e975ce -

@@ -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();
@@ -368,12 +368,6
368 368 System.Console.WriteLine("Quitting");
369 369 Environment.Exit(0);
370 370 }
371 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash))
372 {
373 // this.show_another_window = !this.show_another_window;
374
375 }
376
377 371 if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G))
378 372 {
379 373 this.showGrid = !this.showGrid;
@@ -386,21 +380,6
386 380
387 381 }
388 382 #endif
389 if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B))
390 {
391 this.showBudget = !this.showBudget;
392
393 }
394 if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F))
395 {
396 this.showForest = !this.showForest;
397
398 }
399 if (keyboardCur.IsKeyDown(Keys.N) && keyboardPrev.IsKeyUp(Keys.N))
400 {
401 this.showNews = !this.showNews;
402
403 }
404 383 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
405 384 {
406 385 this.camera.Jump(Vector2.Zero);
@@ -477,12 +456,14
477 456 this.camera.Move(new Vector2(0, 4));
478 457 }
479 458
459 #if DEBUG
480 460 if (mouseCur.RightButton == ButtonState.Pressed)
481 461 {
482 462 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
483 463 Vector2 delta = this.camera.position - this.original_point;
484 464 this.camera.Jump(this.original_point);
485 465 }
466 #endif
486 467
487 468 #endregion input
488 469
@@ -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