Show More
Commit Description:
Add details about architecture.
Commit Description:
Add details about architecture.
Show/Diff file:
Action:
isometric-park-fna/FNAGame.cs
1040 lines | 40.2 KiB | text/x-csharp | CSharpLexer
Add version using AssemblyVersion.
r301 using Microsoft.Xna.Framework;
Add parameter to Line for width.
r1 using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;
using System;
using System.IO;
Add version using AssemblyVersion.
r301 using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
Add parameter to Line for width.
r1 using SpriteFontPlus;
Refactor dialog into separate Engine....
r405
Add parameter to Line for width.
r1 using isometricparkfna;
Rename TileMap to CellMap.
r66 using static isometricparkfna.CellMap;
Add dialogue, yeah!
r32 using isometricparkfna.Utils;
Finish moving UI.
r70 using isometricparkfna.UI;
Start decoupling input....
r170 using isometricparkfna.Engines;
Incomplete version of BudgetWindow handling in Encompass....
r174 using isometricparkfna.Components;
Add first working renderer! ?
r189 using isometricparkfna.Renderers;
Add spawner.
r193 using isometricparkfna.Messages;
using isometricparkfna.Spawners;
Add main menu.
r298 using Num = System.Numerics;
Downgrade to slightly earlier .NET to fix macOS issue.
r30
Add ImGui.
r16 using ImGuiNET.SampleProgram.XNA;
Add start of dialog.
r18 using ImGuiNET;
Include implot.
r505 using ImPlotNET;
Add procgen dialog.
r44 using TraceryNet;
Initial version of encompass addition (not fully working)....
r169 using Encompass;
Refactor dialog into separate Engine....
r405 using Ink.Runtime;
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Add version using AssemblyVersion.
r301 //Let's let core builds be deterministic
#if NETCOREAPP
Fix position of start menu.
r491 [assembly:AssemblyVersion("0.36.31.0")]
Add version using AssemblyVersion.
r301 #else
Fix position of start menu.
r491 [assembly:AssemblyVersion("0.36.31.*")]
Add version using AssemblyVersion.
r301 #endif
Add parameter to Line for width.
r1 class FNAGame : Game
{
Fix messy indentation.
r101 private KeyboardState keyboardPrev = new KeyboardState();
Fix right click to jump....
r295 private MouseState mousePrev = new MouseState();
Add parameter to Line for width.
r1
Fix messy indentation.
r101 private SpriteBatch batch;
Temporary fix for overlap issue.
r527 private SpriteBatch tileBatch;
Limit sound to Debug builds for now.
r470 #if DEBUG
Fix messy indentation.
r101 private SoundEffect sound;
Limit sound to Debug builds for now.
r470 #endif
Fix messy indentation.
r101 private SpriteFont monoFont;
Rudimentary game state.
r297 private SpriteFont largeMonoFont;
Add parameter to Line for width.
r1
Add timers.
r514 private Camera camera = new Camera(new float[] {0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix messy indentation.
r101 Random random_generator = new Random();
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix messy indentation.
r101 int frameRate = 0;
int frameCounter = 0;
TimeSpan elapsedTime = TimeSpan.Zero;
TimeSpan drawTime = TimeSpan.Zero;
Add timers.
r514 TimeSpan tileDrawTime = TimeSpan.Zero;
TimeSpan gridDrawTime = TimeSpan.Zero;
TimeSpan treeDrawTime = TimeSpan.Zero;
Fix messy indentation.
r101 TimeSpan updateTime = TimeSpan.Zero;
Misc foundational changes: UpdateTime and gdm fields.
r49
Fix messy indentation.
r101 Queue<float> past_fps = new Queue<float>(100);
Show percentile timings and fps.
r518 Queue<TimeSpan> past_draw = new Queue<TimeSpan>(100);
Fix messy indentation.
r101 int tilesDrawn = 0;
Add parameter to Line for width.
r1
Add resolution setting.
r307 private static int width = 1280;
private static int height = 640;
Add parameter to Line for width.
r1
Fix messy indentation.
r101 //new tile stuff
Add timers.
r514 int squaresAcross = 200;
int squaresDown = 200;
Fix style and identation.
r348
Fix messy indentation.
r101 Simulation simulation;
Add basic TileMap.
r9
Add missing files, oops.
r192 public Vector2 mouseGrid;
Fix messy indentation.
r101 Vector2 original_point;
Add missing files, oops.
r192 //for now
public bool in_zone;
Rudimentary game state.
r297 public bool in_active_zone;
Display preserve on status bar.
r541 public bool in_preserve;
Rudimentary game state.
r297
public bool isPlaying = false;
Add missing files, oops.
r192
Fix messy indentation.
r101 private ImGuiRenderer _imGuiRenderer;
private DebugWindow debugWindow;
Downgrade to slightly earlier .NET to fix macOS issue.
r30
Add Images to widgets.
r411 public ImGuiImageMap imageMap;
Add image to dialog window (DialogInterface).
r423 public ImGuiImageMap portraitsMap;
Load test image.
r122
Start decoupling input....
r170 public bool show_another_window;
Add parameter to Line for width.
r1
Refactor dialog into separate Engine....
r405 public Story Story;
Fix messy indentation.
r101 //buggy
Remove leftovers from previous Pong project.
r20 private static bool enableCulling = false;
Add rudimentary (disabled) culling.
r19
Add support for reading in news stories from YAML.
r114 private List<NewsItem> newsItems;
Add second dialog, more for testing purposes.
r43
Add dialogue, yeah!
r32
Some refactoring....
r171 public bool showGrid;
public bool showTrees;
Add procgen dialog.
r44 private Grammar grammar;
Add Tracery and pause.
r33 private string output;
Misc foundational changes: UpdateTime and gdm fields.
r49 private GraphicsDeviceManager gdm;
Some refactoring....
r171 public bool showBudget;
Add super basic Budget UI.
r52 private BudgetWindow budgetWindow;
Visual tweaks mostly for the benefit of a screen shot.
r21
Initial version of encompass addition (not fully working)....
r169 //Encompass
private WorldBuilder WorldBuilder = new WorldBuilder();
private World World;
Rename Bridge Engine.
r186 private ImGuiWindowBridgeEngine imGuiWindowBridgeEngine;
Visual tweaks mostly for the benefit of a screen shot.
r21
Use Game.Exit()....
r463 public bool quit = false;
Refactor dialog into separate Engine....
r405
Add rudimentary (disabled) culling.
r19 private static void Main(string[] args)
Fix messy indentation.
r101 {
Fix style.
r462 #if NETCOREAPP
Fix messy indentation.
r101 DllMap.Initialise(false);
Fix style.
r462 #endif
Add generic error handler.
r400 try {
using FNAGame g = new FNAGame();
g.Run();
}
catch (Exception e)
{
Logging.Critical(string.Format("Unhandled exception: {0}", e));
return;
}
Add file-based logging.
r280
Fix style.
r462 #if !DEBUG
Add file-based logging.
r280 Logging.logFile.Close();
File.Delete(Logging.logFileName);
Fix style.
r462 #endif
Fix messy indentation.
r101 }
Add parameter to Line for width.
r1
Fix messy indentation.
r101 private FNAGame()
{
Get dotnet core compilation working.
r100
Downgrade to slightly earlier .NET to fix macOS issue.
r30 #if DEBUG
Fix messy indentation.
r101 foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
Small tweaks.
r497 Logging.Debug("Loaded: " + assembly.ToString() + "\n");
Fix messy indentation.
r101 }
;
Initial version of logging....
r232
Downgrade to slightly earlier .NET to fix macOS issue.
r30 #endif
Fix messy indentation.
r101 this.gdm = new GraphicsDeviceManager(this) {
// Typically you would load a config here...
PreferredBackBufferWidth = width,
PreferredBackBufferHeight = height,
IsFullScreen = false,
SynchronizeWithVerticalRetrace = true
};
IsFixedTimeStep = false;
Add parameter to Line for width.
r1
Small tweaks.
r497 this.simulation = new Simulation(this.squaresAcross, this.squaresDown, new float[] {16.66667f*240, 16.66667f*120, 16.66667f*60, 16.66667f*30, 16.66667f*1 });
Add basic TileMap.
r9
Fix messy indentation.
r101 showBudget = false;
showGrid = true;
Add tree show/hide for debugging at least.
r152 showTrees = true;
Add start of dialog.
r18
Fix messy indentation.
r101 this.Window.Title = "Isometric Park";
Downgrade to slightly earlier .NET to fix macOS issue.
r30
Fix messy indentation.
r101 Content.RootDirectory = "Content";
}
Add parameter to Line for width.
r1
Clean up code.
r369 protected override void Initialize()
Fix messy indentation.
r101 {
/* 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
Add parameter to Line for width.
r1
Fix messy indentation.
r101 base.Initialize();
}
Add parameter to Line for width.
r1
Fix messy indentation.
r101 protected override void LoadContent()
{
// Create the batch...
Temporary fix for overlap issue.
r527 this.batch = new SpriteBatch(GraphicsDevice);
this.tileBatch = new SpriteBatch(GraphicsDevice);
Add parameter to Line for width.
r1
Limit sound to Debug builds for now.
r470 #if DEBUG
Fix messy indentation.
r101 sound = Content.Load<SoundEffect>("FNASound");
Limit sound to Debug builds for now.
r470 #endif
Add merged tileset for experimentation.
r523 // Tile.TileSetTexture = Content.Load<Texture2D>(@"part4_tileset");
Tile.TileSetTexture = Content.Load<Texture2D>(@"merged_tileset");
Add option to shade squares.
r206 var texture = Content.Load<Texture2D>(@"solid_tileset");
Fix messy indentation.
r101
Make ImageMap and ImGuiImageMap no longer static.
r412 var imageMapTexture = Content.Load<Texture2D>(@"photos_converted3");
Load metadata for imaages and display some.
r428 this.imageMap = new ImGuiImageMap(500, 400, imageMapTexture, _imGuiRenderer, null);
Fix messy indentation.
r101
Add image to dialog window (DialogInterface).
r423 var portraitMapTexture = Content.Load<Texture2D>(@"portraits");
Load metadata for imaages and display some.
r428 this.portraitsMap = new ImGuiImageMap(300, 400, portraitMapTexture, _imGuiRenderer, @"Content/portraits.yaml");
Add image to dialog window (DialogInterface).
r423
Fix messy indentation.
r101 Line.initialize(GraphicsDevice);
Add option to shade squares.
r206 Quad.Initialize(GraphicsDevice, texture);
Some tweaks to ensure it builds on framework.
r272 Logging.Success("Initialized Quad texture.");
Add image to Contact (merge in proto-image).
r248 ContractWindow.LoadContent(this._imGuiRenderer, this.imageMap);
Add image to dialog window (DialogInterface).
r423 DialogInterface.LoadContent(this._imGuiRenderer, this.portraitsMap);
Add parameter to Line for width.
r1
Add (hacky) option saving.
r350 //Must be done before SetFontMessage is sent
var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
Fix style.
r462 15,
1024,
1024,
new[]
{
CharacterRange.BasicLatin,
CharacterRange.Latin1Supplement,
CharacterRange.LatinExtendedA,
CharacterRange.Cyrillic,
CharacterRange.LatinExtendedB,
new CharacterRange((char) 0x00B7)
}
);
Add (hacky) option saving.
r350
var bakedMonoLarge = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
Fix style.
r462 30,
1024,
1024,
new[]
{
CharacterRange.BasicLatin,
CharacterRange.Latin1Supplement,
CharacterRange.LatinExtendedA,
CharacterRange.Cyrillic,
CharacterRange.LatinExtendedB,
new CharacterRange((char) 0x00B7)
}
);
Add (hacky) option saving.
r350 monoFont = bakedMono.CreateSpriteFont(GraphicsDevice);
largeMonoFont = bakedMonoLarge.CreateSpriteFont(GraphicsDevice);
Add contracts window.
r194 //Has to happen before Encompass stuff, because the Encompass machinery around ImGui requires debugWindow's monoFont to be loaded:
Add image to Contact (merge in proto-image).
r248 this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice, this.imageMap);
Add contracts window.
r194
Spawn entitties with actual names.
r231 //Has to happen before Encompass stuff, so Spawners can use the grammar:
var json2 = new FileInfo(@"Content/grammar.json");
this.grammar = new TraceryNet.Grammar(json2);
Add random park names.
r375 //Has to happen after Grammar initialization.
NewGameWindow.Initialize(this.grammar);
Incomplete version of BudgetWindow handling in Encompass....
r174
Refactor dialog into separate Engine....
r405 this.Story = new Story(File.ReadAllText(@"Content/dialog.json"));
Fix style.
r488 //Bindings have to
End game when funds run out and tweak related dialog.
r484 Story.BindExternalFunction ("endGame", () => {
Fix style.
r488 Logging.Success("endGame");
this.imGuiWindowBridgeEngine.gameStateMessages.Add(new GameStateMessage {isPlaying = false});
this.imGuiWindowBridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = isometricparkfna.Messages.Window.MainMenu});
});
Refactor dialog into separate Engine....
r405
Logging.Debug(this.Story.ContinueMaximally());
Ensure scroll areas adjust with resolution change.
r312 WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, this.camera, gdm));
Refactor dialog into separate Engine....
r405 WorldBuilder.AddEngine(new UIEngine(this.Story));
WorldBuilder.AddEngine(new DialogEngine(this.Story, this.grammar));
Add contracts window.
r194
Add EventEngine.
r408 WorldBuilder.AddEngine(new EventEngine());
Add (hacky) option saving.
r350 var gameBridgeEngine = new GameBridgeEngine(this);
WorldBuilder.AddEngine(gameBridgeEngine);
Pull out MainMenu from FNAGame.
r303 WorldBuilder.AddEngine(new GameStateEngine());
Improve generation.
r204 WorldBuilder.AddEngine(this.simulation.BridgeEngine);
Loads more porting....
r178 WorldBuilder.AddEngine(new CameraBridgeEngine(this.camera));
Actually warn about expiring contracts.
r389 this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine(this.debugWindow, debugWindow.monoFont, debugWindow.italicFont, this.simulation);
Rename Bridge Engine.
r186 WorldBuilder.AddEngine(this.imGuiWindowBridgeEngine);
Make unused contracts expire.
r218 WorldBuilder.AddEngine(new ContractStatusEngine(this.simulation));
Add contracts window.
r194
Spawn entitties with actual names.
r231 WorldBuilder.AddEngine(new ContractSpawner(simulation.map.MapWidth, simulation.map.MapHeight, this.simulation, this.grammar));
Update variables based on game settings.
r365 WorldBuilder.AddEngine(new GameSpawner(this.simulation, this, this.grammar));
Add company generation.
r254 WorldBuilder.AddEngine(new OrganizationSpawner(this.simulation, this.grammar));
Refactor dialog into separate Engine....
r405 WorldBuilder.AddEngine(new DialogSpawner(this.Story, this.grammar));
Add trespassing policy.
r359 WorldBuilder.AddEngine(new PolicyEngine());
Update variables based on game settings.
r365 WorldBuilder.AddEngine(new TraceryBridgeEngine(this.grammar));
Pause when dialog opens.
r460 WorldBuilder.AddEngine(new SimulationGameRateBridgeEngine(this.simulation));
Limit to boundaries.
r538 WorldBuilder.AddEngine(new BuildToolEngine(this.simulation.map));
Incomplete version of BudgetWindow handling in Encompass....
r174
Temporary fix for overlap issue.
r527 WorldBuilder.AddGeneralRenderer(new AreaRenderer(this.tileBatch, this.monoFont), 1);
Fix style.
r462 WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(this, this.simulation, this.imGuiWindowBridgeEngine, this.gdm), 2);
Add contracts window.
r194 var contractWindow = WorldBuilder.CreateEntity();
Add randomly generated areas.
r200 WorldBuilder.SetComponent(contractWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(contractWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Contracts });
Add contracts window.
r194
Add contracts to toolbar.
r197 var forestWindow = WorldBuilder.CreateEntity();
Add randomly generated areas.
r200 WorldBuilder.SetComponent(forestWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(forestWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Forest });
Add contracts to toolbar.
r197
var newsWindow = WorldBuilder.CreateEntity();
Add randomly generated areas.
r200 WorldBuilder.SetComponent(newsWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(newsWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.News });
Add contracts to toolbar.
r197
Pull out MainMenu from FNAGame.
r303 var mainMenu = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(mainMenu, new VisibilityComponent { visible = true });
WorldBuilder.SetComponent(mainMenu, new WindowTypeComponent { type = isometricparkfna.Messages.Window.MainMenu });
Add InGameMenu.
r305 var inputMenu = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(inputMenu, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(inputMenu, new WindowTypeComponent { type = isometricparkfna.Messages.Window.InGameMenu });
Add resolution setting.
r307 var optionsWindow = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(optionsWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(optionsWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Options });
Add NewGameWindow.
r361 var newGameWindow = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(newGameWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(newGameWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.NewGame });
Get really basic graph working.
r503 var graphWindow = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(graphWindow, new VisibilityComponent { visible = false });
WorldBuilder.SetComponent(graphWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Graph });
Add tool selection button.
r543 var preserveTool = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(preserveTool, new ToolComponent { Tool = Tool.Preserve });
WorldBuilder.SetComponent(preserveTool, new SelectedComponent {Type = SelectionType.Tool, selected = true});
Add InGameMenu.
r305
Fix style.
r462 var gameEntity = WorldBuilder.CreateEntity();
Add (hacky) option saving.
r350
Fix style.
r462 WorldBuilder.SetComponent(gameEntity, new GameStateComponent { isPlaying = false});
Limit commands to when the game is running.
r306
Fix style.
r462 var policyEntity = WorldBuilder.CreateEntity();
WorldBuilder.SetComponent(policyEntity,
new TrespassingPolicyComponent { tresspassingPolicy = EnforcementLevel.NoEnforcement});
WorldBuilder.SetComponent(policyEntity,
new BudgetLineComponent { });
Add (hacky) option saving.
r350 try {
Fix style.
r462 var options = Options.readOptions();
Add randomly generated areas.
r200
Fix style.
r462 this.imGuiWindowBridgeEngine.fontMessages.Add(new SetFontMessage {
Add (hacky) option saving.
r350 fontSize = options.fontSize,
Fix style.
r462 fontName = options.fontName
});
Add profanity settings.
r417
Fix style.
r462 WorldBuilder.SetComponent(gameEntity, new OptionsComponent {ProfanitySetting = options.profanitySetting});
Add profanity settings.
r417
OptionsWindow.Initialize(new Vector2(FNAGame.width, FNAGame.height), gdm.IsFullScreen, options.profanitySetting);
Fix style.
r462 Logging.Success("Loaded options.");
Add profanity settings.
r417
Add (hacky) option saving.
r350 }
catch (FileNotFoundException e)
{
Clean up warnings.
r370 Logging.Error(String.Format("Error loading file: {0}", e.ToString()));
Add (hacky) option saving.
r350 }
Add header.
r17
Add (hacky) option saving.
r350 World = WorldBuilder.Build();
Rudimentary game state.
r297
Fix messy indentation.
r101 this.output = grammar.Flatten("#greeting#");
Add new event.
r458 var result = grammar.Flatten("#[assistantName:#assistantNames#][friendOfThePark:#assistantNames#][whatever:whatever]vars#");
Add procgen dialog.
r44
Add randomly generated areas.
r200 Func<string, string> toUpper = delegate (string i)
{
return i.ToUpper();
};
Hook Tracery into the News feature.
r113
Add randomly generated areas.
r200 grammar.AddModifier("toUpper", toUpper);
Hook Tracery into the News feature.
r113
Add randomly generated areas.
r200 var newItems = new[] {new NewsItem{hed="Test", contents="#city.toUpper# - This is where the lede would go. #whatever#", source="Wire"}
Fix style.
r462 };
Add support for reading in news stories from YAML.
r114
Add randomly generated areas.
r200 this.newsItems = newItems.ToList();
Add News Items from file.
r115
Add randomly generated areas.
r200 using (var sr = new StreamReader(@"Content/news_items.yaml"))
{
this.newsItems.AddRange(NewsItem.FromYaml(sr.ReadToEnd()));
}
using (var sr_pregenerated = new StreamReader(@"Content/news_items_pregenerated.yaml"))
{
this.newsItems.AddRange(NewsItem.FromYaml(sr_pregenerated.ReadToEnd()));
}
this.simulation.LoadContent(this.newsItems, this.grammar);
Hook Tracery into the News feature.
r113
Fix messy indentation.
r101 this.budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0);
Add super basic Budget UI.
r52
Make use of logging....
r235 Logging.Success("Content loaded.");
Fix messy indentation.
r101 }
Add parameter to Line for width.
r1
Adjust SpriteFonts when user changes font option.
r345
public void setFont(string font, int size)
{
Fix style and identation.
r348 var font_path = DebugWindow.fonts[font];
Adjust SpriteFonts when user changes font option.
r345
Ensure changing the font is applied to SpriteFont.
r354 var baked = TtfFontBaker.Bake(File.OpenRead(font_path),
Fix style.
r462 size,
1024,
1024,
new[]
{
CharacterRange.BasicLatin,
CharacterRange.Latin1Supplement,
CharacterRange.LatinExtendedA,
CharacterRange.Cyrillic,
CharacterRange.LatinExtendedB,
new CharacterRange((char) 0x00B7)
}
);
Adjust SpriteFonts when user changes font option.
r345
Fix style and identation.
r348 this.monoFont = baked.CreateSpriteFont(GraphicsDevice);
Adjust SpriteFonts when user changes font option.
r345 }
Fix style and identation.
r348
Add randomly generated areas.
r200
Fix messy indentation.
r101 protected override void UnloadContent()
{
batch.Dispose();
Limit sound to Debug builds for now.
r470 #if DEBUG
Fix messy indentation.
r101 sound.Dispose();
Limit sound to Debug builds for now.
r470 #endif
Fix messy indentation.
r101 Tile.TileSetTexture.Dispose();
Some tweaks to ensure it builds on framework.
r272 Logging.Success("Disposed of Tile texture.");
if (Quad.PixelTexture != null)
{
Quad.PixelTexture.Dispose();
Logging.Success("Disposed of Pixel texture.");
}
if (Quad.SolidTexture != null)
{
Fix style.
r462 Quad.SolidTexture.Dispose();
Some tweaks to ensure it builds on framework.
r272 }
Fix messy indentation.
r101 }
Add parameter to Line for width.
r1
Fix messy indentation.
r101 Vector2 calculateMousegrid(Vector2 normalizedMousePos)
{
Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight);
Vector2 adjustedMousePos = normalizedMousePos - adjust;
Switch to drawing from top middle rather than upper-right corner.
r12
Fix messy indentation.
r101 float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight));
float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
Switch to drawing from top middle rather than upper-right corner.
r12
Fix messy indentation.
r101 return new Vector2((int)boardx, (int)boardy);
}
Add (broken) tile picker.
r11
Add parameter to Line for width.
r1
Display preserve on status bar.
r541 private String CurrentStatus() {
if (this.in_active_zone) {
return "Contracted";
}
else if (this.in_zone) {
return "Proposed Contract";
}
else if (this.in_preserve) {
return "Preserve";
}
else {
return "Unused";
}
}
Add parameter to Line for width.
r1
Fix messy indentation.
r101 protected override void Update(GameTime gameTime)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
Add updateTime fully.
r50
Relegate local variables to debug builds.
r480 #if DEBUG
Fix messy indentation.
r101 float volume = 1.0f;
float pitch = 0.0f;
float pan = 0.0f;
Relegate local variables to debug builds.
r480 #endif
Add parameter to Line for width.
r1
Fix messy indentation.
r101 KeyboardState keyboardCur = Keyboard.GetState();
Refactor out more code into InputEngine.
r296 MouseState mouseCur = Mouse.GetState();
Fix style and identation.
r348
Fix style.
r462 #region input
Tweak style.
r481
Fix style.
r462 #region misc_keys
Limit sound to Debug builds for now.
r470 #if DEBUG
Fix style and identation, more.
r349 if (keyboardCur.IsKeyDown(Keys.OemBackslash)
&& keyboardPrev.IsKeyUp(Keys.OemBackslash)
&& keyboardCur.IsKeyDown(Keys.LeftShift))
Fix style and identation.
r348 {
sound.Play(volume, pitch, pan);
}
Limit sound to Debug builds for now.
r470 #endif
Fix style.
r462 #endregion misc_keys
#endregion input
Switch to drawing from top middle rather than upper-right corner.
r12
Initial version of encompass addition (not fully working)....
r169 World.Update(gameTime.ElapsedGameTime.TotalSeconds);
Fix style and identation.
r348 this.simulation.update(gameTime.ElapsedGameTime);
Add (broken) tile picker.
r11
Fix style and identation.
r348 if (this.showBudget)
{
this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget);
}
Add super basic Budget UI.
r52
Add second dialog, more for testing purposes.
r43
Fix style and identation.
r348 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
Add (broken) tile picker.
r11
Fix style and identation.
r348 this.mouseGrid = this.calculateMousegrid(this.original_point);
Add (broken) tile picker.
r11
Fix style and identation.
r348 elapsedTime += gameTime.ElapsedGameTime;
Add parameter to Line for width.
r1
Fix style and identation.
r348 if (elapsedTime > TimeSpan.FromSeconds(1))
{
elapsedTime -= TimeSpan.FromSeconds(1);
frameRate = frameCounter;
frameCounter = 0;
}
Add parameter to Line for width.
r1
Fix style and identation.
r348 this.keyboardPrev = keyboardCur;
this.mousePrev = mouseCur;
Fix debouncing and only apply to certain keys.
r7
Fix style and identation.
r348 stopWatch.Stop();
this.updateTime = stopWatch.Elapsed;
Add updateTime fully.
r50
Fix style and identation.
r348 base.Update(gameTime);
Add parameter to Line for width.
r1
Use Game.Exit()....
r463 if (quit) {
this.Exit();
}
Fix style and identation.
r348 }
Add parameter to Line for width.
r1
Fix style and identation.
r348 protected float calculateDepth() {
return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
}
Factor out some of the tile drawing code.
r68
Fix style and identation.
r348 protected Boolean cull(int gridX, int gridY)
{
int screenX = (gridX - gridY) * Tile.TileSpriteWidth / 2;
int screenY = (gridX + gridY) * Tile.TileSpriteHeight / 2;
Add rudimentary (disabled) culling.
r19
Fix style and identation.
r348 Vector2 original = Vector2.Transform(new Vector2(screenX, screenY), camera.get_transformation(GraphicsDevice));
Add rudimentary (disabled) culling.
r19
Fix style and identation.
r348 return (!FNAGame.enableCulling ||
(MathUtils.BetweenExclusive(original.X, -Tile.TileSpriteWidth, FNAGame.width)
&& MathUtils.BetweenExclusive(original.Y, -Tile.TileSpriteHeight, FNAGame.height)));
}
Add rudimentary (disabled) culling.
r19
Factor out some of the tile drawing code.
r68 //Convenience method I'm not super sure about anymore.
protected void drawTileAt(int x, int y, int tileIndex, int height)
Fix messy indentation.
r101 {
float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
Move Outline methods.
r67
Fix some rendering bugs....
r526 float depthOffset = 0.7f - ((x + (y * Tile.TileWidth)) / maxdepth);
Move Outline methods.
r67
Temporary fix for overlap issue.
r527 Tile.drawTileAt(this.tileBatch, x, y, tileIndex, height, depthOffset);
Fix messy indentation.
r101 }
Move Outline methods.
r67
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix messy indentation.
r101 protected override void Draw(GameTime gameTime)
Add proper marker for highlighting squares.
r46 {
frameCounter++;
Add parameter to Line for width.
r1
Add proper marker for highlighting squares.
r46 string fps = string.Format("fps: {0}", frameRate);
Rudimentary game state.
r297 bool has_tree = false;
Add parameter to Line for width.
r1
Add proper marker for highlighting squares.
r46 Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
GraphicsDevice.Clear(Color.CornflowerBlue);
Rudimentary game state.
r297
_imGuiRenderer.BeforeLayout(gameTime);
Fix style and identation.
r348 if (this.isPlaying)
Clean up code.
r369 {
Split into separate batches.
r516 batch.Begin(SpriteSortMode.Deferred,
Fix style.
r462 BlendState.AlphaBlend,
null,
null,
null,
null,
camera.get_transformation(GraphicsDevice));
Add parameter to Line for width.
r1
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 #region draw_tiles
Add timers.
r514 Stopwatch stopWatch2 = new Stopwatch();
stopWatch2.Start();
Fix style.
r462 //reset
this.tilesDrawn = 0;
Add ImGui.
r16
Add scaling code.
r517 var scale_factor = 1;
var x_adjust = scale_factor > 1 ? -scale_factor : 0;
var y_adjust = scale_factor > 1 ? -scale_factor/2 : 0;
for (int y = y_adjust; y < this.squaresDown + y_adjust; y += scale_factor)
Add proper marker for highlighting squares.
r46 {
Add scaling code.
r517 for (int x = x_adjust; x < this.squaresAcross + x_adjust; x += scale_factor)
Fix style.
r462 {
Add scaling code.
r517 int screenx = (x - y) * (Tile.TileSpriteWidth) / 2 - 3*scale_factor;
int screeny = (x + y) * (Tile.TileSpriteHeight) / 2;
Switch to drawing from top middle rather than upper-right corner.
r12
Remove cull() check....
r515 // if (this.cull(x, y))
// {
Fix code style.
r534 batch.Draw(
Tile.TileSetTexture,
new Rectangle(
screenx,
screeny,
Tile.TileWidth * scale_factor, Tile.TileHeight * scale_factor),
Tile.GetSourceRectangle(1),
Color.White,
0.0f,
Vector2.Zero,
SpriteEffects.None,
0.9f);
Add rudimentary (disabled) culling.
r19
Fix code style.
r534 this.tilesDrawn++;
Remove cull() check....
r515 // }
Add proper marker for highlighting squares.
r46 }
}
Split into separate batches.
r516 batch.End();
Add timers.
r514 stopWatch2.Stop();
this.tileDrawTime = stopWatch2.Elapsed;
Fix style.
r462 #endregion draw_tiles
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 #region draw_gridlines
Fix some rendering bugs....
r526 batch.Begin(SpriteSortMode.Deferred,
Split into separate batches.
r516 BlendState.AlphaBlend,
null,
null,
null,
null,
camera.get_transformation(GraphicsDevice));
Add timers.
r514 stopWatch2 = new Stopwatch();
stopWatch2.Start();
Organize code and add regions.
r34
Fix style.
r462 if (this.showGrid)
Add proper marker for highlighting squares.
r46 {
Fix style.
r462 //need to go one extra so gridlines include the far side of the final tile:
for (int y = 0; y < (this.squaresDown + 1); y++)
{
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 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,
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 Color.White, 0.81f);//Just below the highlighted square and areas
}
Fix messy indentation.
r101
Fix style.
r462 for (int x = 0; x < (this.squaresAcross + 1); x++)
{
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 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.81f);
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 }
Add proper marker for highlighting squares.
r46 }
Fix some rendering bugs....
r526 batch.End();
Add timers.
r514 stopWatch2.Stop();
this.gridDrawTime = stopWatch2.Elapsed;
Fix style.
r462 #endregion draw_gridlines
Add parameter to Line for width.
r1
Organize code and add regions.
r34
Fix style.
r462 //Gridlines
//Lines going down and to the right:
/*
for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++)
{
int rowOffset = 0;
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
Add parameter to Line for width.
r1
Fix style.
r462 Vector2 start = new Vector2(startX, -baseOffsetY+4);
Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2,
this.squaresDown*Tile.TileStepY- baseOffsetY+4);
Add parameter to Line for width.
r1
Switch to drawing from top middle rather than upper-right corner.
r12
Limit lines to grid.
r8
Fix style.
r462 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);
Add parameter to Line for width.
r1
Fix style.
r462 }
//Lines going down and to the left:
for (int x = 0; x < (int)(1.5*this.squaresAcross); x++)
{
Switch to drawing from top middle rather than upper-right corner.
r12
Fix style.
r462 float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2);
Add parameter to Line for width.
r1
Fix style.
r462 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);
Add parameter to Line for width.
r1
Fix style.
r462 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);
Add rudimentary tree drawing.
r2
Fix style.
r462 }
*/
Temporary fix for overlap issue.
r527 tileBatch.Begin(SpriteSortMode.BackToFront,
Fix code style.
r534 BlendState.AlphaBlend,
null,
null,
null,
null,
camera.get_transformation(GraphicsDevice));
Extend outlining.
r47
Add TODOs (also kind of roadmap).
r48 #if DEBUG
Fix style.
r462 drawTileAt(4, 4, 140, 3);
drawTileAt(6, 4, 141, 3);
drawTileAt(8, 4, 142, 2);
drawTileAt(10, 4, 142, 3);
#endif
Add code for drawing outlines of an arbitrary set of squares.
r154
Fix style.
r462 #region draw_cursor
if (MathUtils.Between(this.mouseGrid.X, 0, this.simulation.map.MapWidth)
&& MathUtils.Between(this.mouseGrid.Y, 0, this.simulation.map.MapHeight))
{
Temporary fix for overlap issue.
r527 Tile.OutlineSquare(tileBatch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1);
Fix style.
r462 }
Add Edge drawing functions (from last night).
r153
Fix style.
r462 #if DEBUG
Temporary fix for overlap issue.
r527 Tile.OutlineSquare(tileBatch, 1, 1, Color.Red, 2);
Tile.OutlineSquare(tileBatch, 3, 1, Color.Blue, 2);
Tile.OutlineSquare(tileBatch, 5, 1, Color.Green, 2);
Tile.OutlineSquare(tileBatch, 7, 1, Color.Orange, 2);
Tile.OutlineSquare(tileBatch, 9, 1, Color.Orange, 3);
Add option to shade squares.
r206
Fix style.
r462 //donut
Temporary fix for overlap issue.
r527 Tile.DrawOutlinedSquares(tileBatch, new Vector2[] {new Vector2(19, 1), new Vector2(19, 2), new Vector2(20, 1), new Vector2(21, 1),
Fix style.
r462 new Vector2(21, 2), new Vector2(19, 3), new Vector2(20, 3), new Vector2(21, 3)
}, Color.Purple);
Temporary fix for overlap issue.
r527 Quad.FillSquare2(tileBatch, 7, 4, Color.Orange, 1.0f, 0.79f);
Quad.FillSquare2(tileBatch, 7, 3, Color.Yellow, 1.0f, 0.79f);
Quad.FillSquare2(tileBatch, 7, 5, Color.Yellow, .5f, 0.79f);
Quad.FillSquare2(tileBatch, 7, 6, Color.Yellow, .25f, 0.79f);
Quad.FillSquare2(tileBatch, 7, 7, Color.Yellow, .125f, 0.79f);
Quad.FillSquare2(tileBatch, 8, 5, Color.Teal, .5f, 0.79f);
Quad.FillSquare2(tileBatch, 8, 6, Color.Teal, .25f, 0.79f);
Quad.FillSquare2(tileBatch, 8, 7, Color.Teal, .125f, 0.79f);
Fix style and identation.
r348 #endif
Add proper marker for highlighting squares.
r46
Fix style.
r462 #endregion draw_cursor
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Add timers.
r514 stopWatch2 = new Stopwatch();
stopWatch2.Start();
Fix style.
r462 #region draw_trees
if (this.showTrees) {
for (int i = 0; i < this.simulation.map.MapHeight; i++)
Add tree show/hide for debugging at least.
r152 {
Fix style.
r462 for (int j = 0; j < this.simulation.map.MapWidth; j += 1)
{
Update Cell to follow C# convention while I'm here.
r522 if (this.simulation.map.cells[i][j].HasTree)
Fix style.
r462 { //until we actually simulate:
Display tree type.
r521 if (this.simulation.map.cells[i][j].Type == TreeType.GenericDeciduous) {
Add another tree type.
r529 drawTileAt(i, j, 252, 2); // 142, , 262
}
else if (this.simulation.map.cells[i][j].Type == TreeType.Oak) {
drawTileAt(i, j, 142, 2);
}
else if (this.simulation.map.cells[i][j].Type == TreeType.GenericShrub) {
drawTileAt(i, j, 210, 2);
Early start of multiple tree types.
r520 }
else {
Fix code style.
r534 drawTileAt(i, j, 122, 2); //122, 203, 221
Early start of multiple tree types.
r520 }
Fix style.
r462 // if ((i + j) % 8 == 0)
// {
// drawTileAt(i, j, 141, 2);
// }
// else
// {
// drawTileAt(i, j, 142, 2);
// }
}
Update Cell to follow C# convention while I'm here.
r522 else if (this.simulation.map.cells[i][j].Status == CellStatus.DeadTree) {
Fix style.
r462 drawTileAt(i, j, 141, 2);
// System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
}
Add tree show/hide for debugging at least.
r152 }
Fix messy indentation.
r101 }
Add proper marker for highlighting squares.
r46 }
Add timers.
r514 stopWatch2.Stop();
this.treeDrawTime = stopWatch2.Elapsed;
Fix style.
r462 #endregion draw_trees
Add basic TileMap.
r9
Fix some layering issues.
r199 #if DEBUG
Fix style.
r462 drawTileAt(2, 2, 140, 2);
drawTileAt(1, 1, 140, 2);
drawTileAt(3, 2, 140, 2);
Fix some layering issues.
r199 #endif
Add basic TileMap.
r9
Fix style.
r462 World.Draw();
// _imGuiRenderer.AfterLayout();
Temporary fix for overlap issue.
r527 tileBatch.End();
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix style.
r462 #region draw_header
batch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend,
null,
null,
null,
null);
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Tweak style.
r481 if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross)
&& MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross))
Fix style.
r462 {
Update Cell to follow C# convention while I'm here.
r522 has_tree = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].HasTree;
Fix style.
r462 }
Add header.
r17
Fix style.
r462 String status_left = "";
Tweak style.
r481 if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth)
&& MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
Fix style.
r462 {
Update Cell to follow C# convention while I'm here.
r522 var treeStatus = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].Status;
Display tree type.
r521 var treeStatusAdjective = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].StatusAdjective;
var treeType = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].TypeName;
Display preserve on status bar.
r541 var useStatus = this.CurrentStatus();
Display tree type.
r521 if (treeStatus != CellStatus.Clear)
{
status_left = String.Format("{0:},{1:} {2} {3} ({4})", this.mouseGrid.X, this.mouseGrid.Y,
Fix code style.
r534 treeStatusAdjective,
treeType,
Display preserve on status bar.
r541 useStatus);
Display tree type.
r521 }
else {
status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y,
Fix code style.
r534 treeStatusAdjective,
Display preserve on status bar.
r541 useStatus);
Display tree type.
r521 }
Fix style.
r462 }
Add header.
r17
Fix style.
r462 String header_left = String.Format("${0:}|{1:} \ue124", this.simulation.money, this.simulation.map.tree_count);
String header_middle = String.Format("{0:MMMMM yyyy} ({1:})", this.simulation.DateTime, this.simulation.Season);
// String header_right = String.Format("Press H for help.");
String header_right = "";
Add proper marker for highlighting squares.
r46
Fix style.
r462 this.Window.Title = String.Format("Isometric Park [{0:}]", header_middle);
Vector2 middle_dimensions = monoFont.MeasureString(header_middle);
Vector2 right_dimensions = monoFont.MeasureString(header_right);
Add proper marker for highlighting squares.
r46
Fix style.
r462 float middle_start = (int)((FNAGame.width / 2) - (middle_dimensions.X / 2));
float right_start = (int)(FNAGame.width - right_dimensions.X - 10.0f);
float top = (float)Math.Round(FNAGame.height - middle_dimensions.Y); // Rounding so the int and float versions are closer.
Add proper marker for highlighting squares.
r46
Fix style.
r462 FilledRectangle.drawFilledRectangle(batch, new Rectangle(0, (int)top, width, (int)middle_dimensions.Y), Color.White, 0.51f);
Add proper marker for highlighting squares.
r46
Fix style.
r462 batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
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);
#endregion draw_header
Fix object positioning.
r14
Fix style.
r462 #region budget
Add super basic Budget UI.
r52
Fix style.
r462 if (this.showBudget)
{
budgetWindow.draw(batch);
}
Add super basic Budget UI.
r52
Fix style.
r462 #endregion budget
Add super basic Budget UI.
r52
Fix style.
r462 batch.End();
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix style.
r462 #region window
Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
Rudimentary game state.
r297
Fix style.
r462 if (quit) {
System.Environment.Exit(0);
}
Rudimentary game state.
r297
Fix style.
r462 }
else {
GraphicsDevice.Clear(Color.Teal);
batch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend,
null,
null,
null,
null);
Rudimentary game state.
r297
Fix style.
r462 Vector2 middle_dimensions = largeMonoFont.MeasureString("Isometric Park");
float middle_start = (int)((FNAGame.width / 2) - (middle_dimensions.X / 2));
batch.DrawString(largeMonoFont, "Isometric Park",
new Vector2(middle_start, 50),
Color.Black, 0.0f, Vector2.Zero,
1.0f, SpriteEffects.None, 0.5f);
batch.DrawString(largeMonoFont, "Isometric Park",
new Vector2(middle_start-1, 49),
Color.White, 0.0f, Vector2.Zero,
1.0f, SpriteEffects.None, 0.51f);
World.Draw();
Add version string.
r299
Fix style.
r462 Vector2 version_dimensions = monoFont.MeasureString(typeof(FNAGame).Assembly.GetName().Version.ToString());
batch.DrawString(monoFont,
typeof(FNAGame).Assembly.GetName().Version.ToString(),
new Vector2(0, FNAGame.height-version_dimensions.Y),
Color.White, 0.0f, Vector2.Zero,
1.0f, SpriteEffects.None, 0.51f);
Add to title screen.
r300
Fix style.
r462 Vector2 name_dimensions = monoFont.MeasureString("by actuallyalys<3");
float name_start = (int)(FNAGame.width / 2) - (name_dimensions.X / 2);
Add to title screen.
r300
Fix style.
r462 batch.DrawString(monoFont, "by actuallyalys <3",
new Vector2(name_start, 50+middle_dimensions.Y),
Color.White, 0.0f, Vector2.Zero,
1.0f, SpriteEffects.None, 0.51f);
batch.End();
}
#endregion
Rudimentary game state.
r297
Add zooming, scrolling, and proper sprite layering (changes from last night).
r4
Fix style.
r462 #region debug_window
Add proper marker for highlighting squares.
r46 //Calcs for debug window:
Show percentile timings and fps.
r518 past_draw.Enqueue(this.drawTime);
Add proper marker for highlighting squares.
r46 if ((this.frameCounter % 15) == 0)
{
past_fps.Enqueue(this.frameRate);
Add ImGui.
r16
Show percentile timings and fps.
r518
Fix style.
r462 /*
Tweak style.
r481 if (this.frameRate > 60.0)
{
Logging.Warning(String.Format("Framerate is higher than limit: {0}", this.frameRate));
}
if (this.frameRate < 30.0)
{
Logging.Warning(String.Format("Framerate is lower than desired: {0}", this.frameRate));
}
*/
Add proper marker for highlighting squares.
r46 }
Add Contract window.
r246 /*
if (this.frameRate > 120.0)
{
Logging.Error(String.Format("Framerate is much higher than limit: {0}", this.frameRate));
}
else if (this.frameRate < 15.0)
{
Logging.Error(String.Format("Framerate is much lower than desired: {0}", this.frameRate));
}
*/
Add proper marker for highlighting squares.
r46 DebugInfo debugInfo = new DebugInfo
Fix style.
r462 { fps = this.frameRate,
Add proper marker for highlighting squares.
r46 pastFps = past_fps.ToArray(),
cameraPosition = camera.position,
drawTime = this.drawTime,
Add timers.
r514 treeDrawTime = this.treeDrawTime,
gridDrawTime = this.gridDrawTime,
tileDrawTime = this.tileDrawTime,
Fix messy indentation.
r101 updateTime = this.updateTime,
Add proper marker for highlighting squares.
r46 treeCount = this.simulation.map.tree_count,
mouseGrid = this.mouseGrid,
hasTree = has_tree,
tilesDrawn = this.tilesDrawn
};
Add Tracery and pause.
r33
Add proper marker for highlighting squares.
r46 //Finally, draw the debug window
Add Tracery and pause.
r33
Add proper marker for highlighting squares.
r46 var additionalInfo = new Dictionary<string, string>();
Add ImGui.
r16
Fix messy indentation.
r101 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;
Add TODOs (also kind of roadmap).
r48
Fix messy indentation.
r101 additionalInfo.Add("cameraMiddle", cameraMiddle.ToString());
additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y));
additionalInfo.Add("mouse delta", delta.ToString());
Add TODOs (also kind of roadmap).
r48
Fix dialog bugs.
r429 string entries = "";
Add portraits.
r443 string descriptions = "";
Fix dialog bugs.
r429 foreach (var pair in DialogSpawner.indexes)
{
Add portraits.
r443 entries += String.Format("{0}={1},", pair.Key, pair.Value);
}
foreach (var meta in portraitsMap.Metadata)
{
Fix style.
r462 descriptions += String.Format("{0}: {1}\n", meta.Filename,
meta.Description);
Fix dialog bugs.
r429 }
Fix messy indentation.
r101 additionalInfo.Add("Tracery Test", this.output);
Add entry-based logging.
r281 additionalInfo.Add("Log Entry", string.Format("{0} {1}", Logging.entries[Logging.entries.Count-1].level, Logging.entries[Logging.entries.Count-1].message));
Fix style.
r462 additionalInfo.Add("Dialog entries", entries);
additionalInfo.Add("Metadata entries", descriptions);
Add initial version of money.
r51
Show percentile timings and fps.
r518 if (past_fps.Count() > 5) {
additionalInfo.Add(".01%% fps", MathUtils.Percentile(past_fps.Skip(5).ToArray(), 0.0001f).ToString());
additionalInfo.Add(".1%% fps", MathUtils.Percentile(past_fps.Skip(5).ToArray(), 0.001f).ToString());
additionalInfo.Add("1%% fps", MathUtils.Percentile(past_fps.Skip(5).ToArray(), 0.01f).ToString());
additionalInfo.Add("50%% fps", MathUtils.Percentile(past_fps.Skip(5).ToArray(), 0.50f).ToString());
}
if (past_draw.Count() > 5) {
var past_draw_floats = past_draw.Skip(5).Select(ts => ts.TotalMilliseconds).ToArray();
additionalInfo.Add(".01%% draw", MathUtils.Percentile(past_draw_floats, 0.0001f).ToString());
additionalInfo.Add(".1%% draw", MathUtils.Percentile(past_draw_floats, 0.001f).ToString());
additionalInfo.Add("1%% draw", MathUtils.Percentile(past_draw_floats, 0.01f).ToString());
additionalInfo.Add("50%% draw", MathUtils.Percentile(past_draw_floats, 0.50f).ToString());
additionalInfo.Add("99%% draw", MathUtils.Percentile(past_draw_floats, 0.99f).ToString());
additionalInfo.Add("99.9%% draw", MathUtils.Percentile(past_draw_floats, 0.999f).ToString());
additionalInfo.Add("99.99%% draw", MathUtils.Percentile(past_draw_floats, 0.9999f).ToString());
}
Fix messy indentation.
r101 debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window);
Add start of dialog.
r18
Add proper marker for highlighting squares.
r46 _imGuiRenderer.AfterLayout();
Organize code and add regions.
r34
Fix style.
r462 #endregion debug_window
Add ImGui.
r16
Organize code and add regions.
r34 stopWatch.Stop();
Add proper marker for highlighting squares.
r46 this.drawTime = stopWatch.Elapsed;
base.Draw(gameTime);
}
Add resolution setting.
r307
Add fullscreen support and more resolutions.
r310 public void setResolution(Vector2 newResolution, bool fullscreen)
Add resolution setting.
r307 {
Fix style and identation.
r348 FNAGame.width = (int)newResolution.X;
FNAGame.height = (int)newResolution.Y;
Add resolution setting.
r307
Fix style and identation.
r348 this.gdm.PreferredBackBufferWidth = (int)newResolution.X;
this.gdm.PreferredBackBufferHeight = (int)newResolution.Y;
this.gdm.IsFullScreen = fullscreen;
this.gdm.ApplyChanges();
Add resolution setting.
r307 }
Add (broken) tile picker.
r11 }