Description:
Update from main.
Commit status:
[Not Reviewed]
References:
merge m1-money
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r71:ffa107ec6a83 -

@@ -0,0 +1,20
1 {
2 "version": "0.2.0",
3 "configurations": [
4 {
5 "name": "Attach to Core Debugger",
6 "type": "coreclr",
7 "request": "launch",
8 "preLaunchTask": "Build: Core Debug",
9 "program": "${workspaceFolder}/isometric-park-fna/bin/Debug/netcoreapp3.1/isometric-park-fna.dll",
10 "args": [],
11 "env": {
12 "LD_LIBRARY_PATH": "${workspaceFolder}/isometric-park-fna/bin/Debug/netcoreapp3.1/lib64",
13 "DYLD_LIBRARY_PATH": "${workspaceFolder}/isometric-park-fna/bin/Debug/netcoreapp3.1/osx"
14 },
15 "cwd": "${workspaceFolder}",
16 "console": "integratedTerminal",
17 "internalConsoleOptions": "neverOpen"
18 }
19 ]
20 }
@@ -0,0 +1,224
1 {
2 "version": "2.0.0",
3 "options": {
4 "cwd": "${workspaceRoot}"
5 },
6 "windows": {
7 "options": {
8 "shell": {
9 "executable": "cmd.exe",
10 "args": [
11 "/d",
12 "/c"
13 ]
14 }
15 }
16 },
17 "presentation": {
18 "reveal": "always",
19 "focus": true,
20 "panel": "shared"
21 },
22 "tasks": [
23 {
24 "label": "Build: Framework Release",
25 "command": "msbuild",
26 "args": [
27 "-restore:True",
28 "${workspaceFolder}/isometric-park-fna.sln",
29 "-p:Configuration=Release"
30 ],
31 "type": "shell",
32 "group": {
33 "kind": "build",
34 "isDefault": true
35 },
36 "problemMatcher": "$msCompile"
37 },
38 {
39 "label": "Run: Framework Release",
40 "command": "mono",
41 "args": [
42 "isometric-park-fna.exe"
43 ],
44 "options": {
45 "env": {
46 "LD_LIBRARY_PATH": "./lib64",
47 "DYLD_LIBRARY_PATH": "/Users/alys/repos/isometric-park-fna/fnalibs/osx:/Users/alys/repos/isometric-park-fna/cimgui/osx-x64s"
48 },
49 "cwd": "${workspaceFolder}/isometric-park-fna/bin/Release/"
50 },
51 "type": "process",
52 "group": {
53 "kind": "build",
54 "isDefault": true
55 },
56 "problemMatcher": []
57 },
58 {
59 "label": "Build & Run: Framework Release",
60 "dependsOn": [
61 "Build: Framework Release",
62 "Run: Framework Release"
63 ],
64 "dependsOrder": "sequence",
65 "type": "shell",
66 "group": {
67 "kind": "build",
68 "isDefault": true
69 },
70 "problemMatcher": []
71 },
72 {
73 "label": "Build: Framework Debug",
74 "command": "msbuild",
75 "args": [
76 "-restore:True",
77 "${workspaceFolder}/isometric-park-fna.sln",
78 "-p:Configuration=Debug"
79 ],
80 "type": "shell",
81 "group": {
82 "kind": "build",
83 "isDefault": true
84 },
85 "problemMatcher": []
86 },
87 {
88 "label": "Run: Framework Debug",
89 "command": "mono",
90 "args": [
91 "isometric-park-fna.exe"
92 ],
93 "options": {
94 "env": {
95 "LD_LIBRARY_PATH": "./lib64",
96 "DYLD_LIBRARY_PATH": "/Users/alys/repos/isometric-park-fna/fnalibs/osx:/Users/alys/repos/isometric-park-fna/cimgui/osx-x64"
97 },
98 "cwd": "${workspaceFolder}/isometric-park-fna/bin/Debug"
99 },
100 "type": "process",
101 "group": {
102 "kind": "build",
103 "isDefault": true
104 },
105 "problemMatcher": []
106 },
107 {
108 "label": "Build & Run: Framework Debug",
109 "dependsOn": [
110 "Build: Framework Debug",
111 "Run: Framework Debug"
112 ],
113 "dependsOrder": "sequence",
114 "type": "shell",
115 "group": {
116 "kind": "build",
117 "isDefault": true
118 },
119 "problemMatcher": []
120 },
121 {
122 "label": "Build & Run: Core Debug",
123 "type": "shell",
124 "dependsOrder": "sequence",
125 "dependsOn": [
126 "Build: Core Debug",
127 "Run: Core Debug"
128 ],
129 "group": {
130 "kind": "build",
131 "isDefault": true
132 },
133 "problemMatcher": []
134 },
135 {
136 "label": "Build: Core Debug",
137 "command": "dotnet",
138 "args": [
139 "build",
140 "./isometric-park-fna.Core.sln",
141 "-f",
142 "netcoreapp3.1"
143 ],
144 "type": "shell",
145 "group": {
146 "kind": "build",
147 "isDefault": true
148 },
149 "problemMatcher": []
150 },
151 {
152 "label": "Run: Core Debug",
153 "command": "dotnet",
154 "args": [
155 "./isometric-park-fna.dll"
156 ],
157 "options": {
158 "env": {
159 "LD_LIBRARY_PATH": "./lib64",
160 "DYLD_LIBRARY_PATH": "/Users/alys/repos/isometric-park-fna/fnalibs/osx:/Users/alys/repos/isometric-park-fna/cimgui/osx-x64"
161 },
162 "cwd": "${workspaceFolder}/isometric-park-fna/bin/Debug/netcoreapp3.1"
163 },
164 "type": "process",
165 "group": {
166 "kind": "build",
167 "isDefault": true
168 },
169 "problemMatcher": []
170 },
171 {
172 "label": "Build: Core Release",
173 "command": "dotnet",
174 "args": [
175 "build",
176 "./isometric-park-fna.Core.sln",
177 "--configuration",
178 "Release",
179 "-f",
180 "netcoreapp3.1"
181 ],
182 "type": "shell",
183 "group": {
184 "kind": "build",
185 "isDefault": true
186 },
187 "problemMatcher": []
188 },
189 {
190 "label": "Run: Core Release",
191 "command": "dotnet",
192 "args": [
193 "./isometric-park-fna.dll"
194 ],
195 "options": {
196 "env": {
197 "LD_LIBRARY_PATH": "./lib64",
198 "DYLD_LIBRARY_PATH": "/Users/alys/repos/isometric-park-fna/fnalibs/osx:/Users/alys/repos/isometric-park-fna/cimgui/osx-x64"
199 },
200 "cwd": "${workspaceFolder}/isometric-park-fna/bin/Release/netcoreapp3.1"
201 },
202 "type": "process",
203 "group": {
204 "kind": "build",
205 "isDefault": true
206 },
207 "problemMatcher": []
208 },
209 {
210 "label": "Build & Run: Core Release",
211 "dependsOrder": "sequence",
212 "dependsOn": [
213 "Build: Core Release",
214 "Run: Core Release"
215 ],
216 "type": "shell",
217 "group": {
218 "kind": "build",
219 "isDefault": true
220 },
221 "problemMatcher": []
222 }
223 ]
224 }
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -8,7 +8,12
8 "restore": {
8 "restore": {
9 "projectUniqueName": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj",
9 "projectUniqueName": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj",
10 "projectName": "FNA",
10 "projectName": "FNA",
11 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj"
11 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj",
12 "frameworks": {
13 "net48": {
14 "projectReferences": {}
15 }
16 }
12 },
17 },
13 "frameworks": {
18 "frameworks": {
14 "net48": {}
19 "net48": {}
@@ -34,7 +39,6
34 },
39 },
35 "frameworks": {
40 "frameworks": {
36 "net45": {
41 "net45": {
37 "targetAlias": "net45",
38 "projectReferences": {
42 "projectReferences": {
39 "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": {
43 "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": {
40 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj"
44 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj"
@@ -50,8 +54,7
50 },
54 },
51 "frameworks": {
55 "frameworks": {
52 "net45": {
56 "net45": {
53 "targetAlias": "net45",
57 "runtimeIdentifierGraphPath": "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/RuntimeIdentifierGraph.json"
54 "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/5.0.102/RuntimeIdentifierGraph.json"
55 }
58 }
56 }
59 }
57 }
60 }
@@ -7,11 +7,8
7 <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageRoot>
7 <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageRoot>
8 <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageFolders>
8 <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageFolders>
9 <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
9 <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
10 <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.8.0</NuGetToolVersion>
10 <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.6.0</NuGetToolVersion>
11 </PropertyGroup>
11 </PropertyGroup>
12 <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
13 <SourceRoot Include="$([MSBuild]::EnsureTrailingSlash($(NuGetPackageFolders)))" />
14 </ItemGroup>
15 <PropertyGroup>
12 <PropertyGroup>
16 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
13 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
17 </PropertyGroup>
14 </PropertyGroup>
@@ -48,7 +48,6
48 },
48 },
49 "frameworks": {
49 "frameworks": {
50 "net45": {
50 "net45": {
51 "targetAlias": "net45",
52 "projectReferences": {
51 "projectReferences": {
53 "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": {
52 "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": {
54 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj"
53 "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj"
@@ -64,8 +63,7
64 },
63 },
65 "frameworks": {
64 "frameworks": {
66 "net45": {
65 "net45": {
67 "targetAlias": "net45",
66 "runtimeIdentifierGraphPath": "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/RuntimeIdentifierGraph.json"
68 "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/5.0.102/RuntimeIdentifierGraph.json"
69 }
67 }
70 }
68 }
71 }
69 }
@@ -1,6 +1,6
1 {
1 {
2 "version": 2,
2 "version": 2,
3 "dgSpecHash": "QbljAP9YfnlfGt9DK+paIbf2KN67CHfFFP459FIA09f6Vs2u4/bm6jOZkhaagMtqNxlEucQ1En4ss24qjT71BA==",
3 "dgSpecHash": "kUPsWi+W/I8KOuiF0fQ9nWh1vVsW3b0wAQVjldBK6JNRF3usvNENwsXcLXddNG6Wh/129HHhkfaanQmLUK7wcA==",
4 "success": true,
4 "success": true,
5 "projectFilePath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj",
5 "projectFilePath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj",
6 "expectedPackageFiles": [],
6 "expectedPackageFiles": [],
@@ -9,7 +9,7
9 // public List<MapCell> Columns = new List<MapCell>();
9 // public List<MapCell> Columns = new List<MapCell>();
10 //}
10 //}
11
11
12 public class TileMap
12 public class CellMap
13 {
13 {
14 public List<List<Cell>> cells;
14 public List<List<Cell>> cells;
15 public int MapWidth = 50;
15 public int MapWidth = 50;
@@ -31,12 +31,12
31 }
31 }
32 }
32 }
33
33
34 public TileMap()
34 public CellMap()
35 {
35 {
36 //TileMap(MapWidth, MapHeight);
36 //TileMap(MapWidth, MapHeight);
37 }
37 }
38
38
39 public TileMap(int width, int height)
39 public CellMap(int width, int height)
40 {
40 {
41 this.MapWidth = width;
41 this.MapWidth = width;
42 this.MapHeight = height;
42 this.MapHeight = height;
@@ -1,4 +1,4
1 using System.Collections.Generic;
1 using System.Collections.Generic;
2 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework;
3 using Microsoft.Xna.Framework.Audio;
3 using Microsoft.Xna.Framework.Audio;
4 using Microsoft.Xna.Framework.Input;
4 using Microsoft.Xna.Framework.Input;
@@ -12,7 +12,7
12 using SpriteFontPlus;
12 using SpriteFontPlus;
13 using isometricparkfna;
13 using isometricparkfna;
14 using System.Diagnostics;
14 using System.Diagnostics;
15 using static isometricparkfna.TileMap;
15 using static isometricparkfna.CellMap;
16 using isometricparkfna.Utils;
16 using isometricparkfna.Utils;
17 using isometricparkfna.UI;
17 using isometricparkfna.UI;
18
18
@@ -450,14 +450,8
450
450
451 }
451 }
452
452
453
453 protected float calculateDepth() {
454 protected void drawTileAt(int x, int y, int tileIndex, int height)
454 return ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
455 {
456 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
457
458 float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth);
459
460 drawTileAt(x, y, tileIndex, height, depthOffset);
461 }
455 }
462
456
463 protected Boolean cull(int gridX, int gridY)
457 protected Boolean cull(int gridX, int gridY)
@@ -472,73 +466,17
472 && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height)));
466 && MathUtils.Between(original.Y, -Tile.TileSpriteHeight, FNAGame.height)));
473 }
467 }
474
468
475 protected void drawTileAt(int x, int y, int tileIndex, int height, float depth)
469 //Convenience method I'm not super sure about anymore.
476 {
470 protected void drawTileAt(int x, int y, int tileIndex, int height)
471 {
472 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
477
473
478
474 float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth);
479 /*
480 Vector2 firstSquare = Vector2.Zero;
481 Vector2 squareOffset = Vector2.Zero;
482
475
483 int offsetX = (int)squareOffset.X;
476 Tile.drawTileAt(this.batch, x, y, tileIndex, height, depthOffset);
484 int offsetY = (int)squareOffset.Y;
477 }
485 int firstX = (int)firstSquare.X;
486 int firstY = (int)firstSquare.Y;
487 int rowOffset = 0;
488 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
489
478
490
479
491 int mapx = (firstX + x);
492 int mapy = (firstY + y);
493 float depthOffset = 0.7f - ((mapx + (mapy * Tile.TileWidth)) / maxdepth);
494
495 if ((firstY + y) % 2 == 1)
496 rowOffset = Tile.OddRowXOffset;
497
498 batch.Draw(
499 Tile.TileSetTexture,
500 new Rectangle(
501 (x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX,
502 (y * Tile.TileStepY) - offsetY + baseOffsetY-(Tile.TileHeight*(height-1)),
503 Tile.TileWidth, Tile.TileHeight*height),
504 Tile.GetExtendedSourceRectangle(tileIndex, height),
505 Color.White,
506 0.0f,
507 Vector2.Zero,
508 SpriteEffects.None,
509 depthOffset);
510 */
511
512 int height_adjust = 0;
513
514 if (height > 1) //not sure why this is necessary :/
515 {
516 height_adjust = height;
517 }
518
519 int adjustedx = x - height_adjust;
520 int adjustedy = y - height_adjust;
521
522 int screenx = (adjustedx - adjustedy) * Tile.TileSpriteWidth / 2;
523 int screeny = (adjustedx + adjustedy) * Tile.TileSpriteHeight / 2;
524
525 if (this.cull(x, y))
526 {
527 batch.Draw(
528 Tile.TileSetTexture,
529 new Rectangle(
530 screenx,
531 screeny,
532 Tile.TileWidth, Tile.TileHeight * height),
533 Tile.GetExtendedSourceRectangle(tileIndex, height),
534 Color.White,
535 0.0f,
536 Vector2.Zero,
537 SpriteEffects.None,
538 depth);
539 }
540
541 }
542
480
543 protected override void Draw(GameTime gameTime)
481 protected override void Draw(GameTime gameTime)
544 {
482 {
@@ -628,10 +566,7
628
566
629 this.tilesDrawn++;
567 this.tilesDrawn++;
630 }
568 }
631
632
633 }
569 }
634
635 }
570 }
636 #endregion draw_tiles
571 #endregion draw_tiles
637
572
@@ -708,26 +643,28
708 }
643 }
709 */
644 */
710
645
646 #if DEBUG
711 drawTileAt(4, 4, 140, 3);
647 drawTileAt(4, 4, 140, 3);
712 drawTileAt(6, 4, 141, 3);
648 drawTileAt(6, 4, 141, 3);
713 drawTileAt(8, 4, 142, 2);
649 drawTileAt(8, 4, 142, 2);
714 drawTileAt(10, 4, 142, 3);
650 drawTileAt(10, 4, 142, 3);
651 #endif
715
652
716 #region draw_cursor
653 #region draw_cursor
717 //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines
654 //drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines
718
655
719 //TODO figure out why it has to be -1
656 //TODO figure out why it has to be -1
720 if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth)
657 if (MathUtils.Between(this.mouseGrid.X, -1, this.simulation.map.MapWidth)
721 && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
658 && MathUtils.Between(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
722 {
659 {
723 OutlineSquare(this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1);
660 Tile.OutlineSquare(batch, this.mouseGrid.X, this.mouseGrid.Y, Color.Yellow, 1);
724 }
661 }
725
662
726 #if DEBUG
663 #if DEBUG
727 OutlineSquare(1, 1, Color.Red, 2);
664 Tile.OutlineSquare(batch, 1, 1, Color.Red, 2);
728 OutlineSquare(3, 1, Color.Blue, 2);
665 Tile.OutlineSquare(batch, 3, 1, Color.Blue, 2);
729 OutlineSquare(5, 1, Color.Green, 2);
666 Tile.OutlineSquare(batch, 5, 1, Color.Green, 2);
730 OutlineSquare(7, 1, Color.Orange, 2);
667 Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2);
731 #endif
668 #endif
732
669
733
670
@@ -894,41 +831,5
894
831
895 base.Draw(gameTime);
832 base.Draw(gameTime);
896 }
833 }
897 private void OutlineSquare(float x, float y, Color color)
834
898 {
899 this.OutlineSquare(x, y, color, 1);
900 }
901
902 private void OutlineSquare(float x, float y, Color color, int size)
903 {
904 Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved
905
906 //Upper right
907 //float x = this.mouseGrid.X;
908 //float y = this.mouseGrid.Y;
909 Line.drawLine(batch,
910 new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2,
911 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
912 new Vector2(((x - y + size) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2,
913 color, 0.79f);
914
915 //Bottom right
916 Line.drawLine(batch,
917 new Vector2(((x + size - y) * Tile.TileSpriteWidth / 2), (x + size + y) * Tile.TileSpriteHeight / 2) + adjust2,
918 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
919 new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
920 color, 0.79f);
921 //Bottom left
922 Line.drawLine(batch,
923 new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2,
924 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
925 new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
926 color, 0.79f);
927 //Upper left
928 Line.drawLine(batch,
929 new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2,
930 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
931 new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
932 color, 0.79f);
933 }
934 }
835 }
@@ -1,6 +1,6
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using static isometricparkfna.TileMap;
3 using static isometricparkfna.CellMap;
4
4
5 namespace isometricparkfna
5 namespace isometricparkfna
6 {
6 {
@@ -116,7 +116,7
116 }
116 }
117 }
117 }
118
118
119 public TileMap map;
119 public CellMap map;
120
120
121 public int ticksPerAdvance;
121 public int ticksPerAdvance;
122 private float lastAdvance;
122 private float lastAdvance;
@@ -132,7 +132,7
132
132
133 this.DateTime = new DateTime(START_YEAR, START_MONTH, START_DAY);
133 this.DateTime = new DateTime(START_YEAR, START_MONTH, START_DAY);
134
134
135 this.map = new TileMap(width, height);
135 this.map = new CellMap(width, height);
136 this.money = 100000;
136 this.money = 100000;
137 this.millisecondsPerAdvance = millisecondsPerAdvance;
137 this.millisecondsPerAdvance = millisecondsPerAdvance;
138
138
@@ -40,5 +40,126
40 return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height);
40 return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height);
41 }
41 }
42
42
43
44
45 static public void OutlineSquare(SpriteBatch batch, float x, float y, Color color)
46 {
47 Tile.OutlineSquare(batch, x, y, color, 1);
48 }
49
50 static public void OutlineSquare(SpriteBatch batch, float x, float y, Color color, int size)
51 {
52 Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved
53
54 //Upper right
55 //float x = this.mouseGrid.X;
56 //float y = this.mouseGrid.Y;
57
58 Line.drawLine(batch,
59 new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2,
60 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
61 new Vector2(((x - y + size) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2,
62 color, 0.79f);
63
64 //Bottom right
65 Line.drawLine(batch,
66 new Vector2(((x + size - y) * Tile.TileSpriteWidth / 2), (x + size + y) * Tile.TileSpriteHeight / 2) + adjust2,
67 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
68 new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
69 color, 0.79f);
70 //Bottom left
71 Line.drawLine(batch,
72 new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + y + size) * Tile.TileSpriteHeight / 2) + adjust2,
73 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
74 new Vector2(((x + size - (y + size)) * Tile.TileSpriteWidth / 2), (x + size + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
75 color, 0.79f);
76 //Upper left
77 Line.drawLine(batch,
78 new Vector2(((x - y) * Tile.TileSpriteWidth / 2), (x + y) * Tile.TileSpriteHeight / 2) + adjust2,
79 //new Vector2(this.squaresAcross * Tile.TileSpriteWidth, (y+1) * Tile.TileSpriteHeight),
80 new Vector2(((x - (y + size)) * Tile.TileSpriteWidth / 2), (x + (y + size)) * Tile.TileSpriteHeight / 2) + adjust2,
81 color, 0.79f);
82 }
83
84
85
86 // protected void drawTileAt(int x, int y, int tileIndex, int height)
87 // {
88 // float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
89
90 // float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth);
91
92 // Tile.drawTileAt(x, y, tileIndex, height, depthOffset);
93 // }
94
95
96
97 public static void drawTileAt(SpriteBatch batch, int x, int y, int tileIndex, int height, float depth)
98 {
99 /*
100 Vector2 firstSquare = Vector2.Zero;
101 Vector2 squareOffset = Vector2.Zero;
102
103 int offsetX = (int)squareOffset.X;
104 int offsetY = (int)squareOffset.Y;
105 int firstX = (int)firstSquare.X;
106 int firstY = (int)firstSquare.Y;
107 int rowOffset = 0;
108 float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10;
109
110
111 int mapx = (firstX + x);
112 int mapy = (firstY + y);
113 float depthOffset = 0.7f - ((mapx + (mapy * Tile.TileWidth)) / maxdepth);
114
115 if ((firstY + y) % 2 == 1)
116 rowOffset = Tile.OddRowXOffset;
117
118 batch.Draw(
119 Tile.TileSetTexture,
120 new Rectangle(
121 (x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX,
122 (y * Tile.TileStepY) - offsetY + baseOffsetY-(Tile.TileHeight*(height-1)),
123 Tile.TileWidth, Tile.TileHeight*height),
124 Tile.GetExtendedSourceRectangle(tileIndex, height),
125 Color.White,
126 0.0f,
127 Vector2.Zero,
128 SpriteEffects.None,
129 depthOffset);
130 */
131
132 int height_adjust = 0;
133
134 if (height > 1) //not sure why this is necessary :/
135 {
136 height_adjust = height;
137 }
138
139 int adjustedx = x - height_adjust;
140 int adjustedy = y - height_adjust;
141
142 int screenx = (adjustedx - adjustedy) * Tile.TileSpriteWidth / 2;
143 int screeny = (adjustedx + adjustedy) * Tile.TileSpriteHeight / 2;
144
145 // if (this.cull(x, y))
146 // {
147 batch.Draw(
148 Tile.TileSetTexture,
149 new Rectangle(
150 screenx,
151 screeny,
152 Tile.TileWidth, Tile.TileHeight * height),
153 Tile.GetExtendedSourceRectangle(tileIndex, height),
154 Color.White,
155 0.0f,
156 Vector2.Zero,
157 SpriteEffects.None,
158 depth);
159 // }
160
161 }
162
163
43 }
164 }
44 }
165 }
@@ -36,18 +36,15
36 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
37 </Compile>
37 </Compile>
38 <Compile Include="Tile.cs" />
38 <Compile Include="Tile.cs" />
39 <Compile Include="TileMap.cs" />
39 <Compile Include="CellMap.cs" />
40 <Compile Include="Line.cs" />
40 <Compile Include="Line.cs" />
41 <Compile Include="Camera.cs" />
41 <Compile Include="Camera.cs" />
42 <Compile Include="DrawVertDeclaration.cs" />
42 <Compile Include="DrawVertDeclaration.cs" />
43 <Compile Include="ImGuiRenderer.cs" />
43 <Compile Include="ImGuiRenderer.cs" />
44 <Compile Include="DebugWindow.cs" />
45 <Compile Include="FilledRectangle.cs" />
44 <Compile Include="FilledRectangle.cs" />
46 <Compile Include="Simulation.cs" />
45 <Compile Include="Simulation.cs" />
47 <Compile Include="Utils\MathUtils.cs" />
46 <Compile Include="Utils\MathUtils.cs" />
48 <Compile Include="Utils\Node.cs" />
47 <Compile Include="Utils\Node.cs" />
49 <Compile Include="Dialog.cs" />
50 <Compile Include="BudgetWindow.cs" />
51 <Compile Include="UI\BudgetWindow.cs" />
48 <Compile Include="UI\BudgetWindow.cs" />
52 <Compile Include="UI\DebugWindow.cs" />
49 <Compile Include="UI\DebugWindow.cs" />
53 <Compile Include="UI\Dialog.cs" />
50 <Compile Include="UI\Dialog.cs" />
You need to be logged in to leave comments. Login now