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, godotbase
import math, godotbase, hashes
import internal.godotinternaltypes, internal.godotstrings
import godotcoretypes, gdnativeapi
@ -16,6 +16,9 @@ proc vec2*(x, y: float32): Vector2 {.inline, noinit.} =
proc `$`*(self: Vector2): string {.inline, noinit.} =
$getGDNativeAPI().vector2AsString(self)
proc hash*(self: Vector2): Hash {.inline, noinit.} =
!$(self.x.hash() !& self.y.hash())
proc `+`*(self, other: Vector2): Vector2 {.inline, noinit.} =
Vector2(x: self.x + other.x, y: self.y + other.y)