godot-nim/godot/core/rids.nim
Dwana Games 0fecfdb3b8 Updated to work with nim 0.20
- Attempt to fix deprecated this:self pragma by injecting self to methods and properties (needs more testing)
- Changed import headers to use / (slash) instead of . (period)
- Fixed object branch in godotapigen.nim
- Fixed deprecated nimNode.ident with nimNode.strVal

Fix toGodotName function

Consider procCall calls as special cases, otherwise it gives problems in _init function

Fix infinite recursive call in Godot 3.2
2019-09-15 15:34:09 +07:00

26 lines
666 B
Nim

# Copyright (c) 2018 Xored Software, Inc.
import hashes
import godotcoretypes, internal/godotinternaltypes, gdnativeapi
proc initRID*(): RID {.inline.} =
getGDNativeAPI().ridNew(result)
proc initRID*(obj: ptr GodotObject): RID {.inline.} =
getGDNativeAPI().ridNewWithResource(result, obj)
proc id*(self: RID): uint32 {.inline.} =
cast[uint32](getGDNativeAPI().ridGetId(self))
proc `$`*(self: RID): string {.inline.} =
$self.id
proc hash*(self: RID): Hash {.inline.} =
self.id.hash()
proc `==`*(a, b: RID): bool {.inline.} =
getGDNativeAPI().ridOperatorEqual(a, b)
proc `<`*(a, b: RID): bool {.inline.} =
getGDNativeAPI().ridOperatorLess(a, b)