Skip to content

Commit

Permalink
Fixed some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMcLean committed Nov 11, 2024
1 parent ba35d6a commit d8327ad
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Voxel2Pixel.Web/Components/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MudLink Href="" Color="Color.Inherit" Underline="Underline.None">
<MudText Typo="Typo.h6">Voxel2Pixel</MudText>
</MudLink>
<MudLink Href="" Match="NavLinkMatch.All"
<MudLink Href="" match="NavLinkMatch.All"
Color="@(IsCurrentPage("") || IsCurrentPage("/render") ? Color.Secondary : Color.Inherit)"
Underline="Underline.Hover"
Class="@(IsCurrentPage("") || IsCurrentPage("/render") ? "active-link" : "")">
Expand All @@ -27,7 +27,7 @@
</MudLink>
<MudLink Href="https://github.com/BenMcLean/Voxel2Pixel/blob/master/BenVoxel/README.md"
Target="_blank"
Rel="noopener noreferrer"
rel="noopener noreferrer"
Color="Color.Inherit"
Underline="Underline.Hover">
<div class="d-flex align-center">
Expand All @@ -37,7 +37,7 @@
</MudLink>
<MudLink Href="https://github.com/BenMcLean/Voxel2Pixel/"
Target="_blank"
Rel="noopener noreferrer"
rel="noopener noreferrer"
Color="Color.Inherit"
Underline="Underline.Hover">
<div class="d-flex align-center">
Expand Down
29 changes: 27 additions & 2 deletions Voxel2Pixel/Render/Sprite.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using RectpackSharp;
using BenVoxel;
using RectpackSharp;
using System;
using System.Buffers.Binary;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -11,7 +13,7 @@

namespace Voxel2Pixel.Render;

public class Sprite : Dictionary<string, Point>, ISprite, IRenderer, IVoxelColor
public class Sprite : IDictionary<string, Point>, ISprite, IRenderer, IVoxelColor
{
#region ISprite
public byte[] Texture { get; set; }
Expand Down Expand Up @@ -44,6 +46,29 @@ public Sprite SetRange(IEnumerable<KeyValuePair<string, Point>> points)
return this;
}
#endregion Sprite
#region IDictionary
private readonly SanitizedKeyDictionary<Point> _points = [];
public Point this[string key]
{
get => _points[key];
set => _points[key] = value;
}
public ICollection<string> Keys => _points.Keys;
public ICollection<Point> Values => _points.Values;
public int Count => _points.Count;
public bool IsReadOnly => _points.IsReadOnly;
public void Add(string key, Point value) => _points.Add(key, value);
public void Add(KeyValuePair<string, Point> item) => _points.Add(item);
public void Clear() => _points.Clear();
public bool Contains(KeyValuePair<string, Point> item) => _points.Contains(item);
public bool ContainsKey(string key) => _points.ContainsKey(key);
public void CopyTo(KeyValuePair<string, Point>[] array, int arrayIndex) => _points.CopyTo(array, arrayIndex);
public IEnumerator<KeyValuePair<string, Point>> GetEnumerator() => _points.GetEnumerator();
public bool Remove(string key) => _points.Remove(key);
public bool Remove(KeyValuePair<string, Point> item) => _points.Remove(item);
public bool TryGetValue(string key, out Point value) => _points.TryGetValue(key, out value);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion IDictionary
#region IVoxelColor
public IVoxelColor VoxelColor { get; set; }
public uint this[byte index, VisibleFace visibleFace = VisibleFace.Front] => VoxelColor[index, visibleFace];
Expand Down

0 comments on commit d8327ad

Please sign in to comment.