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

r297:796d32fa41fc -

@@ -30,8 +30,11
30 30 - Add tree simulation @milestone(3: Contracts) @done(2021-04-27)
31 31 - Add contract generation @milestone(3: Contracts) @done(2021-04-12)
32 32 - Outline reserved areas @milestone(3: Contracts) @done(2021-04-09)
33 - Add company images @milestone(3: Contracts) @maybe
33 - Add company images @milestone(3: Contracts) @maybe @done(2021-05-21)
34 - Contracts should end
35 -
34 36 Trees:
37
35 38 - Add basic maintenance cost @milestone(1: Basic Money) @done(2021-01-27)
36 39 - Add basic age simulation
37 40 - Biodiversity @maybe
@@ -164,6 +167,7
164 167 Bugs:
165 168 Graphics:
166 169 - Trees jump around when pressing show/hide grid
170 - Grids sometimes overlap trees.
167 171 - Trees sometimes
168 172 - Sometimes framerate jumps to 180-200 fps. (Better than reverse, but kinda weird)
169 173 Misc:
@@ -10,7 +10,8
10 10
11 11 [Receives(typeof(ToggleWindowTypeMessage), typeof(ToggleWindowMessage),
12 12 typeof(ToggleVisibilityMessage))]
13 [Reads(typeof(AreaComponent))]
13 [Reads(typeof(AreaComponent),
14 typeof(ContractStatusComponent))]
14 15 class GameBridgeEngine : Engine
15 16 {
16 17
@@ -58,11 +59,16
58 59 foreach (ref readonly var entity in ReadEntities<AreaComponent>())
59 60 {
60 61 var areaComponent = GetComponent<AreaComponent>(entity);
62 var contractStatusComponent = GetComponent<ContractStatusComponent>(entity);
61 63 foreach (var square in areaComponent.squares)
62 64 {
63 65 if (game.mouseGrid == square)
64 66 {
65 67 game.in_zone = true;
68 if(contractStatusComponent.status == ContractStatus.Active)
69 {
70 game.in_active_zone = true;
71 }
66 72 }
67 73 }
68 74
@@ -35,6 +35,7
35 35 private SpriteBatch batch;
36 36 private SoundEffect sound;
37 37 private SpriteFont monoFont;
38 private SpriteFont largeMonoFont;
38 39
39 40 private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
40 41
@@ -65,6 +66,9
65 66
66 67 //for now
67 68 public bool in_zone;
69 public bool in_active_zone;
70
71 public bool isPlaying = false;
68 72
69 73 private ImGuiRenderer _imGuiRenderer;
70 74 private DebugWindow debugWindow;
@@ -305,6 +309,21
305 309 }
306 310 );
307 311
312 var bakedMonoLarge = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
313 30,
314 1024,
315 1024,
316 new[]
317 {
318 CharacterRange.BasicLatin,
319 CharacterRange.Latin1Supplement,
320 CharacterRange.LatinExtendedA,
321 CharacterRange.Cyrillic,
322 CharacterRange.LatinExtendedB,
323 new CharacterRange((char) 0x00B7)
324 }
325 );
326
308 327
309 328 this.output = grammar.Flatten("#greeting#");
310 329 var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#");
@@ -339,6 +358,7
339 358
340 359 //font = fontBakeResult.CreateSpriteFont(GraphicsDevice);
341 360 monoFont = bakedMono.CreateSpriteFont(GraphicsDevice);
361 largeMonoFont = bakedMonoLarge.CreateSpriteFont(GraphicsDevice);
342 362
343 363 this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0);
344 364
@@ -443,6 +463,10
443 463 {
444 464 sound.Play(volume, pitch, pan);
445 465 }
466 if (keyboardCur.IsKeyDown(Keys.A) && keyboardPrev.IsKeyUp(Keys.A))
467 {
468 this.isPlaying = !this.isPlaying;
469 }
446 470 #endregion misc_keys
447 471 //
448 472
@@ -527,10 +551,15
527 551 frameCounter++;
528 552
529 553 string fps = string.Format("fps: {0}", frameRate);
554 bool has_tree = false;
530 555
531 556 Stopwatch stopWatch = new Stopwatch();
532 557 stopWatch.Start();
533 558 GraphicsDevice.Clear(Color.CornflowerBlue);
559
560 _imGuiRenderer.BeforeLayout(gameTime);
561 if (this.isPlaying)
562 {
534 563 batch.Begin(SpriteSortMode.BackToFront,
535 564 BlendState.AlphaBlend,
536 565 null,
@@ -728,7 +757,6
728 757 drawTileAt(3, 2, 140, 2);
729 758 #endif
730 759
731 _imGuiRenderer.BeforeLayout(gameTime);
732 760 World.Draw();
733 761 // _imGuiRenderer.AfterLayout();
734 762 batch.End();
@@ -741,7 +769,6
741 769 null,
742 770 null);
743 771
744 bool has_tree = false;
745 772 if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross))
746 773 {
747 774 has_tree = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree;
@@ -753,7 +780,7
753 780 {
754 781 status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y,
755 782 this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status,
756 this.in_zone ? "Contracted" : "Unzoned"
783 this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unzoned")
757 784 );
758 785 }
759 786
@@ -792,6 +819,51
792 819
793 820 batch.End();
794 821
822 #region window
823 if (this.currentNode != null)
824 {
825 this.currentNode = DialogInterface.RenderDialog(ref this.showInitial,
826 ref this.simulation.paused, debugWindow.monoFont, this.currentNode);
827 }
828
829 if (this.showForest)
830 {
831 ForestWindow.Render(this.showForest, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine);
832 }
833
834 if (this.showNews)
835 {
836 NewsWindow.Render(this.showNews, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine);
837 }
838
839 bool quit = false;
840 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
841
842 if (quit) {
843 System.Environment.Exit(0);
844 }
845
846 }
847 else {
848 GraphicsDevice.Clear(Color.Teal);
849 batch.Begin(SpriteSortMode.BackToFront,
850 BlendState.AlphaBlend,
851 null,
852 null,
853 null,
854 null);
855
856 Vector2 middle_dimensions = monoFont.MeasureString("Isometric Park");
857 float middle_start = (int)((FNAGame.width / 2) - (middle_dimensions.X / 2));
858
859 batch.DrawString(largeMonoFont, "Isometric Park",
860 new Vector2(middle_start, 50),
861 Color.Black, 0.0f, Vector2.Zero,
862 1.0f, SpriteEffects.None, 0.5f);
863 batch.End();
864 }
865 #endregion
866
795 867
796 868 #region debug_window
797 869 //Calcs for debug window:
@@ -859,29 +931,6
859 931 // new DialogOption{ response="Oh yeah, of course.", choice="..." }};
860 932
861 933
862 if (this.currentNode != null)
863 {
864 this.currentNode = DialogInterface.RenderDialog(ref this.showInitial,
865 ref this.simulation.paused, debugWindow.monoFont, this.currentNode);
866 }
867
868 if (this.showForest)
869 {
870 ForestWindow.Render(this.showForest, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine);
871 }
872
873 if (this.showNews)
874 {
875 NewsWindow.Render(this.showNews, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine);
876 }
877
878 bool quit = false;
879 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
880
881 if (quit) {
882 System.Environment.Exit(0);
883 }
884
885 934
886 935 _imGuiRenderer.AfterLayout();
887 936
You need to be logged in to leave comments. Login now