small bug fixes

This commit is contained in:
Michele Scandura 2020-12-06 14:45:14 +00:00
parent fe3c0ed2cf
commit 32bc8274a2

View file

@ -187,7 +187,7 @@ namespace Sledgemapper
private void EditNote(Note note)
{
_state.SelectedNote = note;
_state.SelectedNote = new Note { X = note.X, Y = note.Y, Text = note.Text };
var noteWindow = new NoteWindow();
Window window = new()
@ -295,8 +295,8 @@ namespace Sledgemapper
}
if (newState.IsKeyDown(Keys.LeftControl)
&& mouseState.LeftButton == ButtonState.Pressed
&& ((mouseState.LeftButton != oldMouseState.LeftButton) || (_state.SelectedTile.X != _state.HoveredTile.X && _state.SelectedTile.Y != _state.HoveredTile.Y)))
&& mouseState.LeftButton == ButtonState.Released
&& mouseState.LeftButton != oldMouseState.LeftButton)
{
switch (_state.InsertMode)
{
@ -430,11 +430,11 @@ namespace Sledgemapper
_spriteBatch.Begin(transformMatrix: Matrix.CreateTranslation(_viewportCenter));
DrawTiles();
DrawGrid(visibleTilesX, visibleTilesY);
DrawWalls();
DrawOverlays();
DrawNotes();
DrawGrid(visibleTilesX, visibleTilesY);
if (string.IsNullOrWhiteSpace(_sessionData.SessionName))
@ -569,7 +569,7 @@ namespace Sledgemapper
if (_showCellNumbers && _state.TileSize >= 30)
{
var ffont = _fonts.Where(m => m.Key.Contains("awesome")).FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize / 8).Value ?? _fonts.Last().Value;
var ffont = _fonts.FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize / 8).Value ?? _fonts.Last().Value;
var fscale = 1f;
for (var i = -1; i < visibleTilesX + 2; i++)
@ -632,22 +632,28 @@ namespace Sledgemapper
foreach (var tile in _sessionData.Overlays.Values)
{
var content = Content.Load<Texture2D>($"overlays/{tile.ID}");
float posX;
float posY;
if (tile.Intersection)
{
var posX = tile.X * _state.TileSize;
var posY = tile.Y * _state.TileSize;
posX = tile.X * _state.TileSize;
posY = tile.Y * _state.TileSize;
_spriteBatch.Draw(content, new Vector2(posX, posY),
null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
_spriteBatch.Draw(content, new Vector2(posX + _state.TileSize / 25, posY + _state.TileSize / 25), null, Color.Black * .2f, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
_spriteBatch.Draw(content, new Vector2(posX, posY), null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
}
else
{
var posX = tile.X * _state.TileSize + _state.TileSize / 2f;
var posY = tile.Y * _state.TileSize + _state.TileSize / 2f;
posX = tile.X * _state.TileSize + _state.TileSize / 2f;
posY = tile.Y * _state.TileSize + _state.TileSize / 2f;
_spriteBatch.Draw(content, new Vector2(posX, posY),
null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
// _spriteBatch.Draw(content, new Vector2(posX, posY),null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
// _spriteBatch.Draw(content, new Vector2(posX, posY),null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
}
_spriteBatch.Draw(content, new Vector2(posX + _state.TileSize / 25, posY + _state.TileSize / 25), null, Color.Black * .2f, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
_spriteBatch.Draw(content, new Vector2(posX, posY), null, _settings.OverlayTintColor, MathHelper.ToRadians(90 * tile.Rotation), new Vector2(content.Width / 2, content.Height / 2), ((float)_state.TileSize - 10) / content.Width, SpriteEffects.None, 0);
}
}
@ -659,7 +665,7 @@ namespace Sledgemapper
var color = player.Color.ToColor();
_spriteBatch.DrawRectangle(new Rectangle(player.Position.X * _state.TileSize - 4, player.Position.Y * _state.TileSize - 4, _state.TileSize + 7, _state.TileSize + 7), color, 2);
var ffont = _fonts.Where(m => m.Key.Contains("awesome")).FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize).Value ?? _fonts.Last().Value;
var ffont = _fonts.FirstOrDefault(m => int.Parse(m.Key.Replace("font", "")) > _state.TileSize).Value ?? _fonts.Last().Value;
var fscale = _state.TileSize / ((float)ffont.LineSpacing * 2);
_spriteBatch.DrawString(ffont,