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

r101:4f41bd695964 -

1 NO CONTENT: modified file, binary diff hidden
This diff has been collapsed as it changes many lines, (960 lines changed) Show them Hide them
@@ -25,54 +25,54
25 25
26 26 class FNAGame : Game
27 27 {
28 private KeyboardState keyboardPrev = new KeyboardState();
28 private KeyboardState keyboardPrev = new KeyboardState();
29 29
30 private SpriteBatch batch;
31 private SoundEffect sound;
32 private SpriteFont monoFont;
30 private SpriteBatch batch;
31 private SoundEffect sound;
32 private SpriteFont monoFont;
33 33
34 private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
34 private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
35 35
36 Random random_generator = new Random();
36 Random random_generator = new Random();
37 37
38 int frameRate = 0;
39 int frameCounter = 0;
40 TimeSpan elapsedTime = TimeSpan.Zero;
41 TimeSpan drawTime = TimeSpan.Zero;
42 TimeSpan updateTime = TimeSpan.Zero;
38 int frameRate = 0;
39 int frameCounter = 0;
40 TimeSpan elapsedTime = TimeSpan.Zero;
41 TimeSpan drawTime = TimeSpan.Zero;
42 TimeSpan updateTime = TimeSpan.Zero;
43 43
44 Queue<float> past_fps = new Queue<float>(100);
45 int tilesDrawn = 0;
44 Queue<float> past_fps = new Queue<float>(100);
45 int tilesDrawn = 0;
46 46
47 private const int width = 1280;
48 private const int height = 640;
47 private const int width = 1280;
48 private const int height = 640;
49 49
50 //new tile stuff
51 int squaresAcross = 50;
52 int squaresDown = 50;
53 // int baseOffsetX = -14;
54 // int baseOffsetY = -14;
50 //new tile stuff
51 int squaresAcross = 50;
52 int squaresDown = 50;
53 // int baseOffsetX = -14;
54 // int baseOffsetY = -14;
55 55
56 Simulation simulation;
56 Simulation simulation;
57 57
58 Vector2 mouseGrid;
59 Vector2 original_point;
60
61 private ImGuiRenderer _imGuiRenderer;
62 private DebugWindow debugWindow;
58 Vector2 mouseGrid;
59 Vector2 original_point;
60
61 private ImGuiRenderer _imGuiRenderer;
62 private DebugWindow debugWindow;
63 63
64 bool show_another_window;
64 bool show_another_window;
65 65 private bool showInitial;
66 int messageIndex;
66 int messageIndex;
67 67
68 //buggy
68 //buggy
69 69 private static bool enableCulling = false;
70 70
71 private Node<DialogOption> currentNode;
72 private Queue<Node<DialogOption>> remainingDialog;
71 private Node<DialogOption> currentNode;
72 private Queue<Node<DialogOption>> remainingDialog;
73 73
74 74
75 private bool showGrid;
75 private bool showGrid;
76 76 private Grammar grammar;
77 77 private string output;
78 78 private GraphicsDeviceManager gdm;
@@ -81,411 +81,409
81 81 private bool showForest;
82 82
83 83 private static void Main(string[] args)
84 {
85 #if NETCOREAPP
86 DllMap.Initialise(false);
87 #endif
88 using FNAGame g = new FNAGame();
89 g.Run();
90 }
84 {
85 #if NETCOREAPP
86 DllMap.Initialise(false);
87 #endif
88 using FNAGame g = new FNAGame();
89 g.Run();
90 }
91 91
92 92
93 93
94 94
95 private FNAGame()
96 {
97 //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.)
95 private FNAGame()
96 {
97 //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.)
98 98
99 99 #if DEBUG
100 foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
101 {
102 Console.Out.Write(assembly.ToString() + "\n");
103 }
104 ;
100 foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
101 {
102 Console.Out.Write(assembly.ToString() + "\n");
103 }
104 ;
105 105 #endif
106 this.gdm = new GraphicsDeviceManager(this)
107 {
106 this.gdm = new GraphicsDeviceManager(this) {
107 // Typically you would load a config here...
108 PreferredBackBufferWidth = width,
109 PreferredBackBufferHeight = height,
110 IsFullScreen = false,
111 SynchronizeWithVerticalRetrace = true
112 };
113 //gdm.SynchronizeWithVerticalRetrace = false;
114 IsFixedTimeStep = false;
108 115
109 // Typically you would load a config here...
110 PreferredBackBufferWidth = width,
111 PreferredBackBufferHeight = height,
112 IsFullScreen = false,
113 SynchronizeWithVerticalRetrace = true
114 };
115 //gdm.SynchronizeWithVerticalRetrace = false;
116 IsFixedTimeStep = false;
117
118 this.simulation = new Simulation(this.squaresAcross, this.squaresDown, 16.66667f*30);
116 this.simulation = new Simulation(this.squaresAcross, this.squaresDown, 16.66667f*30);
119 117
120 foreach (List<Cell> row in this.simulation.map.cells)
121 {
122 foreach (Cell cell in row)
123 {
124 if (this.random_generator.NextDouble() > 0.75)
125 {
126 int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR);
127 int random_month = random_generator.Next(1, 12);
128 DateTime random_date = new DateTime(random_year, random_month, 1);
118 foreach (List<Cell> row in this.simulation.map.cells)
119 {
120 foreach (Cell cell in row)
121 {
122 if (this.random_generator.NextDouble() > 0.75)
123 {
124 int random_year = (int)MathHelper.Clamp((float)MathUtils.NextNormal(random_generator, 2010.0f, 40.0f), 1800, Simulation.START_YEAR);
125 int random_month = random_generator.Next(1, 12);
126 DateTime random_date = new DateTime(random_year, random_month, 1);
129 127
130 cell.addTree(random_date);
131 }
132 }
133 }
128 cell.addTree(random_date);
129 }
130 }
131 }
134 132
135 showInitial = true;
136 messageIndex = 0;
137 showBudget = false;
138 showForest = true;
139 showGrid = true;
133 showInitial = true;
134 messageIndex = 0;
135 showBudget = false;
136 showForest = true;
137 showGrid = true;
140 138
141 this.Window.Title = "Isometric Park";
139 this.Window.Title = "Isometric Park";
142 140
143 Content.RootDirectory = "Content";
141 Content.RootDirectory = "Content";
144 142
145 currentNode = DialogTrees.introTree;
143 currentNode = DialogTrees.introTree;
146 144
147 }
145 }
148 146
149 protected override void Initialize()
150 {
151 /* This is a nice place to start up the engine, after
152 * loading configuration stuff in the constructor
153 */
154 this.IsMouseVisible = true;
155
156 _imGuiRenderer = new ImGuiRenderer(this);
157 _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering
158
159 base.Initialize();
160 }
147 protected override void Initialize()
148 {
149 /* This is a nice place to start up the engine, after
150 * loading configuration stuff in the constructor
151 */
152 this.IsMouseVisible = true;
153
154 _imGuiRenderer = new ImGuiRenderer(this);
155 _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering
161 156
162 protected override void LoadContent()
163 {
164 // Create the batch...
165 batch = new SpriteBatch(GraphicsDevice);
157 base.Initialize();
158 }
166 159
167 sound = Content.Load<SoundEffect>("FNASound");
168 Tile.TileSetTexture = Content.Load<Texture2D>(@"part4_tileset");
160 protected override void LoadContent()
161 {
162 // Create the batch...
163 batch = new SpriteBatch(GraphicsDevice);
169 164
170 Line.initialize(GraphicsDevice);
165 sound = Content.Load<SoundEffect>("FNASound");
166 Tile.TileSetTexture = Content.Load<Texture2D>(@"part4_tileset");
167
168 Line.initialize(GraphicsDevice);
171 169
172
173 var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
174 15,
175 1024,
176 1024,
177 new[]
178 {
179 CharacterRange.BasicLatin,
180 CharacterRange.Latin1Supplement,
181 CharacterRange.LatinExtendedA,
182 CharacterRange.Cyrillic,
183 CharacterRange.LatinExtendedB,
184 new CharacterRange((char) 0x00B7)
185 }
186 );
170
171 var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
172 15,
173 1024,
174 1024,
175 new[]
176 {
177 CharacterRange.BasicLatin,
178 CharacterRange.Latin1Supplement,
179 CharacterRange.LatinExtendedA,
180 CharacterRange.Cyrillic,
181 CharacterRange.LatinExtendedB,
182 new CharacterRange((char) 0x00B7)
183 }
184 );
187 185
188 this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice);
186 this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice);
189 187
190 var json2 = new FileInfo(@"Content/grammar.json");
188 var json2 = new FileInfo(@"Content/grammar.json");
191 189
192 this.grammar = new TraceryNet.Grammar(json2);
190 this.grammar = new TraceryNet.Grammar(json2);
193 191
194 this.output = grammar.Flatten("#greeting#");
195 var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#");
192 this.output = grammar.Flatten("#greeting#");
193 var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#");
196 194
197 this.remainingDialog = new Queue<Node<DialogOption>>();
195 this.remainingDialog = new Queue<Node<DialogOption>>();
196
197 this.remainingDialog.Enqueue(DialogTrees.flatten(DialogTrees.testTree, this.grammar));
198 198
199 this.remainingDialog.Enqueue(DialogTrees.flatten(DialogTrees.testTree, this.grammar));
200
201 //font = fontBakeResult.CreateSpriteFont(GraphicsDevice);
202 monoFont = bakedMono.CreateSpriteFont(GraphicsDevice);
199 //font = fontBakeResult.CreateSpriteFont(GraphicsDevice);
200 monoFont = bakedMono.CreateSpriteFont(GraphicsDevice);
203 201
204 this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0);
202 this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0);
205 203
206 204
207 }
205 }
208 206
209 protected override void UnloadContent()
210 {
211 batch.Dispose();
212 sound.Dispose();
213 Tile.TileSetTexture.Dispose();
214 }
207 protected override void UnloadContent()
208 {
209 batch.Dispose();
210 sound.Dispose();
211 Tile.TileSetTexture.Dispose();
212 }
215 213
216 Vector2 calculateMousegrid(Vector2 normalizedMousePos)
217 {
214 Vector2 calculateMousegrid(Vector2 normalizedMousePos)
215 {
218 216
219 //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth);
220 //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight);
221 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight);
222 Vector2 adjustedMousePos = normalizedMousePos - adjust;
217 //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth);
218 //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight);
219 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight);
220 Vector2 adjustedMousePos = normalizedMousePos - adjust;
223 221
224 float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight));
225 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
222 float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight));
223 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
226 224
227 225
228 return new Vector2((int)boardx, (int)boardy);
229 /*
230 int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ;
231 int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY));
226 return new Vector2((int)boardx, (int)boardy);
227 /*
228 int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ;
229 int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY));
232 230
233 231
234 232
235 233
236 int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2);
237 int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2);
234 int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2);
235 int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2);
238 236
239 int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx);
240 Vector2 adjustment_vector;
237 int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx);
238 Vector2 adjustment_vector;
241 239
242 return new Vector2(gridx, gridy);
243 if (middle_distance < (Tile.TileWidth / 2))
244 {
245 return new Vector2(gridx, gridy);
246 }
240 return new Vector2(gridx, gridy);
241 if (middle_distance < (Tile.TileWidth / 2))
242 {
243 return new Vector2(gridx, gridy);
244 }
247 245
248 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1))
249 {
250 adjustment_vector = new Vector2(-1, -1);
251 return new Vector2(gridx, gridy) + adjustment_vector;
252 }
253 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1))
254 {
255 adjustment_vector = new Vector2(-1, 1);
256 return new Vector2(gridx, gridy) + adjustment_vector;
257 }
258 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1))
259 {
260 adjustment_vector = new Vector2(0, -1);
261 return new Vector2(gridx, gridy) + adjustment_vector;
262 }
263 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1))
264 {
265 adjustment_vector = new Vector2(0, 1);
266 return new Vector2(gridx, gridy) + adjustment_vector;
267 }
268 else {
269 return new Vector2(gridx, gridy);
270 }
271 */
246 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1))
247 {
248 adjustment_vector = new Vector2(-1, -1);
249 return new Vector2(gridx, gridy) + adjustment_vector;
250 }
251 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1))
252 {
253 adjustment_vector = new Vector2(-1, 1);
254 return new Vector2(gridx, gridy) + adjustment_vector;
255 }
256 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1))
257 {
258 adjustment_vector = new Vector2(0, -1);
259 return new Vector2(gridx, gridy) + adjustment_vector;
260 }
261 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1))
262 {
263 adjustment_vector = new Vector2(0, 1);
264 return new Vector2(gridx, gridy) + adjustment_vector;
265 }
266 else {
267 return new Vector2(gridx, gridy);
268 }
269 */
272 270
273 271
274 272
275 }
273 }
276 274
277 275
278 276
279 protected override void Update(GameTime gameTime)
280 {
277 protected override void Update(GameTime gameTime)
278 {
281 279
282 Stopwatch stopWatch = new Stopwatch();
283 stopWatch.Start();
280 Stopwatch stopWatch = new Stopwatch();
281 stopWatch.Start();
284 282
285 float volume = 1.0f;
286 float pitch = 0.0f;
287 float pan = 0.0f;
283 float volume = 1.0f;
284 float pitch = 0.0f;
285 float pan = 0.0f;
288 286
289 287
290 // Run game logic in here. Do NOT render anything here!
291 KeyboardState keyboardCur = Keyboard.GetState();
292
293 #region input
294 #region camera_movement_keys
288 // Run game logic in here. Do NOT render anything here!
289 KeyboardState keyboardCur = Keyboard.GetState();
290
291 #region input
292 #region camera_movement_keys
295 293 if (keyboardCur.IsKeyDown(Keys.Down))
296 {
297 this.camera.Move(new Vector2(0, 2));
298 }
299 else if (keyboardCur.IsKeyDown(Keys.Up))
300 {
301 this.camera.Move(new Vector2(0, -2));
294 {
295 this.camera.Move(new Vector2(0, 2));
296 }
297 else if (keyboardCur.IsKeyDown(Keys.Up))
298 {
299 this.camera.Move(new Vector2(0, -2));
302 300
303 }
304 else if (keyboardCur.IsKeyDown(Keys.Left))
305 {
306 this.camera.Move(new Vector2(-2, 0));
301 }
302 else if (keyboardCur.IsKeyDown(Keys.Left))
303 {
304 this.camera.Move(new Vector2(-2, 0));
307 305
308 }
309 else if (keyboardCur.IsKeyDown(Keys.Right))
310 {
311 this.camera.Move(new Vector2(2, 0));
306 }
307 else if (keyboardCur.IsKeyDown(Keys.Right))
308 {
309 this.camera.Move(new Vector2(2, 0));
312 310
313 }
314 else if (keyboardCur.IsKeyDown(Keys.Subtract) && keyboardPrev.IsKeyUp(Keys.Subtract))
315 {
316 this.camera.ZoomOut();
317 }
318 else if (keyboardCur.IsKeyDown(Keys.Add) && keyboardPrev.IsKeyUp(Keys.Add))
319 {
311 }
312 else if (keyboardCur.IsKeyDown(Keys.Subtract) && keyboardPrev.IsKeyUp(Keys.Subtract))
313 {
314 this.camera.ZoomOut();
315 }
316 else if (keyboardCur.IsKeyDown(Keys.Add) && keyboardPrev.IsKeyUp(Keys.Add))
317 {
320 318
321 this.camera.ZoomIn();
322 }
323 #endregion camera_movement_keys
319 this.camera.ZoomIn();
320 }
321 #endregion camera_movement_keys
324 322
325 #region misc_keys
326 if (keyboardCur.IsKeyDown(Keys.Q) && keyboardPrev.IsKeyUp(Keys.Q))
327 {
328 System.Console.WriteLine("Quitting");
329 Environment.Exit(0);
330 }
331 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash))
323 #region misc_keys
324 if (keyboardCur.IsKeyDown(Keys.Q) && keyboardPrev.IsKeyUp(Keys.Q))
325 {
326 System.Console.WriteLine("Quitting");
327 Environment.Exit(0);
328 }
329 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash))
332 330 {
333 this.show_another_window = !this.show_another_window;
331 this.show_another_window = !this.show_another_window;
334 332
335 }
333 }
336 334
337 if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G))
338 {
339 this.showGrid = !this.showGrid;
335 if (keyboardCur.IsKeyDown(Keys.G) && keyboardPrev.IsKeyUp(Keys.G))
336 {
337 this.showGrid = !this.showGrid;
340 338
341 }
342 if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B))
343 {
344 this.showBudget = !this.showBudget;
339 }
340 if (keyboardCur.IsKeyDown(Keys.B) && keyboardPrev.IsKeyUp(Keys.B))
341 {
342 this.showBudget = !this.showBudget;
345 343
346 }
347 if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F))
348 {
349 this.showForest = !this.showForest;
344 }
345 if (keyboardCur.IsKeyDown(Keys.F) && keyboardPrev.IsKeyUp(Keys.F))
346 {
347 this.showForest = !this.showForest;
350 348
351 }
352 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
353 {
354 this.camera.Jump(Vector2.Zero);
349 }
350 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
351 {
352 this.camera.Jump(Vector2.Zero);
355 353
356 }
357 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash) && keyboardCur.IsKeyDown(Keys.LeftShift))
358 {
359 sound.Play(volume, pitch, pan);
360 }
361 #endregion misc_keys
354 }
355 if (keyboardCur.IsKeyDown(Keys.OemBackslash) && keyboardPrev.IsKeyUp(Keys.OemBackslash) && keyboardCur.IsKeyDown(Keys.LeftShift))
356 {
357 sound.Play(volume, pitch, pan);
358 }
359 #endregion misc_keys
362 360
363 361
364 #region gamerate_keys
365 if (keyboardCur.IsKeyDown(Keys.D0) && keyboardPrev.IsKeyUp(Keys.D0) )
366 {
367 this.simulation.paused = !this.simulation.paused;
362 #region gamerate_keys
363 if (keyboardCur.IsKeyDown(Keys.D0) && keyboardPrev.IsKeyUp(Keys.D0) )
364 {
365 this.simulation.paused = !this.simulation.paused;
368 366
369 }
370 #endregion gamerate_keys
367 }
368 #endregion gamerate_keys
371 369
372
370
373 371
374 372
375 //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P))
376 // {
377 // this.player_state = !this.player_state;
378 // }
373 //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P))
374 // {
375 // this.player_state = !this.player_state;
376 // }
379 377
380 //if (player_state )
381 //{
382 // MediaPlayer.Play(music);
383 //}
378 //if (player_state )
379 //{
380 // MediaPlayer.Play(music);
381 //}
384 382
385 383
386 MouseState mouseCur = Mouse.GetState();
387 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
384 MouseState mouseCur = Mouse.GetState();
385 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
388 386
389 if (MathUtils.Between(mouseCur.X, 0, 50))
390 {
391 this.camera.Move(new Vector2(-4, 0));
392 }
393 else if (MathUtils.Between(mouseCur.X, (FNAGame.width - 50), FNAGame.width))
394 {
395 this.camera.Move(new Vector2(4, 0));
396 }
387 if (MathUtils.Between(mouseCur.X, 0, 50))
388 {
389 this.camera.Move(new Vector2(-4, 0));
390 }
391 else if (MathUtils.Between(mouseCur.X, (FNAGame.width - 50), FNAGame.width))
392 {
393 this.camera.Move(new Vector2(4, 0));
394 }
397 395
398 if (MathUtils.Between(mouseCur.Y, 0, 50))
399 {
400 this.camera.Move(new Vector2(0, -4));
401 }
402 else if (MathUtils.Between(mouseCur.Y, (FNAGame.height - 50), FNAGame.height))
403 {
404 this.camera.Move(new Vector2(0, 4));
405 }
396 if (MathUtils.Between(mouseCur.Y, 0, 50))
397 {
398 this.camera.Move(new Vector2(0, -4));
399 }
400 else if (MathUtils.Between(mouseCur.Y, (FNAGame.height - 50), FNAGame.height))
401 {
402 this.camera.Move(new Vector2(0, 4));
403 }
406 404
407 if (mouseCur.RightButton == ButtonState.Pressed)
405 if (mouseCur.RightButton == ButtonState.Pressed)
408 406 {
409 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
410 Vector2 delta = this.camera.position - this.original_point;
411 this.camera.Jump(this.original_point);
407 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
408 Vector2 delta = this.camera.position - this.original_point;
409 this.camera.Jump(this.original_point);
410 }
411
412 #endregion input
413
414
415
416 this.simulation.update(gameTime.ElapsedGameTime);
417
418 if (this.showBudget)
419 {
420 this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget);
412 421 }
413 422
414 #endregion input
415
416
417
418 this.simulation.update(gameTime.ElapsedGameTime);
419 423
420 if (this.showBudget)
421 {
422 this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget);
423 }
424 if (!this.showInitial && this.remainingDialog.Count > 0)
425 {
426 this.currentNode = this.remainingDialog.Dequeue();
427 this.showInitial = true;
428 }
424 429
430 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
425 431
426 if (!this.showInitial && this.remainingDialog.Count > 0)
427 {
428 this.currentNode = this.remainingDialog.Dequeue();
429 this.showInitial = true;
430 }
431
432 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
432 //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX);
433 /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */
434 //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2));
435 /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */
433 436
434 //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX);
435 /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */
436 //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2));
437 /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */
437 //this.mouseGrid = new Vector2(gridx, gridy);
438 this.mouseGrid = this.calculateMousegrid(this.original_point);
438 439
439 //this.mouseGrid = new Vector2(gridx, gridy);
440 this.mouseGrid = this.calculateMousegrid(this.original_point);
441
442 elapsedTime += gameTime.ElapsedGameTime;
440 elapsedTime += gameTime.ElapsedGameTime;
443 441
444 if (elapsedTime > TimeSpan.FromSeconds(1))
445 {
446 elapsedTime -= TimeSpan.FromSeconds(1);
447 frameRate = frameCounter;
448 frameCounter = 0;
449 }
442 if (elapsedTime > TimeSpan.FromSeconds(1))
443 {
444 elapsedTime -= TimeSpan.FromSeconds(1);
445 frameRate = frameCounter;
446 frameCounter = 0;
447 }
450 448
451 this.keyboardPrev = keyboardCur;
449 this.keyboardPrev = keyboardCur;
452 450
453 stopWatch.Stop();
454 this.updateTime = stopWatch.Elapsed;
451 stopWatch.Stop();
452 this.updateTime = stopWatch.Elapsed;
455 453
456 base.Update(gameTime);
454 base.Update(gameTime);
457 455
458 }
456 }
459 457
460 protected float calculateDepth() {
461 return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
462 }
458 protected float calculateDepth() {
459 return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
460 }
463 461
464 protected Boolean cull(int gridX, int gridY)
465 {
466 int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2;
467 int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2;
462 protected Boolean cull(int gridX, int gridY)
463 {
464 int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2;
465 int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2;
468 466
469 Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice));
467 Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice));
470 468
471 return (!FNAGame.enableCulling ||
472 (MathUtils.Between(original.X, -Tile.TileSpriteWidth, FNAGame.width)
473 && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height)));
474 }
469 return (!FNAGame.enableCulling ||
470 (MathUtils.Between(original.X, -Tile.TileSpriteWidth, FNAGame.width)
471 && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height)));
472 }
475 473
476 474 //Convenience method I'm not super sure about anymore.
477 475 protected void drawTileAt(int x, int y, int tileIndex, int height)
478 {
479 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
476 {
477 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
480 478
481 float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth);
479 float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth);
482 480
483 Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset);
484 }
481 Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset);
482 }
485 483
486 484
487 485
488 protected override void Draw(GameTime gameTime)
486 protected override void Draw(GameTime gameTime)
489 487 {
490 488 // Render stuff in here. Do NOT run game logic in here!
491 489
@@ -497,52 +495,52
497 495 stopWatch.Start();
498 496 GraphicsDevice.Clear(Color.CornflowerBlue);
499 497 batch.Begin(SpriteSortMode.BackToFront,
500 BlendState.AlphaBlend,
501 null,
502 null,
503 null,
504 null,
505 camera.get_transformation(GraphicsDevice));
498 BlendState.AlphaBlend,
499 null,
500 null,
501 null,
502 null,
503 camera.get_transformation(GraphicsDevice));
506 504
507 505 //New tile stuff
508 506 /*
509 Vector2 firstSquare = Vector2.Zero;
510 int firstX = (int)firstSquare.X;
511 int firstY = (int)firstSquare.Y;
507 Vector2 firstSquare = Vector2.Zero;
508 int firstX = (int)firstSquare.X;
509 int firstY = (int)firstSquare.Y;
512 510
513 Vector2 squareOffset = Vector2.Zero;
511 Vector2 squareOffset = Vector2.Zero;
514 512
515 int offsetX = (int)squareOffset.X;
516 int offsetY = (int)squareOffset.Y;
513 int offsetX = (int)squareOffset.X;
514 int offsetY = (int)squareOffset.Y;
517 515
518 516
519 for (int y = 0; y < this.squaresDown; y++)
517 for (int y = 0; y < this.squaresDown; y++)
520 518 {
521 int rowOffset = 0;
522 if ((firstY + y) % 2 == 1)
523 rowOffset = Tile.OddRowXOffset;
519 int rowOffset = 0;
520 if ((firstY + y) % 2 == 1)
521 rowOffset = Tile.OddRowXOffset;
524 522
525 for (int x = 0; x < this.squaresAcross; x++) {
523 for (int x = 0; x < this.squaresAcross; x++) {
526 524
527 525
528 batch.Draw(
529 Tile.TileSetTexture,
526 batch.Draw(
527 Tile.TileSetTexture,
530 528 new Rectangle(
531 ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX),
532 ((y * Tile.TileStepY) - offsetY + baseOffsetY),
533 Tile.TileWidth, Tile.TileHeight),
534 Tile.GetSourceRectangle(1),
535 Color.White,
536 0.0f,
537 Vector2.Zero,
538 SpriteEffects.None,
539 0.9f);
529 ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX),
530 ((y * Tile.TileStepY) - offsetY + baseOffsetY),
531 Tile.TileWidth, Tile.TileHeight),
532 Tile.GetSourceRectangle(1),
533 Color.White,
534 0.0f,
535 Vector2.Zero,
536 SpriteEffects.None,
537 0.9f);
540 538
541
539
542 540 }
543 541 }*/
544 542
545 #region draw_tiles
543 #region draw_tiles
546 544 //reset
547 545 this.tilesDrawn = 0;
548 546
@@ -559,25 +557,25
559 557 if (this.cull(x, y))
560 558 {
561 559 batch.Draw(
562 Tile.TileSetTexture,
563 new Rectangle(
560 Tile.TileSetTexture,
561 new Rectangle(
564 562 screenx,
565 563 screeny,
566 564 Tile.TileWidth, Tile.TileHeight),
567 Tile.GetSourceRectangle(1),
568 Color.White,
569 0.0f,
570 Vector2.Zero,
571 SpriteEffects.None,
572 0.9f);
565 Tile.GetSourceRectangle(1),
566 Color.White,
567 0.0f,
568 Vector2.Zero,
569 SpriteEffects.None,
570 0.9f);
573 571
574 572 this.tilesDrawn++;
575 573 }
576 574 }
577 575 }
578 #endregion draw_tiles
576 #endregion draw_tiles
579 577
580 #region draw_gridlines
578 #region draw_gridlines
581 579
582 580 if (this.showGrid)
583 581 {
@@ -588,10 +586,13
588 586 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved
589 587
590 588 Line.drawLine(batch,
591 new Vector2(((0 - y) * Tile.TileSpriteWidth / 2), (0 + y) * Tile.TileSpriteHeight / 2) + adjust,
592 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
593 new Vector2((this.squaresAcross - (y)) * Tile.TileSpriteWidth / 2, (this.squaresAcross + (y)) * Tile.TileSpriteHeight / 2) + adjust,
594 Color.White, 0.8f);
589 new Vector2(((0 - y) * Tile.TileSpriteWidth / 2),
590 (0 + y) * Tile.TileSpriteHeight / 2) + adjust,
591 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
592 new Vector2((this.squaresAcross - (y)) * Tile.TileSpriteWidth / 2,
593 (this.squaresAcross + (y)) * Tile.TileSpriteHeight / 2) + adjust,
594
595 Color.White, 0.8f);
595 596
596 597 }
597 598
@@ -601,112 +602,112
601 602 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved
602 603
603 604 Line.drawLine(batch,
604 new Vector2(((x - 0) * Tile.TileSpriteWidth / 2), (x + 0) * Tile.TileSpriteHeight / 2) + adjust,
605 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
606 new Vector2((x - this.squaresDown) * Tile.TileSpriteWidth / 2, (x + this.squaresDown) * Tile.TileSpriteHeight / 2) + adjust,
607 Color.White, 0.8f);
605 new Vector2(((x - 0) * Tile.TileSpriteWidth / 2), (x + 0) * Tile.TileSpriteHeight / 2) + adjust,
606 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
607 new Vector2((x - this.squaresDown) * Tile.TileSpriteWidth / 2, (x + this.squaresDown) * Tile.TileSpriteHeight / 2) + adjust,
608 Color.White, 0.8f);
608 609
609 610 }
610 611 }
611 #endregion draw_gridlines
612 #endregion draw_gridlines
612 613
613 614
614 //Gridlines
615 //Lines going down and to the right:
616 /*
617 for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++)
618 {
619 int rowOffset = 0;
615 //Gridlines
616 //Lines going down and to the right:
617 /*
618 for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++)
619 {
620 int rowOffset = 0;
620 621
621 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
622 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
622 623
623 Vector2 start = new Vector2(startX, -baseOffsetY+4);
624 Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2,
625 this.squaresDown*Tile.TileStepY- baseOffsetY+4);
624 Vector2 start = new Vector2(startX, -baseOffsetY+4);
625 Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2,
626 this.squaresDown*Tile.TileStepY- baseOffsetY+4);
626 627
627 628
628 629
629 Line.drawLine(batch,
630 Line.departurePoint(stop, start, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
631 Line.departurePoint(start, stop, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
632 Color.White, 0.8f);
630 Line.drawLine(batch,
631 Line.departurePoint(stop, start, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
632 Line.departurePoint(start, stop, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
633 Color.White, 0.8f);
633 634
634 }
635 //Lines going down and to the left:
636 for (int x = 0; x < (int)(1.5*this.squaresAcross); x++)
637 {
635 }
636 //Lines going down and to the left:
637 for (int x = 0; x < (int)(1.5*this.squaresAcross); x++)
638 {
638 639
639 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
640 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
640 641
641 Vector2 start_reverse = new Vector2(startX, -baseOffsetY + 4);
642 Vector2 stop_reverse = new Vector2(startX + -(this.squaresAcross * Tile.TileStepX / 2),
643 (this.squaresDown * Tile.TileStepY) - baseOffsetY + 4);
642 Vector2 start_reverse = new Vector2(startX, -baseOffsetY + 4);
643 Vector2 stop_reverse = new Vector2(startX + -(this.squaresAcross * Tile.TileStepX / 2),
644 (this.squaresDown * Tile.TileStepY) - baseOffsetY + 4);
644 645
645 Line.drawLine(batch,
646 Line.departurePoint(stop_reverse, start_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
647 Line.departurePoint(start_reverse, stop_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
648 Color.White, 0.8f);
646 Line.drawLine(batch,
647 Line.departurePoint(stop_reverse, start_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
648 Line.departurePoint(start_reverse, stop_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight),
649 Color.White, 0.8f);
649 650
650 }
651 */
651 }
652 */
652 653
653 #if DEBUG
654 #if DEBUG
654 655 drawTileAt(4, 4, 140, 3);
655 656 drawTileAt(6, 4, 141, 3);
656 657 drawTileAt(8, 4, 142, 2);
657 658 drawTileAt(10, 4, 142, 3);
658 #endif
659 #endif
659 660
660 #region draw_cursor
661 //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines
661 #region draw_cursor
662 //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines
662 663
663 //TODO figure out why it has to be -1
664 //TODO figure out why it has to be -1
664 665 if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth)
665 && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
666 && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
666 667 {
667 Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1);
668 }
668 Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1);
669 }
669 670
670 671 #if DEBUG
671 Tile.OutlineSquare(batch, 1, 1, Color.Red, 2);
672 Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2);
673 Tile.OutlineSquare(batch, 5, 1, Color.Green, 2);
674 Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2);
672 Tile.OutlineSquare(batch, 1, 1, Color.Red, 2);
673 Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2);
674 Tile.OutlineSquare(batch, 5, 1, Color.Green, 2);
675 Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2);
675 676 #endif
676 677
677 678
678 679
679 680 #endregion draw_cursor
680 /*
681 /*
681 682
682 for (int i = 0; i< 80; i++)
683 for (int i = 0; i< 80; i++)
683 684 {
684 for (int j = 0; j < 50; j += 1)
685 {
686 //Warning: creates a flashing effect because tree positions update every 1/60th of a second
685 for (int j = 0; j < 50; j += 1)
686 {
687 //Warning: creates a flashing effect because tree positions update every 1/60th of a second
687 688
688 if (this.random_generator.NextDouble() > 0.75)
689 if (this.random_generator.NextDouble() > 0.75)
689 690 {
690 drawTileAt(i, j, 142, 2);
691 }
691 drawTileAt(i, j, 142, 2);
692 }
692 693
693 if ((i + j) % 3 == 0)
694 {
695 drawTileAt(i, j, 142, 2);
696 }
694 if ((i + j) % 3 == 0)
695 {
696 drawTileAt(i, j, 142, 2);
697 }
697 698
698 }
699 }//*/
699 }
700 }//*/
700 701
701 702 #region draw_trees
702 for (int i = 0; i < this.simulation.map.MapHeight; i++)
703 for (int i = 0; i < this.simulation.map.MapHeight; i++)
703 704 {
704 705 for (int j = 0; j < this.simulation.map.MapWidth; j += 1)
705 706 {
706 707
707 708 if (this.simulation.map.cells[i][j].hasTree)
708 709 { //until we actually simulate:
709 drawTileAt(i, j, 142, 2);
710 drawTileAt(i, j, 142, 2);
710 711 // if ((i + j) % 8 == 0)
711 712 // {
712 713 // drawTileAt(i, j, 141, 2);
@@ -716,11 +717,11
716 717 // drawTileAt(i, j, 142, 2);
717 718 // }
718 719 }
719 else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) {
720 drawTileAt(i, j, 141, 2);
721 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
720 else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) {
721 drawTileAt(i, j, 141, 2);
722 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
722 723
723 }
724 }
724 725 }
725 726 }
726 727 #endregion draw_trees
@@ -733,11 +734,11
733 734
734 735 #region draw_header
735 736 batch.Begin(SpriteSortMode.BackToFront,
736 BlendState.AlphaBlend,
737 null,
738 null,
739 null,
740 null);
737 BlendState.AlphaBlend,
738 null,
739 null,
740 null,
741 null);
741 742
742 743 bool has_tree = false;
743 744 if (MathUtils.Between(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.Between(this.mouseGrid.Y, 0, this.squaresAcross))
@@ -766,22 +767,22
766 767 batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
767 768 batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
768 769 batch.DrawString(monoFont, header_right, new Vector2(right_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
769 #endregion draw_header
770 #endregion draw_header
770 771
771 772
772 #region budget
773 #region budget
773 774
774 if (this.showBudget)
775 {
776 budgetWindow.draw(batch);
775 if (this.showBudget)
776 {
777 budgetWindow.draw(batch);
777 778
778 }
779 }
779 780
780 #endregion budget
781 #endregion budget
781 782
782 batch.End();
783 batch.End();
783 784
784
785
785 786
786 787
787 788 #region debug_window
@@ -793,12 +794,11
793 794 }
794 795
795 796 DebugInfo debugInfo = new DebugInfo
796 {
797 fps = this.frameRate,
797 { fps = this.frameRate,
798 798 pastFps = past_fps.ToArray(),
799 799 cameraPosition = camera.position,
800 800 drawTime = this.drawTime,
801 updateTime = this.updateTime,
801 updateTime = this.updateTime,
802 802 treeCount = this.simulation.map.tree_count,
803 803 mouseGrid = this.mouseGrid,
804 804 hasTree = has_tree,
@@ -810,37 +810,37
810 810
811 811 var additionalInfo = new Dictionary<string, string>();
812 812
813 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
814 var state = Mouse.GetState();
815 Vector2 delta = this.camera.position - this.original_point;
813 Vector2 cameraMiddle = this.camera.position + new Vector2(FNAGame.width / 2, FNAGame.height / 2);
814 var state = Mouse.GetState();
815 Vector2 delta = this.camera.position - this.original_point;
816 816
817 additionalInfo.Add("cameraMiddle", cameraMiddle.ToString());
818 additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y));
819 additionalInfo.Add("mouse delta", delta.ToString());
817 additionalInfo.Add("cameraMiddle", cameraMiddle.ToString());
818 additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y));
819 additionalInfo.Add("mouse delta", delta.ToString());
820 820
821 additionalInfo.Add("Tracery Test", this.output);
821 additionalInfo.Add("Tracery Test", this.output);
822 822
823 debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window);
823 debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window);
824 824
825 825
826 //debugWindow.ImGuiLayout();
827 //String[] messages = { "Message1", "Message2" };
826 //debugWindow.ImGuiLayout();
827 //String[] messages = { "Message1", "Message2" };
828 828
829 //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" },
830 // 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?" },
831 // new DialogOption{ response="Oh yeah, of course.", choice="..." }};
829 //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" },
830 // 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?" },
831 // new DialogOption{ response="Oh yeah, of course.", choice="..." }};
832 832
833 833
834 if (this.currentNode != null)
834 if (this.currentNode != null)
835 835 {
836 836 this.currentNode = DialogInterface.RenderDialog(ref this.showInitial,
837 ref this.simulation.paused, debugWindow.monoFont, this.currentNode);
837 ref this.simulation.paused, debugWindow.monoFont, this.currentNode);
838 838 }
839 839
840 if (this.showForest)
841 {
840 if (this.showForest)
841 {
842 842 ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation);
843 }
843 }
844 844
845 845
846 846 _imGuiRenderer.AfterLayout();
@@ -853,5 +853,5
853 853
854 854 base.Draw(gameTime);
855 855 }
856
856
857 857 }
You need to be logged in to leave comments. Login now