Description:
Fix cursor overlay.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -23,7 +23,7 | |||
|
23 | 23 | private Song music; |
|
24 | 24 | private SpriteFont font; |
|
25 | 25 | |
|
26 | private Camera camera = new Camera(new float[] {0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); | |
|
26 | private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); | |
|
27 | 27 | |
|
28 | 28 | Random random_generator = new Random(); |
|
29 | 29 | |
@@ -160,14 +160,14 | |||
|
160 | 160 | } |
|
161 | 161 | |
|
162 | 162 | Vector2 calculateMousegrid(Vector2 normalizedMousePos) |
|
163 | { | |
|
163 | { | |
|
164 | 164 | |
|
165 | 165 | //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth); |
|
166 | 166 | //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight); |
|
167 | 167 | Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); |
|
168 | 168 | Vector2 adjustedMousePos = normalizedMousePos - adjust; |
|
169 | 169 | |
|
170 | float boardx = ((adjustedMousePos.X/ Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight)); | |
|
170 | float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight)); | |
|
171 | 171 | float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth)); |
|
172 | 172 | |
|
173 | 173 | |
@@ -238,21 +238,21 | |||
|
238 | 238 | } |
|
239 | 239 | |
|
240 | 240 | |
|
241 |
if (keyboardCur.IsKeyDown(Keys.Down) |
|
|
241 | if (keyboardCur.IsKeyDown(Keys.Down)) | |
|
242 | 242 | { |
|
243 | 243 | this.camera.Move(new Vector2(0, -2)); |
|
244 | 244 | } |
|
245 |
else if (keyboardCur.IsKeyDown(Keys.Up) |
|
|
246 | { | |
|
245 | else if (keyboardCur.IsKeyDown(Keys.Up)) | |
|
246 | { | |
|
247 | 247 | this.camera.Move(new Vector2(0, 2)); |
|
248 | 248 | |
|
249 | 249 | } |
|
250 |
else if (keyboardCur.IsKeyDown(Keys.Left) |
|
|
250 | else if (keyboardCur.IsKeyDown(Keys.Left)) | |
|
251 | 251 | { |
|
252 | 252 | this.camera.Move(new Vector2(-2, 0)); |
|
253 | 253 | |
|
254 | 254 | } |
|
255 |
else if (keyboardCur.IsKeyDown(Keys.Right) |
|
|
255 | else if (keyboardCur.IsKeyDown(Keys.Right)) | |
|
256 | 256 | { |
|
257 | 257 | this.camera.Move(new Vector2(2, 0)); |
|
258 | 258 | |
@@ -299,13 +299,13 | |||
|
299 | 299 | { |
|
300 | 300 | this.camera.Move(new Vector2(0, -4)); |
|
301 | 301 | } |
|
302 |
else if (MathUtils.Between(mouseCur.Y |
|
|
302 | else if (MathUtils.Between(mouseCur.Y, (FNAGame.height - 50), FNAGame.height)) | |
|
303 | 303 | { |
|
304 | 304 | this.camera.Move(new Vector2(0, 4)); |
|
305 | 305 | } |
|
306 | 306 | |
|
307 | 307 | |
|
308 | ||
|
308 | ||
|
309 | 309 | |
|
310 | 310 | this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); |
|
311 | 311 | |
@@ -333,7 +333,17 | |||
|
333 | 333 | |
|
334 | 334 | } |
|
335 | 335 | |
|
336 | ||
|
336 | 337 | protected void drawTileAt(int x, int y, int tileIndex, int height) |
|
338 | { | |
|
339 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; | |
|
340 | ||
|
341 | float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); | |
|
342 | ||
|
343 | drawTileAt(x, y, tileIndex, height, depthOffset); | |
|
344 | } | |
|
345 | ||
|
346 | protected void drawTileAt(int x, int y, int tileIndex, int height, float depth) | |
|
337 | 347 | { |
|
338 | 348 | /* |
|
339 | 349 | Vector2 firstSquare = Vector2.Zero; |
@@ -371,9 +381,6 | |||
|
371 | 381 | |
|
372 | 382 | int screenx = (x - y) * Tile.TileSpriteWidth / 2; |
|
373 | 383 | int screeny = (x + y) * Tile.TileSpriteHeight / 2; |
|
374 | float maxdepth = ((this.squaresAcross + 1) + ((this.squaresDown + 1) * Tile.TileWidth)) * 10; | |
|
375 | ||
|
376 | float depthOffset = 0.7f - ((0 + (0 * Tile.TileWidth)) / maxdepth); | |
|
377 | 384 | |
|
378 | 385 | batch.Draw( |
|
379 | 386 | Tile.TileSetTexture, |
@@ -386,7 +393,7 | |||
|
386 | 393 | 0.0f, |
|
387 | 394 | Vector2.Zero, |
|
388 | 395 | SpriteEffects.None, |
|
389 |
depth |
|
|
396 | depth); | |
|
390 | 397 | } |
|
391 | 398 | |
|
392 | 399 | protected override void Draw(GameTime gameTime) |
@@ -548,7 +555,7 | |||
|
548 | 555 | //drawTileAt(0, 0, 22, 1); |
|
549 | 556 | |
|
550 | 557 | |
|
551 | drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1); | |
|
558 | drawTileAt((int)this.mouseGrid.X, (int)this.mouseGrid.Y, 2, 1, 0.85f); //between tiles and gridlines | |
|
552 | 559 | |
|
553 | 560 | |
|
554 | 561 | /* |
You need to be logged in to leave comments.
Login now