Description:
Incomplete version of BudgetWindow handling in Encompass.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,11 | |||||
|
|
1 | using Encompass; | ||
|
|
2 | |||
|
|
3 | namespace isometricparkfna.Components { | ||
|
|
4 | |||
|
|
5 | public struct BudgetComponent : IComponent { | ||
|
|
6 | public Budget currentBudget; | ||
|
|
7 | public Budget priorBudget; | ||
|
|
8 | |||
|
|
9 | } | ||
|
|
10 | |||
|
|
11 | } |
@@ -0,0 +1,12 | |||||
|
|
1 | |||
|
|
2 | using Encompass; | ||
|
|
3 | |||
|
|
4 | namespace isometricparkfna.Components { | ||
|
|
5 | |||
|
|
6 | public struct BudgetWindowComponent : IComponent { | ||
|
|
7 | public Budget currentBudget; | ||
|
|
8 | public Budget priorBudget; | ||
|
|
9 | |||
|
|
10 | } | ||
|
|
11 | |||
|
|
12 | } |
@@ -0,0 +1,8 | |||||
|
|
1 | using Encompass; | ||
|
|
2 | |||
|
|
3 | namespace isometricparkfna.Components { | ||
|
|
4 | |||
|
|
5 | public struct VisibilityComponent : IComponent { | ||
|
|
6 | public bool visible; | ||
|
|
7 | } | ||
|
|
8 | } |
@@ -0,0 +1,39 | |||||
|
|
1 | |||
|
|
2 | using Microsoft.Xna.Framework.Input; | ||
|
|
3 | |||
|
|
4 | using Encompass; | ||
|
|
5 | |||
|
|
6 | using isometricparkfna.Messages; | ||
|
|
7 | using isometricparkfna.Components; | ||
|
|
8 | |||
|
|
9 | namespace isometricparkfna.Engines { | ||
|
|
10 | |||
|
|
11 | // [Receives()] | ||
|
|
12 | [Reads(typeof(BudgetComponent))] | ||
|
|
13 | [Writes(typeof(BudgetComponent))] | ||
|
|
14 | class SimulationBridgeEngine : Engine | ||
|
|
15 | { | ||
|
|
16 | public Simulation simulation; | ||
|
|
17 | |||
|
|
18 | public SimulationBridgeEngine(Simulation simulation) | ||
|
|
19 | { | ||
|
|
20 | this.simulation = simulation; | ||
|
|
21 | } | ||
|
|
22 | |||
|
|
23 | public override void Update(double dt) | ||
|
|
24 | { | ||
|
|
25 | |||
|
|
26 | foreach (ref readonly var entity in ReadEntities<BudgetComponent>()) | ||
|
|
27 | { | ||
|
|
28 | ref readonly var budgetComponent = ref GetComponent<BudgetComponent>(entity); | ||
|
|
29 | |||
|
|
30 | SetComponent(entity, new BudgetComponent{currentBudget = this.simulation.latestBudget, | ||
|
|
31 | priorBudget = this.simulation.previousBudget}); | ||
|
|
32 | } | ||
|
|
33 | |||
|
|
34 | } | ||
|
|
35 | |||
|
|
36 | |||
|
|
37 | } | ||
|
|
38 | |||
|
|
39 | } |
@@ -0,0 +1,35 | |||||
|
|
1 | using Encompass; | ||
|
|
2 | |||
|
|
3 | namespace isometricparkfna.Renderers | ||
|
|
4 | { | ||
|
|
5 | public class BudgetWindowRenderer : GeneralRenderer | ||
|
|
6 | { | ||
|
|
7 | private SpriteBatch batch; | ||
|
|
8 | private SpriteFont font; | ||
|
|
9 | |||
|
|
10 | |||
|
|
11 | public BudgetWindowRenderer(SpriteBatch batch, SpriteFont font) | ||
|
|
12 | { | ||
|
|
13 | this.batch = batch; | ||
|
|
14 | this.font = font; | ||
|
|
15 | } | ||
|
|
16 | |||
|
|
17 | |||
|
|
18 | public override void Render() | ||
|
|
19 | { | ||
|
|
20 | |||
|
|
21 | var budgetWindow = new BudgetWindow(new Budget { }, this.monoFont, 0, 0); | ||
|
|
22 | |||
|
|
23 | foreach (ref readonly var entity in ReadEntities<BudgetComponent>()) | ||
|
|
24 | { | ||
|
|
25 | // budgetWindow.update | ||
|
|
26 | // this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); | ||
|
|
27 | |||
|
|
28 | } | ||
|
|
29 | |||
|
|
30 | |||
|
|
31 | |||
|
|
32 | |||
|
|
33 | } | ||
|
|
34 | } | ||
|
|
35 | } |
@@ -18,6 +18,7 | |||||
|
18 | using isometricparkfna.Utils; |
|
18 | using isometricparkfna.Utils; |
|
19 | using isometricparkfna.UI; |
|
19 | using isometricparkfna.UI; |
|
20 | using isometricparkfna.Engines; |
|
20 | using isometricparkfna.Engines; |
|
|
21 | using isometricparkfna.Components; | ||
|
21 |
|
22 | ||
|
22 | using ImGuiNET.SampleProgram.XNA; |
|
23 | using ImGuiNET.SampleProgram.XNA; |
|
23 | using ImGuiNET; |
|
24 | using ImGuiNET; |
@@ -192,8 +193,17 | |||||
|
192 | //let's see if this works: |
|
193 | //let's see if this works: |
|
193 | // WorldBuilder = new WorldBuilder(); |
|
194 | // WorldBuilder = new WorldBuilder(); |
|
194 | var dummy_entity = WorldBuilder.CreateEntity(); |
|
195 | var dummy_entity = WorldBuilder.CreateEntity(); |
|
|
196 | |||
|
|
197 | |||
|
|
198 | // WorldBuilder.AddGeneralRenderer(new BudgetWindowRenderer(this.batch, this.monoFont)); | ||
|
195 | WorldBuilder.AddEngine(new InputEngine()); |
|
199 | WorldBuilder.AddEngine(new InputEngine()); |
|
196 | WorldBuilder.AddEngine(new GameBridgeEngine(this)); |
|
200 | WorldBuilder.AddEngine(new GameBridgeEngine(this)); |
|
|
201 | WorldBuilder.AddEngine(new SimulationBridgeEngine(this.simulation)); | ||
|
|
202 | |||
|
|
203 | var budgetWindow = WorldBuilder.CreateEntity(); | ||
|
|
204 | WorldBuilder.SetComponent(budgetWindow, new VisibilityComponent{visible = true}); | ||
|
|
205 | WorldBuilder.SetComponent(budgetWindow, new BudgetComponent()); | ||
|
|
206 | |||
|
197 | World = WorldBuilder.Build(); |
|
207 | World = WorldBuilder.Build(); |
|
198 |
|
208 | ||
|
199 | var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"), |
|
209 | var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"), |
@@ -474,7 +484,7 | |||||
|
474 |
|
484 | ||
|
475 | if (this.showBudget) |
|
485 | if (this.showBudget) |
|
476 | { |
|
486 | { |
|
477 | this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); |
|
487 | // this.showBudget = this.budgetWindow.update(mouseCur, this.simulation.latestBudget, this.simulation.previousBudget); |
|
478 | } |
|
488 | } |
|
479 |
|
489 | ||
|
480 |
|
490 |
@@ -42,6 +42,7 | |||||
|
42 | <Compile Include="ImGuiRenderer.cs" /> |
|
42 | <Compile Include="ImGuiRenderer.cs" /> |
|
43 | <Compile Include="FilledRectangle.cs" /> |
|
43 | <Compile Include="FilledRectangle.cs" /> |
|
44 | <Compile Include="Simulation.cs" /> |
|
44 | <Compile Include="Simulation.cs" /> |
|
|
45 | <Compile Include="Components\*.cs" /> | ||
|
45 | <Compile Include="Engines\*.cs" /> |
|
46 | <Compile Include="Engines\*.cs" /> |
|
46 | <Compile Include="Messages\*.cs" /> |
|
47 | <Compile Include="Messages\*.cs" /> |
|
47 | <Compile Include="Utils\MathUtils.cs" /> |
|
48 | <Compile Include="Utils\MathUtils.cs" /> |
You need to be logged in to leave comments.
Login now