Implement hash proc for Godot types

This commit is contained in:
Ruslan Mustakov 2018-06-04 11:23:23 +07:00
commit 76de026b4f
15 changed files with 139 additions and 38 deletions

View file

@ -1,6 +1,6 @@
# Copyright (c) 2018 Xored Software, Inc.
import math
import math, hashes
import godotbase, godotcoretypes
{.push stackTrace: off.}
@ -21,6 +21,9 @@ proc `$`*(self: Vector3): string {.inline.} =
result.add($self.z)
result.add(')')
proc hash*(self: Vector3): Hash {.inline, noinit.} =
!$(self.x.hash() !& self.y.hash() !& self.z.hash())
proc `+`*(a, b: Vector3): Vector3 {.inline.} =
result.x = a.x + b.x
result.y = a.y + b.y