diff --git a/SpriteFontPlus/src/obj/Debug/net45/SpriteFontPlus.FNA.csprojAssemblyReference.cache b/SpriteFontPlus/src/obj/Debug/net45/SpriteFontPlus.FNA.csprojAssemblyReference.cache index 63e3cecddc033926ced8c75529c2c150d687c821..8aa712e374a070776bb735d248c4e7cc960bfe1f GIT binary patch literal 7400 zc%1E7U2GKB6`q;>oi(sP5`Gd0c1s8Zd&UN@NdPM`1_u}07_SQnjxl$4?|N@MKiipE zyEY9!0g1E^Aqq((P%BkR`$E(-jViT$3l*x`r?gRs5-E{dsa0r&)aJ3NqV$~c%zAcb zCtxy_8YyG>+?hG|e)l`)o_prZEXQ*k_ckacq#~4c*j>mb9nBl!7!$%qdgq z)eYL(e3%+0)3xr7jMO2uOYN=Ay%oi(7_?iX70Vz>Yx8g=r?C71Iy=OTlR_WKTe^{O>}dkJy}DW^1~rn{Im_l~6mFXF!$hf2lj9;>EY_4< z<$xbF3QQwPb$ zAPVvT%NfL&mHP~$(iz>DGUY*C)1{(&Eju=ta+lPxO=_1FmXlTJB6mueHd1D?GxtbE zvzSVyEHxNW*c?IMNCicSCt;>ih%@ycl+Z$hn%G_H!)2V;;A|qywp0GL31Bi&W=+|k zW!;pSsjJj7SiTKhGu2kqh}<{SBj=bV@1?oQBwpF$Q!qXoBHO*hA~rC3eI!KSCsf78 zT>`jALdG3n+IMX5r2sw@A~<3$1I*ztFjX_J8*tY~O#|xTFxSl>GfbPbv6qJ&6PWF6 z;1waS-B3k^?Uy$Ze0kj2>f%ZiccHi&#XTrip;(P#4T`lW?nQAQigh4jIBe@JQ|Z<| zH;rOOiKu!Z3jb3A(V_)fHsdCySu)6@`(8e}X%5I8Z}T92G9LCz{jJ*G+3oH9EE zw(t9{MKv@Wb1;vB`}mD_uU~#YX(#aYm~K-kjz`;8)@$!~w6VJvX-DdI?1&XLSd?f{ z>o3HM>ad{~F&Ben5uU#TZg#czHqvf!wf8mB zKICfGHPUW%LjogbQEP-yu@W(RhN2qW7s^wS@{|>UScnxBGHE9AqzGN?=dqQ{>jj#F$8chb&Xx%?V#Lf^MuM4HoGOJQ%atAg5t*u1?1Ca`P?eO+ zw7~I+1ePCMBq9iCi@*y)T>vDLd@@tbFj|pKR*dn#$v5=aW;IP=> zqHhD(mousclegn0z73j*FEVhUg6+ie^|lJw9Xm)SpXus&WP2xVfA|rciO1Bn-uCHs zkj=NMd&Ew3X$D1CyeMQ9Ch?q23aAA?4jD zy19j8p7(FPysy^sehivj0I)!9Tf5YCd)%~&q9975nR9%F(HmWK#uj@}?7^{^TkG~B zR^{=DLGrY2K*Ka_Y+P|-gibT;g3~AAz^)jzpF0P?vFfN^kWHRCQrwGk?nBY%Tj<|- z9ro*5hxJ1<$Mh#&rmxmAJqAsG zxEp$NmEZ)1uv?9b$B`XDk@Hdfk(c5RYbjD_4!9^`k=#-xS@i5ur??jh z;kBKA{yvX2N{gq9d!#!9K{7s&t{{+I&WVuT?Vj=7PG@{$iF-OPIT8K}#_;*|6{~@T zg&Np?X!HL+CGao#1|J3=ry54D{edt`t>YbIV~cTkYxDp1W9j(#2`7sA`1d$Z3Qvj8 z;I=*K3Bmbod&b$e(bI5ox@OzrTeEluLuAj_f%SD@RRil;u3EgL#IqPA=X_yx!W&j| z{;)ca33G2?*4^jJx_v=e_dp=XfDdFa2xKG>BmU5#i2zg(hS7zfZq>>e^psmS6Z?V&>qM8{3w> z_>b7lzusth>!<&`@k!ySfh8BOzIJKzc&_ydZC(HAd)?N!-uAaoP9FPt`r0eqo7Vkc zWiMURtiE-zbMWXp7tYA4TvjM4%i1JU2f6OLEJ=Uh*o^?CAKfG2s( n7-#AMVtBF`9+-mG past_fps = new Queue(100); - int tilesDrawn = 0; + Queue past_fps = new Queue(100); + int tilesDrawn = 0; - private const int width = 1280; - private const int height = 640; + private const int width = 1280; + private const int height = 640; - //new tile stuff - int squaresAcross = 50; - int squaresDown = 50; - // int baseOffsetX = -14; - // int baseOffsetY = -14; + //new tile stuff + int squaresAcross = 50; + int squaresDown = 50; + // int baseOffsetX = -14; + // int baseOffsetY = -14; - Simulation simulation; + Simulation simulation; - Vector2 mouseGrid; - Vector2 original_point; - - private ImGuiRenderer _imGuiRenderer; - private DebugWindow debugWindow; + Vector2 mouseGrid; + Vector2 original_point; + + private ImGuiRenderer _imGuiRenderer; + private DebugWindow debugWindow; - bool show_another_window; + bool show_another_window; private bool showInitial; - int messageIndex; + int messageIndex; - //buggy + //buggy private static bool enableCulling = false; - private Node currentNode; - private Queue> remainingDialog; + private Node currentNode; + private Queue> remainingDialog; - private bool showGrid; + private bool showGrid; private Grammar grammar; private string output; private GraphicsDeviceManager gdm; @@ -81,411 +81,409 @@ private bool showForest; private static void Main(string[] args) - { - #if NETCOREAPP - DllMap.Initialise(false); -#endif - using FNAGame g = new FNAGame(); - g.Run(); - } + { + #if NETCOREAPP + DllMap.Initialise(false); + #endif + using FNAGame g = new FNAGame(); + g.Run(); + } - private FNAGame() - { - //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.) + private FNAGame() + { + //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.) #if DEBUG - foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) - { - Console.Out.Write(assembly.ToString() + "\n"); - } - ; + foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) + { + Console.Out.Write(assembly.ToString() + "\n"); + } + ; #endif - this.gdm = new GraphicsDeviceManager(this) - { + this.gdm = new GraphicsDeviceManager(this) { + // Typically you would load a config here... + PreferredBackBufferWidth = width, + PreferredBackBufferHeight = height, + IsFullScreen = false, + SynchronizeWithVerticalRetrace = true + }; + //gdm.SynchronizeWithVerticalRetrace = false; + IsFixedTimeStep = false; - // Typically you would load a config here... - PreferredBackBufferWidth = width, - PreferredBackBufferHeight = height, - IsFullScreen = false, - SynchronizeWithVerticalRetrace = true - }; - //gdm.SynchronizeWithVerticalRetrace = false; - IsFixedTimeStep = false; - - this.simulation = new Simulation(this.squaresAcross, this.squaresDown, 16.66667f*30); + this.simulation = new Simulation(this.squaresAcross, this.squaresDown, 16.66667f*30); - foreach (List row in this.simulation.map.cells) - { - foreach (Cell cell in row) - { - if (this.random_generator.NextDouble() > 0.75) - { - int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR); - int random_month = random_generator.Next(1, 12); - DateTime random_date = new DateTime(random_year, random_month, 1); + foreach (List row in this.simulation.map.cells) + { + foreach (Cell cell in row) + { + if (this.random_generator.NextDouble() > 0.75) + { + int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR); + int random_month = random_generator.Next(1, 12); + DateTime random_date = new DateTime(random_year, random_month, 1); - cell.addTree(random_date); - } - } - } + cell.addTree(random_date); + } + } + } - showInitial = true; - messageIndex = 0; - showBudget = false; - showForest = true; - showGrid = true; + showInitial = true; + messageIndex = 0; + showBudget = false; + showForest = true; + showGrid = true; - this.Window.Title = "Isometric Park"; + this.Window.Title = "Isometric Park"; - Content.RootDirectory = "Content"; + Content.RootDirectory = "Content"; - currentNode = DialogTrees.introTree; + currentNode = DialogTrees.introTree; - } + } - protected override void Initialize() - { - /* This is a nice place to start up the engine, after - * loading configuration stuff in the constructor - */ - this.IsMouseVisible = true; - - _imGuiRenderer = new ImGuiRenderer(this); - _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering - - base.Initialize(); - } + protected override void Initialize() + { + /* This is a nice place to start up the engine, after + * loading configuration stuff in the constructor + */ + this.IsMouseVisible = true; + + _imGuiRenderer = new ImGuiRenderer(this); + _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering - protected override void LoadContent() - { - // Create the batch... - batch = new SpriteBatch(GraphicsDevice); + base.Initialize(); + } - sound = Content.Load("FNASound"); - Tile.TileSetTexture = Content.Load(@"part4_tileset"); + protected override void LoadContent() + { + // Create the batch... + batch = new SpriteBatch(GraphicsDevice); - Line.initialize(GraphicsDevice); + sound = Content.Load("FNASound"); + Tile.TileSetTexture = Content.Load(@"part4_tileset"); + + Line.initialize(GraphicsDevice); - - var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"), - 15, - 1024, - 1024, - new[] - { - CharacterRange.BasicLatin, - CharacterRange.Latin1Supplement, - CharacterRange.LatinExtendedA, - CharacterRange.Cyrillic, - CharacterRange.LatinExtendedB, - new CharacterRange((char) 0x00B7) - } - ); + + var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"), + 15, + 1024, + 1024, + new[] + { + CharacterRange.BasicLatin, + CharacterRange.Latin1Supplement, + CharacterRange.LatinExtendedA, + CharacterRange.Cyrillic, + CharacterRange.LatinExtendedB, + new CharacterRange((char) 0x00B7) + } + ); - this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice); + this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice); - var json2 = new FileInfo(@"Content/grammar.json"); + var json2 = new FileInfo(@"Content/grammar.json"); - this.grammar = new TraceryNet.Grammar(json2); + this.grammar = new TraceryNet.Grammar(json2); - this.output = grammar.Flatten("#greeting#"); - var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#"); + this.output = grammar.Flatten("#greeting#"); + var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#"); - this.remainingDialog = new Queue>(); + this.remainingDialog = new Queue>(); + + this.remainingDialog.Enqueue(DialogTrees.flatten(DialogTrees.testTree, this.grammar)); - this.remainingDialog.Enqueue(DialogTrees.flatten(DialogTrees.testTree, this.grammar)); - - //font = fontBakeResult.CreateSpriteFont(GraphicsDevice); - monoFont = bakedMono.CreateSpriteFont(GraphicsDevice); + //font = fontBakeResult.CreateSpriteFont(GraphicsDevice); + monoFont = bakedMono.CreateSpriteFont(GraphicsDevice); - this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0); + this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0); - } + } - protected override void UnloadContent() - { - batch.Dispose(); - sound.Dispose(); - Tile.TileSetTexture.Dispose(); - } + protected override void UnloadContent() + { + batch.Dispose(); + sound.Dispose(); + Tile.TileSetTexture.Dispose(); + } - Vector2 calculateMousegrid(Vector2 normalizedMousePos) - { + Vector2 calculateMousegrid(Vector2 normalizedMousePos) + { - //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth); - //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight); - Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); - Vector2 adjustedMousePos = normalizedMousePos - adjust; + //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth); + //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight); + Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); + Vector2 adjustedMousePos = normalizedMousePos - adjust; - float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight)); - float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth)); + float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight)); + float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth)); - return new Vector2((int)boardx, (int)boardy); - /* - int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ; - int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY)); + return new Vector2((int)boardx, (int)boardy); + /* + int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ; + int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY)); - int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2); - int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2); + int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2); + int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2); - int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx); - Vector2 adjustment_vector; + int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx); + Vector2 adjustment_vector; - return new Vector2(gridx, gridy); - if (middle_distance < (Tile.TileWidth / 2)) - { - return new Vector2(gridx, gridy); - } + return new Vector2(gridx, gridy); + if (middle_distance < (Tile.TileWidth / 2)) + { + return new Vector2(gridx, gridy); + } - else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1)) - { - adjustment_vector = new Vector2(-1, -1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1)) - { - adjustment_vector = new Vector2(-1, 1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1)) - { - adjustment_vector = new Vector2(0, -1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1)) - { - adjustment_vector = new Vector2(0, 1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else { - return new Vector2(gridx, gridy); - } - */ + else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1)) + { + adjustment_vector = new Vector2(-1, -1); + return new Vector2(gridx, gridy) + adjustment_vector; + } + else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1)) + { + adjustment_vector = new Vector2(-1, 1); + return new Vector2(gridx, gridy) + adjustment_vector; + } + else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1)) + { + adjustment_vector = new Vector2(0, -1); + return new Vector2(gridx, gridy) + adjustment_vector; + } + else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1)) + { + adjustment_vector = new Vector2(0, 1); + return new Vector2(gridx, gridy) + adjustment_vector; + } + else { + return new Vector2(gridx, gridy); + } + */ - } + } - protected override void Update(GameTime gameTime) - { + protected override void Update(GameTime gameTime) + { - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); - float volume = 1.0f; - float pitch = 0.0f; - float pan = 0.0f; + float volume = 1.0f; + float pitch = 0.0f; + float pan = 0.0f; - // Run game logic in here. Do NOT render anything here! - KeyboardState keyboardCur = Keyboard.GetState(); - - #region input - #region camera_movement_keys + // Run game logic in here. Do NOT render anything here! + KeyboardState keyboardCur = Keyboard.GetState(); + + #region input + #region camera_movement_keys if (keyboardCur.IsKeyDown(Keys.Down)) - { - this.camera.Move(new Vector2(0, 2)); - } - else if (keyboardCur.IsKeyDown(Keys.Up)) - { - this.camera.Move(new Vector2(0, -2)); + { + this.camera.Move(new Vector2(0, 2)); + } + else if (keyboardCur.IsKeyDown(Keys.Up)) + { + this.camera.Move(new Vector2(0, -2)); - } - else if (keyboardCur.IsKeyDown(Keys.Left)) - { - this.camera.Move(new Vector2(-2, 0)); + } + else if (keyboardCur.IsKeyDown(Keys.Left)) + { + this.camera.Move(new Vector2(-2, 0)); - } - else if (keyboardCur.IsKeyDown(Keys.Right)) - { - this.camera.Move(new Vector2(2, 0)); + } + else if (keyboardCur.IsKeyDown(Keys.Right)) + { + this.camera.Move(new Vector2(2, 0)); - } - else if (keyboardCur.IsKeyDown(Keys.Subtract) && keyboardPrev.IsKeyUp(Keys.Subtract)) - { - this.camera.ZoomOut(); - } - else if (keyboardCur.IsKeyDown(Keys.Add) && keyboardPrev.IsKeyUp(Keys.Add)) - { + } + else if (keyboardCur.IsKeyDown(Keys.Subtract) && keyboardPrev.IsKeyUp(Keys.Subtract)) + { + this.camera.ZoomOut(); + } + else if (keyboardCur.IsKeyDown(Keys.Add) && keyboardPrev.IsKeyUp(Keys.Add)) + { - this.camera.ZoomIn(); - } - #endregion camera_movement_keys + this.camera.ZoomIn(); + } + #endregion camera_movement_keys - #region misc_keys - if (keyboardCur.IsKeyDown(Keys.Q) && keyboardPrev.IsKeyUp(Keys.Q)) - { - System.Console.WriteLine("Quitting"); - Environment.Exit(0); - } - if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash)) + #region misc_keys + if (keyboardCur.IsKeyDown(Keys.Q) && keyboardPrev.IsKeyUp(Keys.Q)) + { + System.Console.WriteLine("Quitting"); + Environment.Exit(0); + } + if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash)) { - this.show_another_window = !this.show_another_window; + this.show_another_window = !this.show_another_window; - } + } - if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) - { - this.showGrid = !this.showGrid; + if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G)) + { + this.showGrid = !this.showGrid; - } - if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B)) - { - this.showBudget = !this.showBudget; + } + if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B)) + { + this.showBudget = !this.showBudget; - } - if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F)) - { - this.showForest = !this.showForest; + } + if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F)) + { + this.showForest = !this.showForest; - } - if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C)) - { - this.camera.Jump(Vector2.Zero); + } + if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C)) + { + this.camera.Jump(Vector2.Zero); - } - if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash) && keyboardCur.IsKeyDown(Keys.LeftShift)) - { - sound.Play(volume, pitch, pan); - } - #endregion misc_keys + } + if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash) && keyboardCur.IsKeyDown(Keys.LeftShift)) + { + sound.Play(volume, pitch, pan); + } + #endregion misc_keys - #region gamerate_keys - if (keyboardCur.IsKeyDown(Keys.D0) && keyboardPrev.IsKeyUp(Keys.D0) ) - { - this.simulation.paused = !this.simulation.paused; + #region gamerate_keys + if (keyboardCur.IsKeyDown(Keys.D0) && keyboardPrev.IsKeyUp(Keys.D0) ) + { + this.simulation.paused = !this.simulation.paused; - } - #endregion gamerate_keys + } + #endregion gamerate_keys - + - //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P)) - // { - // this.player_state = !this.player_state; - // } + //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P)) + // { + // this.player_state = !this.player_state; + // } - //if (player_state ) - //{ - // MediaPlayer.Play(music); - //} + //if (player_state ) + //{ + // MediaPlayer.Play(music); + //} - MouseState mouseCur = Mouse.GetState(); - this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); + MouseState mouseCur = Mouse.GetState(); + this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); - if (MathUtils.Between(mouseCur.X, 0, 50)) - { - this.camera.Move(new Vector2(-4, 0)); - } - else if (MathUtils.Between(mouseCur.X, (FNAGame.width - 50), FNAGame.width)) - { - this.camera.Move(new Vector2(4, 0)); - } + if (MathUtils.Between(mouseCur.X, 0, 50)) + { + this.camera.Move(new Vector2(-4, 0)); + } + else if (MathUtils.Between(mouseCur.X, (FNAGame.width - 50), FNAGame.width)) + { + this.camera.Move(new Vector2(4, 0)); + } - if (MathUtils.Between(mouseCur.Y, 0, 50)) - { - this.camera.Move(new Vector2(0, -4)); - } - else if (MathUtils.Between(mouseCur.Y, (FNAGame.height - 50), FNAGame.height)) - { - this.camera.Move(new Vector2(0, 4)); - } + if (MathUtils.Between(mouseCur.Y, 0, 50)) + { + this.camera.Move(new Vector2(0, -4)); + } + else if (MathUtils.Between(mouseCur.Y, (FNAGame.height - 50), FNAGame.height)) + { + this.camera.Move(new Vector2(0, 4)); + } - if (mouseCur.RightButton == ButtonState.Pressed) + if (mouseCur.RightButton == ButtonState.Pressed) { - Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); - Vector2 delta = this.camera.position - this.original_point; - this.camera.Jump(this.original_point); + Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); + Vector2 delta = this.camera.position - this.original_point; + this.camera.Jump(this.original_point); + } + + #endregion input + + + + this.simulation.update(gameTime.ElapsedGameTime); + + if (this.showBudget) + { + this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); } - #endregion input - - - - this.simulation.update(gameTime.ElapsedGameTime); - if (this.showBudget) - { - this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); - } + if (!this.showInitial && this.remainingDialog.Count > 0) + { + this.currentNode = this.remainingDialog.Dequeue(); + this.showInitial = true; + } + this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); - if (!this.showInitial && this.remainingDialog.Count > 0) - { - this.currentNode = this.remainingDialog.Dequeue(); - this.showInitial = true; - } - - this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); + //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX); + /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */ + //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2)); + /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */ - //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX); - /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */ - //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2)); - /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */ + //this.mouseGrid = new Vector2(gridx, gridy); + this.mouseGrid = this.calculateMousegrid(this.original_point); - //this.mouseGrid = new Vector2(gridx, gridy); - this.mouseGrid = this.calculateMousegrid(this.original_point); - - elapsedTime += gameTime.ElapsedGameTime; + elapsedTime += gameTime.ElapsedGameTime; - if (elapsedTime > TimeSpan.FromSeconds(1)) - { - elapsedTime -= TimeSpan.FromSeconds(1); - frameRate = frameCounter; - frameCounter = 0; - } + if (elapsedTime > TimeSpan.FromSeconds(1)) + { + elapsedTime -= TimeSpan.FromSeconds(1); + frameRate = frameCounter; + frameCounter = 0; + } - this.keyboardPrev = keyboardCur; + this.keyboardPrev = keyboardCur; - stopWatch.Stop(); - this.updateTime = stopWatch.Elapsed; + stopWatch.Stop(); + this.updateTime = stopWatch.Elapsed; - base.Update(gameTime); + base.Update(gameTime); - } + } - protected float calculateDepth() { - return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; - } + protected float calculateDepth() { + return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; + } - protected Boolean cull(int gridX, int gridY) - { - int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2; - int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2; + protected Boolean cull(int gridX, int gridY) + { + int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2; + int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2; - Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice)); + Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice)); - return (!FNAGame.enableCulling || - (MathUtils.Between(original.X, -Tile.TileSpriteWidth, FNAGame.width) - && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height))); - } + return (!FNAGame.enableCulling || + (MathUtils.Between(original.X, -Tile.TileSpriteWidth, FNAGame.width) + && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height))); + } //Convenience method I'm not super sure about anymore. protected void drawTileAt(int x, int y, int tileIndex, int height) - { - float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; + { + float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; - float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); + float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); - Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset); - } + Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset); + } - protected override void Draw(GameTime gameTime) + protected override void Draw(GameTime gameTime) { // Render stuff in here. Do NOT run game logic in here! @@ -497,52 +495,52 @@ stopWatch.Start(); GraphicsDevice.Clear(Color.CornflowerBlue); batch.Begin(SpriteSortMode.BackToFront, - BlendState.AlphaBlend, - null, - null, - null, - null, - camera.get_transformation(GraphicsDevice)); + BlendState.AlphaBlend, + null, + null, + null, + null, + camera.get_transformation(GraphicsDevice)); //New tile stuff /* - Vector2 firstSquare = Vector2.Zero; - int firstX = (int)firstSquare.X; - int firstY = (int)firstSquare.Y; + Vector2 firstSquare = Vector2.Zero; + int firstX = (int)firstSquare.X; + int firstY = (int)firstSquare.Y; - Vector2 squareOffset = Vector2.Zero; + Vector2 squareOffset = Vector2.Zero; - int offsetX = (int)squareOffset.X; - int offsetY = (int)squareOffset.Y; + int offsetX = (int)squareOffset.X; + int offsetY = (int)squareOffset.Y; - for (int y = 0; y < this.squaresDown; y++) + for (int y = 0; y < this.squaresDown; y++) { - int rowOffset = 0; - if ((firstY + y) % 2 == 1) - rowOffset = Tile.OddRowXOffset; + int rowOffset = 0; + if ((firstY + y) % 2 == 1) + rowOffset = Tile.OddRowXOffset; - for (int x = 0; x < this.squaresAcross; x++) { + for (int x = 0; x < this.squaresAcross; x++) { - batch.Draw( - Tile.TileSetTexture, + batch.Draw( + Tile.TileSetTexture, new Rectangle( - ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX), - ((y * Tile.TileStepY) - offsetY + baseOffsetY), - Tile.TileWidth, Tile.TileHeight), - Tile.GetSourceRectangle(1), - Color.White, - 0.0f, - Vector2.Zero, - SpriteEffects.None, - 0.9f); + ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX), + ((y * Tile.TileStepY) - offsetY + baseOffsetY), + Tile.TileWidth, Tile.TileHeight), + Tile.GetSourceRectangle(1), + Color.White, + 0.0f, + Vector2.Zero, + SpriteEffects.None, + 0.9f); - + } }*/ - #region draw_tiles + #region draw_tiles //reset this.tilesDrawn = 0; @@ -559,25 +557,25 @@ if (this.cull(x, y)) { batch.Draw( - Tile.TileSetTexture, - new Rectangle( + Tile.TileSetTexture, + new Rectangle( screenx, screeny, Tile.TileWidth, Tile.TileHeight), - Tile.GetSourceRectangle(1), - Color.White, - 0.0f, - Vector2.Zero, - SpriteEffects.None, - 0.9f); + Tile.GetSourceRectangle(1), + Color.White, + 0.0f, + Vector2.Zero, + SpriteEffects.None, + 0.9f); this.tilesDrawn++; } } } - #endregion draw_tiles + #endregion draw_tiles - #region draw_gridlines + #region draw_gridlines if (this.showGrid) { @@ -588,10 +586,13 @@ Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved Line.drawLine(batch, - new Vector2(((0 - y) * Tile.TileSpriteWidth / 2), (0 + y) * Tile.TileSpriteHeight / 2) + adjust, - //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), - new Vector2((this.squaresAcross - (y)) * Tile.TileSpriteWidth / 2, (this.squaresAcross + (y)) * Tile.TileSpriteHeight / 2) + adjust, - Color.White, 0.8f); + new Vector2(((0 - y) * Tile.TileSpriteWidth / 2), + (0 + y) * Tile.TileSpriteHeight / 2) + adjust, + //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), + new Vector2((this.squaresAcross - (y)) * Tile.TileSpriteWidth / 2, + (this.squaresAcross + (y)) * Tile.TileSpriteHeight / 2) + adjust, + + Color.White, 0.8f); } @@ -601,112 +602,112 @@ Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved Line.drawLine(batch, - new Vector2(((x - 0) * Tile.TileSpriteWidth / 2), (x + 0) * Tile.TileSpriteHeight / 2) + adjust, - //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), - new Vector2((x - this.squaresDown) * Tile.TileSpriteWidth / 2, (x + this.squaresDown) * Tile.TileSpriteHeight / 2) + adjust, - Color.White, 0.8f); + new Vector2(((x - 0) * Tile.TileSpriteWidth / 2), (x + 0) * Tile.TileSpriteHeight / 2) + adjust, + //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight), + new Vector2((x - this.squaresDown) * Tile.TileSpriteWidth / 2, (x + this.squaresDown) * Tile.TileSpriteHeight / 2) + adjust, + Color.White, 0.8f); } } - #endregion draw_gridlines + #endregion draw_gridlines - //Gridlines - //Lines going down and to the right: - /* - for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++) - { - int rowOffset = 0; + //Gridlines + //Lines going down and to the right: + /* + for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++) + { + int rowOffset = 0; - float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); + float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); - Vector2 start = new Vector2(startX, -baseOffsetY+4); - Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2, - this.squaresDown*Tile.TileStepY- baseOffsetY+4); + Vector2 start = new Vector2(startX, -baseOffsetY+4); + Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2, + this.squaresDown*Tile.TileStepY- baseOffsetY+4); - Line.drawLine(batch, - Line.departurePoint(stop, start, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), - Line.departurePoint(start, stop, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), - Color.White, 0.8f); + Line.drawLine(batch, + Line.departurePoint(stop, start, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), + Line.departurePoint(start, stop, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), + Color.White, 0.8f); - } - //Lines going down and to the left: - for (int x = 0; x < (int)(1.5*this.squaresAcross); x++) - { + } + //Lines going down and to the left: + for (int x = 0; x < (int)(1.5*this.squaresAcross); x++) + { - float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); + float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); - Vector2 start_reverse = new Vector2(startX, -baseOffsetY + 4); - Vector2 stop_reverse = new Vector2(startX + -(this.squaresAcross * Tile.TileStepX / 2), - (this.squaresDown * Tile.TileStepY) - baseOffsetY + 4); + Vector2 start_reverse = new Vector2(startX, -baseOffsetY + 4); + Vector2 stop_reverse = new Vector2(startX + -(this.squaresAcross * Tile.TileStepX / 2), + (this.squaresDown * Tile.TileStepY) - baseOffsetY + 4); - Line.drawLine(batch, - Line.departurePoint(stop_reverse, start_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), - Line.departurePoint(start_reverse, stop_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), - Color.White, 0.8f); + Line.drawLine(batch, + Line.departurePoint(stop_reverse, start_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), + Line.departurePoint(start_reverse, stop_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), + Color.White, 0.8f); - } - */ + } + */ -#if DEBUG + #if DEBUG drawTileAt(4, 4, 140, 3); drawTileAt(6, 4, 141, 3); drawTileAt(8, 4, 142, 2); drawTileAt(10, 4, 142, 3); -#endif + #endif - #region draw_cursor - //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines + #region draw_cursor + //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines - //TODO figure out why it has to be -1 + //TODO figure out why it has to be -1 if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth) - && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) + && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) { - Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); - } + Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1); + } #if DEBUG - Tile.OutlineSquare(batch, 1, 1, Color.Red, 2); - Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2); - Tile.OutlineSquare(batch, 5, 1, Color.Green, 2); - Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2); + Tile.OutlineSquare(batch, 1, 1, Color.Red, 2); + Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2); + Tile.OutlineSquare(batch, 5, 1, Color.Green, 2); + Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2); #endif #endregion draw_cursor - /* + /* - for (int i = 0; i< 80; i++) + for (int i = 0; i< 80; i++) { - for (int j = 0; j < 50; j += 1) - { - //Warning: creates a flashing effect because tree positions update every 1/60th of a second + for (int j = 0; j < 50; j += 1) + { + //Warning: creates a flashing effect because tree positions update every 1/60th of a second - if (this.random_generator.NextDouble() > 0.75) + if (this.random_generator.NextDouble() > 0.75) { - drawTileAt(i, j, 142, 2); - } + drawTileAt(i, j, 142, 2); + } - if ((i + j) % 3 == 0) - { - drawTileAt(i, j, 142, 2); - } + if ((i + j) % 3 == 0) + { + drawTileAt(i, j, 142, 2); + } - } - }//*/ + } + }//*/ #region draw_trees - for (int i = 0; i < this.simulation.map.MapHeight; i++) + for (int i = 0; i < this.simulation.map.MapHeight; i++) { for (int j = 0; j < this.simulation.map.MapWidth; j += 1) { if (this.simulation.map.cells[i][j].hasTree) { //until we actually simulate: - drawTileAt(i, j, 142, 2); + drawTileAt(i, j, 142, 2); // if ((i + j) % 8 == 0) // { // drawTileAt(i, j, 141, 2); @@ -716,11 +717,11 @@ // drawTileAt(i, j, 142, 2); // } } - else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) { - drawTileAt(i, j, 141, 2); - // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j)); + else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) { + drawTileAt(i, j, 141, 2); + // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j)); - } + } } } #endregion draw_trees @@ -733,11 +734,11 @@ #region draw_header batch.Begin(SpriteSortMode.BackToFront, - BlendState.AlphaBlend, - null, - null, - null, - null); + BlendState.AlphaBlend, + null, + null, + null, + null); bool has_tree = false; if (MathUtils.Between(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.Between(this.mouseGrid.Y, 0, this.squaresAcross)) @@ -766,22 +767,22 @@ batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_right, new Vector2(right_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); - #endregion draw_header +#endregion draw_header - #region budget + #region budget - if (this.showBudget) - { - budgetWindow.draw(batch); + if (this.showBudget) + { + budgetWindow.draw(batch); - } + } - #endregion budget + #endregion budget - batch.End(); + batch.End(); - + #region debug_window @@ -793,12 +794,11 @@ } DebugInfo debugInfo = new DebugInfo - { - fps = this.frameRate, + { fps = this.frameRate, pastFps = past_fps.ToArray(), cameraPosition = camera.position, drawTime = this.drawTime, - updateTime = this.updateTime, + updateTime = this.updateTime, treeCount = this.simulation.map.tree_count, mouseGrid = this.mouseGrid, hasTree = has_tree, @@ -810,37 +810,37 @@ var additionalInfo = new Dictionary(); - Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); - var state = Mouse.GetState(); - Vector2 delta = this.camera.position - this.original_point; + Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2); + var state = Mouse.GetState(); + Vector2 delta = this.camera.position - this.original_point; - additionalInfo.Add("cameraMiddle", cameraMiddle.ToString()); - additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y)); - additionalInfo.Add("mouse delta", delta.ToString()); + additionalInfo.Add("cameraMiddle", cameraMiddle.ToString()); + additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y)); + additionalInfo.Add("mouse delta", delta.ToString()); - additionalInfo.Add("Tracery Test", this.output); + additionalInfo.Add("Tracery Test", this.output); - debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window); + debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window); - //debugWindow.ImGuiLayout(); - //String[] messages = { "Message1", "Message2" }; + //debugWindow.ImGuiLayout(); + //String[] messages = { "Message1", "Message2" }; - //DialogOption[] dialog = { new DialogOption{ response="Welcome to your new park, director! You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out.", choice="Okay" }, - // new DialogOption{ response="Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!", choice="And I need to keep the forest healthy, too, right?" }, - // new DialogOption{ response="Oh yeah, of course.", choice="..." }}; + //DialogOption[] dialog = { new DialogOption{ response="Welcome to your new park, director! You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out.", choice="Okay" }, + // new DialogOption{ response="Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!", choice="And I need to keep the forest healthy, too, right?" }, + // new DialogOption{ response="Oh yeah, of course.", choice="..." }}; - if (this.currentNode != null) + if (this.currentNode != null) { this.currentNode = DialogInterface.RenderDialog(ref this.showInitial, - ref this.simulation.paused, debugWindow.monoFont, this.currentNode); + ref this.simulation.paused, debugWindow.monoFont, this.currentNode); } - if (this.showForest) - { + if (this.showForest) + { ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation); - } + } _imGuiRenderer.AfterLayout(); @@ -853,5 +853,5 @@ base.Draw(gameTime); } - + }