Description:
Fix style and identation.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -48,8 +48,6 | |||
|
48 | 48 | |
|
49 | 49 | private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); |
|
50 | 50 | |
|
51 | private const string VERSION = "0.30.04"; | |
|
52 | ||
|
53 | 51 | Random random_generator = new Random(); |
|
54 | 52 | |
|
55 | 53 | int frameRate = 0; |
@@ -67,9 +65,7 | |||
|
67 | 65 | //new tile stuff |
|
68 | 66 | int squaresAcross = 50; |
|
69 | 67 | int squaresDown = 50; |
|
70 | // int baseOffsetX = -14; | |
|
71 | // int baseOffsetY = -14; | |
|
72 | ||
|
68 | ||
|
73 | 69 | Simulation simulation; |
|
74 | 70 | |
|
75 | 71 | public Vector2 mouseGrid; |
@@ -129,8 +125,6 | |||
|
129 | 125 | } |
|
130 | 126 | |
|
131 | 127 | |
|
132 | ||
|
133 | ||
|
134 | 128 | private FNAGame() |
|
135 | 129 | { |
|
136 | 130 | |
@@ -149,7 +143,6 | |||
|
149 | 143 | IsFullScreen = false, |
|
150 | 144 | SynchronizeWithVerticalRetrace = true |
|
151 | 145 | }; |
|
152 | //gdm.SynchronizeWithVerticalRetrace = false; | |
|
153 | 146 | IsFixedTimeStep = false; |
|
154 | 147 | |
|
155 | 148 | this.simulation = new Simulation(this.squaresAcross, this.squaresDown, new float[] {16.66667f*240, 16.66667f*120, 16.66667f*60, 16.66667f*30f, 16.66667f*1 }); |
@@ -214,7 +207,7 | |||
|
214 | 207 | Quad.Initialize(GraphicsDevice, texture); |
|
215 | 208 | Logging.Success("Initialized Quad texture."); |
|
216 | 209 | ContractWindow.LoadContent(this._imGuiRenderer, this.imageMap); |
|
217 |
|
|
|
210 | OptionsWindow.Initialize(new Vector2(FNAGame.width, FNAGame.height), gdm.IsFullScreen); | |
|
218 | 211 | |
|
219 | 212 | //Has to happen before Encompass stuff, because the Encompass machinery around ImGui requires debugWindow's monoFont to be loaded: |
|
220 | 213 | this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice, this.imageMap); |
@@ -267,13 +260,12 | |||
|
267 | 260 | WorldBuilder.SetComponent(optionsWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Options }); |
|
268 | 261 | |
|
269 | 262 | |
|
270 |
|
|
|
263 | var gameEntity = WorldBuilder.CreateEntity(); | |
|
271 | 264 | |
|
272 |
|
|
|
265 | WorldBuilder.SetComponent(gameEntity, new GameStateComponent { isPlaying = false}); | |
|
273 | 266 | |
|
274 | 267 | |
|
275 | 268 | var area = WorldBuilder.CreateEntity(); |
|
276 | // WorldBuilder.SetComponent(area, new AreaComponent{squares = new[] {new Vector2(4,4), new Vector2(5,4)}}); | |
|
277 | 269 | var size = 5; |
|
278 | 270 | var squares = new Vector2[size * size]; |
|
279 | 271 | var start_x = 10; |
@@ -395,26 +387,26 | |||
|
395 | 387 | |
|
396 | 388 | public void setFont(string font, int size) |
|
397 | 389 | { |
|
398 |
|
|
|
390 | var font_path = DebugWindow.fonts[font]; | |
|
399 | 391 | |
|
400 |
|
|
|
401 | size, | |
|
402 | 1024, | |
|
403 | 1024, | |
|
404 | new[] | |
|
405 | { | |
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
|
411 |
|
|
|
412 | } | |
|
413 | ); | |
|
392 | var baked = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"), | |
|
393 | size, | |
|
394 | 1024, | |
|
395 | 1024, | |
|
396 | new[] | |
|
397 | { | |
|
398 | CharacterRange.BasicLatin, | |
|
399 | CharacterRange.Latin1Supplement, | |
|
400 | CharacterRange.LatinExtendedA, | |
|
401 | CharacterRange.Cyrillic, | |
|
402 | CharacterRange.LatinExtendedB, | |
|
403 | new CharacterRange((char) 0x00B7) | |
|
404 | } | |
|
405 | ); | |
|
414 | 406 | |
|
415 |
|
|
|
407 | this.monoFont = baked.CreateSpriteFont(GraphicsDevice); | |
|
416 | 408 | } |
|
417 | ||
|
409 | ||
|
418 | 410 | |
|
419 | 411 | protected override void UnloadContent() |
|
420 | 412 | { |
@@ -504,81 +496,81 | |||
|
504 | 496 | |
|
505 | 497 | KeyboardState keyboardCur = Keyboard.GetState(); |
|
506 | 498 | MouseState mouseCur = Mouse.GetState(); |
|
507 | ||
|
508 |
|
|
|
509 | // | |
|
510 |
|
|
|
511 |
|
|
|
512 | { | |
|
513 |
|
|
|
514 | } | |
|
515 |
|
|
|
516 | { | |
|
517 |
|
|
|
518 |
|
|
|
519 | } | |
|
520 |
|
|
|
521 |
|
|
|
499 | ||
|
500 | #region input | |
|
501 | // | |
|
502 | #region misc_keys | |
|
503 | if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash) && keyboardCur.IsKeyDown(Keys.LeftShift)) | |
|
504 | { | |
|
505 | sound.Play(volume, pitch, pan); | |
|
506 | } | |
|
507 | if (keyboardCur.IsKeyDown(Keys.V) && keyboardPrev.IsKeyUp(Keys.V)) | |
|
508 | { | |
|
509 | // debugWindow.swap(); | |
|
510 | debugWindow.setMonoFont(debugWindow.addFont("Roboto", 25, false)); | |
|
511 | } | |
|
512 | #endregion misc_keys | |
|
513 | #endregion input | |
|
522 | 514 | |
|
523 | 515 | World.Update(gameTime.ElapsedGameTime.TotalSeconds); |
|
524 |
|
|
|
516 | this.simulation.update(gameTime.ElapsedGameTime); | |
|
525 | 517 | |
|
526 |
|
|
|
527 | { | |
|
528 |
|
|
|
529 | } | |
|
518 | if (this.showBudget) | |
|
519 | { | |
|
520 | this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); | |
|
521 | } | |
|
530 | 522 | |
|
531 | 523 | |
|
532 |
|
|
|
533 | { | |
|
534 |
|
|
|
535 |
|
|
|
536 | } | |
|
524 | if (!this.showInitial && this.remainingDialog.Count > 0) | |
|
525 | { | |
|
526 | this.currentNode = this.remainingDialog.Dequeue(); | |
|
527 | this.showInitial = true; | |
|
528 | } | |
|
537 | 529 | |
|
538 |
|
|
|
530 | this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); | |
|
539 | 531 | |
|
540 |
|
|
|
541 |
|
|
|
542 |
|
|
|
543 |
|
|
|
532 | //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX); | |
|
533 | /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */ | |
|
534 | //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2)); | |
|
535 | /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */ | |
|
544 | 536 | |
|
545 |
|
|
|
546 |
|
|
|
537 | //this.mouseGrid = new Vector2(gridx, gridy); | |
|
538 | this.mouseGrid = this.calculateMousegrid(this.original_point); | |
|
547 | 539 | |
|
548 |
|
|
|
540 | elapsedTime += gameTime.ElapsedGameTime; | |
|
549 | 541 | |
|
550 |
|
|
|
551 | { | |
|
552 |
|
|
|
553 |
|
|
|
554 |
|
|
|
555 | } | |
|
542 | if (elapsedTime > TimeSpan.FromSeconds(1)) | |
|
543 | { | |
|
544 | elapsedTime -= TimeSpan.FromSeconds(1); | |
|
545 | frameRate = frameCounter; | |
|
546 | frameCounter = 0; | |
|
547 | } | |
|
556 | 548 | |
|
557 |
|
|
|
558 |
|
|
|
549 | this.keyboardPrev = keyboardCur; | |
|
550 | this.mousePrev = mouseCur; | |
|
559 | 551 | |
|
560 |
|
|
|
561 |
|
|
|
552 | stopWatch.Stop(); | |
|
553 | this.updateTime = stopWatch.Elapsed; | |
|
562 | 554 | |
|
563 |
|
|
|
555 | base.Update(gameTime); | |
|
564 | 556 | |
|
565 | } | |
|
557 | } | |
|
566 | 558 | |
|
567 |
|
|
|
568 |
|
|
|
569 | } | |
|
559 | protected float calculateDepth() { | |
|
560 | return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; | |
|
561 | } | |
|
570 | 562 | |
|
571 |
|
|
|
572 | { | |
|
573 |
|
|
|
574 |
|
|
|
563 | protected Boolean cull(int gridX, int gridY) | |
|
564 | { | |
|
565 | int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2; | |
|
566 | int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2; | |
|
575 | 567 | |
|
576 |
|
|
|
568 | Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice)); | |
|
577 | 569 | |
|
578 |
|
|
|
579 |
|
|
|
580 |
|
|
|
581 | } | |
|
570 | return (!FNAGame.enableCulling || | |
|
571 | (MathUtils.BetweenExclusive(original.X, -Tile.TileSpriteWidth, FNAGame.width) | |
|
572 | && MathUtils.BetweenExclusive(original.Y, -Tile.TileSpriteHeight, FNAGame.height))); | |
|
573 | } | |
|
582 | 574 | |
|
583 | 575 | //Convenience method I'm not super sure about anymore. |
|
584 | 576 | protected void drawTileAt(int x, int y, int tileIndex, int height) |
@@ -604,7 +596,7 | |||
|
604 | 596 | GraphicsDevice.Clear(Color.CornflowerBlue); |
|
605 | 597 | |
|
606 | 598 | _imGuiRenderer.BeforeLayout(gameTime); |
|
607 |
|
|
|
599 | if (this.isPlaying) | |
|
608 | 600 | { |
|
609 | 601 | batch.Begin(SpriteSortMode.BackToFront, |
|
610 | 602 | BlendState.AlphaBlend, |
@@ -677,7 +669,7 | |||
|
677 | 669 | new Vector2(((x - 0) * Tile.TileSpriteWidth / 2), (x + 0) * Tile.TileSpriteHeight / 2) + adjust, |
|
678 | 670 | //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), |
|
679 | 671 | new Vector2((x - this.squaresDown) * Tile.TileSpriteWidth / 2, (x + this.squaresDown) * Tile.TileSpriteHeight / 2) + adjust, |
|
680 |
Color.White, 0.81f); |
|
|
672 | Color.White, 0.81f); | |
|
681 | 673 | |
|
682 | 674 | } |
|
683 | 675 | } |
@@ -761,7 +753,7 | |||
|
761 | 753 | Quad.FillSquare2(batch, 8, 5, Color.Teal, .5f, 0.79f); |
|
762 | 754 | Quad.FillSquare2(batch, 8, 6, Color.Teal, .25f, 0.79f); |
|
763 | 755 | Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f); |
|
764 |
#endif |
|
|
756 | #endif | |
|
765 | 757 | |
|
766 | 758 | |
|
767 | 759 | |
@@ -824,10 +816,9 | |||
|
824 | 816 | String status_left = ""; |
|
825 | 817 | if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth) && MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) |
|
826 | 818 | { |
|
827 |
|
|
|
828 | this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status, | |
|
829 | this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unzoned") | |
|
830 | ); | |
|
819 | status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y, | |
|
820 | this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status, | |
|
821 | this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unzoned")); | |
|
831 | 822 | } |
|
832 | 823 | |
|
833 | 824 | String header_left = String.Format("${0:}|{1:} \ue124", this.simulation.money, this.simulation.map.tree_count); |
@@ -882,52 +873,52 | |||
|
882 | 873 | NewsWindow.Render(this.showNews, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine); |
|
883 | 874 | } |
|
884 | 875 | |
|
885 |
|
|
|
876 | bool quit = false; | |
|
886 | 877 | Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left); |
|
887 | 878 | |
|
888 |
|
|
|
889 |
|
|
|
890 | } | |
|
879 | if (quit) { | |
|
880 | System.Environment.Exit(0); | |
|
881 | } | |
|
891 | 882 | |
|
892 | 883 | } |
|
893 |
|
|
|
894 |
|
|
|
895 |
|
|
|
896 |
|
|
|
897 | null, | |
|
898 | null, | |
|
899 | null, | |
|
900 | null); | |
|
884 | else { | |
|
885 | GraphicsDevice.Clear(Color.Teal); | |
|
886 | batch.Begin(SpriteSortMode.BackToFront, | |
|
887 | BlendState.AlphaBlend, | |
|
888 | null, | |
|
889 | null, | |
|
890 | null, | |
|
891 | null); | |
|
901 | 892 | |
|
902 |
|
|
|
903 |
|
|
|
904 |
|
|
|
905 |
|
|
|
906 |
|
|
|
907 |
|
|
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
|
911 |
|
|
|
912 |
|
|
|
913 |
|
|
|
893 | Vector2 middle_dimensions = largeMonoFont.MeasureString("Isometric Park"); | |
|
894 | float middle_start = (int)((FNAGame.width / 2) - (middle_dimensions.X / 2)); | |
|
895 | ImGui.SetNextWindowPos(new Num.Vector2(((FNAGame.width/2) - 40), 200)); | |
|
896 | batch.DrawString(largeMonoFont, "Isometric Park", | |
|
897 | new Vector2(middle_start, 50), | |
|
898 | Color.Black, 0.0f, Vector2.Zero, | |
|
899 | 1.0f, SpriteEffects.None, 0.5f); | |
|
900 | batch.DrawString(largeMonoFont, "Isometric Park", | |
|
901 | new Vector2(middle_start-1, 49), | |
|
902 | Color.White, 0.0f, Vector2.Zero, | |
|
903 | 1.0f, SpriteEffects.None, 0.51f); | |
|
904 | World.Draw(); | |
|
914 | 905 | |
|
915 |
|
|
|
916 |
|
|
|
917 |
|
|
|
918 |
|
|
|
919 |
|
|
|
920 |
|
|
|
906 | Vector2 version_dimensions = monoFont.MeasureString(typeof(FNAGame).Assembly.GetName().Version.ToString()); | |
|
907 | batch.DrawString(monoFont, | |
|
908 | typeof(FNAGame).Assembly.GetName().Version.ToString(), | |
|
909 | new Vector2(0, FNAGame.height-version_dimensions.Y), | |
|
910 | Color.White, 0.0f, Vector2.Zero, | |
|
911 | 1.0f, SpriteEffects.None, 0.51f); | |
|
921 | 912 | |
|
922 |
|
|
|
923 |
|
|
|
913 | Vector2 name_dimensions = monoFont.MeasureString("by actuallyalys<3"); | |
|
914 | float name_start = (int)(FNAGame.width / 2) - (name_dimensions.X / 2); | |
|
924 | 915 | |
|
925 |
|
|
|
926 |
|
|
|
927 |
|
|
|
928 |
|
|
|
929 |
|
|
|
930 | } | |
|
916 | batch.DrawString(monoFont, "by actuallyalys <3", | |
|
917 | new Vector2(name_start, 50+middle_dimensions.Y), | |
|
918 | Color.White, 0.0f, Vector2.Zero, | |
|
919 | 1.0f, SpriteEffects.None, 0.51f); | |
|
920 | batch.End(); | |
|
921 | } | |
|
931 | 922 | #endregion |
|
932 | 923 | |
|
933 | 924 | |
@@ -1011,15 +1002,12 | |||
|
1011 | 1002 | |
|
1012 | 1003 | public void setResolution(Vector2 newResolution, bool fullscreen) |
|
1013 | 1004 | { |
|
1014 |
|
|
|
1015 |
|
|
|
1005 | FNAGame.width = (int)newResolution.X; | |
|
1006 | FNAGame.height = (int)newResolution.Y; | |
|
1016 | 1007 | |
|
1017 |
|
|
|
1018 |
|
|
|
1019 |
|
|
|
1020 |
|
|
|
1008 | this.gdm.PreferredBackBufferWidth = (int)newResolution.X; | |
|
1009 | this.gdm.PreferredBackBufferHeight = (int)newResolution.Y; | |
|
1010 | this.gdm.IsFullScreen = fullscreen; | |
|
1011 | this.gdm.ApplyChanges(); | |
|
1021 | 1012 | } |
|
1022 | ||
|
1023 | ||
|
1024 | ||
|
1025 | 1013 | } |
You need to be logged in to leave comments.
Login now