Point is IHashable

This commit is contained in:
Matt Thorson 2020-09-22 12:15:56 -07:00
parent 610ef2308f
commit 0203ffbef7
2 changed files with 18 additions and 1 deletions

View File

@ -14,6 +14,18 @@ namespace Strawberry
static public readonly String Root = "assets/"; static public readonly String Root = "assets/";
#endif #endif
static public String GetDir(String outStr, params String[] subDirectories)
{
outStr.Append(Root);
for (int i = 0; i < subDirectories.Count; i++)
{
outStr.Append(subDirectories[i]);
if (i < subDirectories.Count - 1)
outStr.Append(Path.DirectorySeparatorChar);
}
return outStr;
}
static public void LoadAll() static public void LoadAll()
{ {
Textures = new Dictionary<String, Texture>(); Textures = new Dictionary<String, Texture>();

View File

@ -2,7 +2,7 @@ using System;
namespace Strawberry namespace Strawberry
{ {
public struct Point public struct Point : IHashable
{ {
static public readonly Point Right = .(1, 0); static public readonly Point Right = .(1, 0);
static public readonly Point Left = .(-1, 0); static public readonly Point Left = .(-1, 0);
@ -104,5 +104,10 @@ namespace Strawberry
{ {
return .(a.X * (int)f, a.Y); return .(a.X * (int)f, a.Y);
} }
public int GetHashCode()
{
return X + 9973 * Y;
}
} }
} }