Use GDNative API struct

This commit is contained in:
Ruslan Mustakov 2017-10-04 23:41:15 +07:00
commit b62db02d8f
32 changed files with 2846 additions and 1535 deletions

View file

@ -1,7 +1,8 @@
# Copyright 2017 Xored Software, Inc.
import vector2, vector3, colors
import internal.godotpoolarrays, internal.godotstrings
import godotcoretypes
import internal.godotinternaltypes, internal.godotpoolarrays,
internal.godotstrings
template definePoolArrayBase(T, GodotT, DataT, fieldName, newProcName,
initProcName) =
@ -51,9 +52,6 @@ template definePoolArray(T, GodotT, DataT, fieldName, newProcName, initProcName;
proc add*(self: var T; data: DataT) {.inline.} =
self.fieldName.add(data)
proc addFirst*(self: var T, data: DataT) {.inline.} =
self.fieldName.addFirst(data)
proc insert*(self: var T; idx: int; data: DataT): Error {.inline.} =
self.fieldName.insert(idx.cint, data)
@ -93,7 +91,7 @@ definePoolArrayBase(PoolStringArray, GodotPoolStringArray, string,
godotPoolStringArray, newPoolStringArray,
initGodotPoolStringArray)
import godotbase, arrays
import arrays
definePoolArray(PoolByteArray, GodotPoolByteArray, uint8,
godotPoolByteArray, newPoolByteArray,
@ -122,11 +120,6 @@ proc add*(self: var PoolStringArray; data: string) =
self.godotPoolStringArray.add(s)
s.deinit()
proc addFirst*(self: var PoolStringArray, data: string) =
var s = data.toGodotString()
self.godotPoolStringArray.addFirst(s)
s.deinit()
proc insert*(self: var PoolStringArray; idx: int; data: string): Error =
var s = data.toGodotString()
result = self.godotPoolStringArray.insert(idx.cint, s)