# HG changeset patch # User Alys Brooks # Date 2021-06-23 04:48:42 # Node ID f1528e514ededb0d69b7d7d3702b0d2b2d74524f # Parent 39385bdd9d3096c1d56e70ba99fdbed7f187324d Fix issue when adjusting width. diff --git a/TODO.taskpaper b/TODO.taskpaper --- a/TODO.taskpaper +++ b/TODO.taskpaper @@ -170,6 +170,10 @@ - Grids sometimes overlap trees. - Trees sometimes - Sometimes framerate jumps to 180-200 fps. (Better than reverse, but kinda weird) + - Graphics don't adjust for the resolution + - Scroll area + - Ingame Menu @done(2021-06-22) + - Main Menu Misc: - Exits are messy (does Encompass add threading?) [xcb] Unknown sequence number while appending request diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -240,7 +240,7 @@ WorldBuilder.AddEngine(new OrganizationSpawner(this.simulation, this.grammar)); WorldBuilder.AddGeneralRenderer(new AreaRenderer(this.batch, this.monoFont), 1); - WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(this, debugWindow.monoFont, debugWindow.italicFont, this.imGuiWindowBridgeEngine, FNAGame.width), 2); + WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(this, debugWindow.monoFont, debugWindow.italicFont, this.imGuiWindowBridgeEngine, this.gdm) , 2); var contractWindow = WorldBuilder.CreateEntity(); WorldBuilder.SetComponent(contractWindow, new VisibilityComponent { visible = false }); WorldBuilder.SetComponent(contractWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Contracts }); diff --git a/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs b/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs --- a/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs +++ b/isometric-park-fna/Renderers/ImGuiWindowRenderer.cs @@ -22,15 +22,17 @@ private ImFontPtr font; private ImFontPtr italicFont; private ImGuiWindowBridgeEngine BridgeEngine; - private int width; private FNAGame game; - public ImGuiWindowRenderer(FNAGame game, ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine, int width) + + private GraphicsDeviceManager gdm; + + public ImGuiWindowRenderer(FNAGame game, ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine, GraphicsDeviceManager gdm) { this.font = font; this.italicFont = italicFont; this.BridgeEngine = engine; - this.width = width; this.game = game; + this.gdm = gdm; } private (Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int image_index, Vector2 square) @@ -62,6 +64,8 @@ public override void Render() { + + var width = gdm.PreferredBackBufferWidth; foreach (ref readonly var entity in ReadEntities()) { var window_type = GetComponent(entity).type;