diff --git a/godot.nimble b/godot.nimble index 15cf592..b81ad0e 100644 --- a/godot.nimble +++ b/godot.nimble @@ -1,4 +1,4 @@ -version = "0.5.10" +version = "0.6.0" author = "Xored Software, Inc." description = "Godot Engine bindings" license = "MIT" diff --git a/godot/core/arrays.nim b/godot/core/arrays.nim index 5157e50..414ac99 100644 --- a/godot/core/arrays.nim +++ b/godot/core/arrays.nim @@ -1,7 +1,7 @@ # Copyright 2017 Xored Software, Inc. import hashes -import internal.godotarrays +import internal.godotinternaltypes, internal.godotarrays type Array* = ref object @@ -125,8 +125,8 @@ proc delete*(self: var Array; idx: int) {.inline.} = proc setLen*(self: var Array; size: int) {.inline.} = self.godotArray.setLen(size.cint) -proc rfind*(self: Array; what: Variant; f: int): int {.inline.} = - self.godotArray.rfind(what.godotVariant[], f.cint).int +proc rfind*(self: Array; what: Variant; fromIdx: int): int {.inline.} = + self.godotArray.rfind(what.godotVariant[], fromIdx.cint).int proc len*(self: Array): int {.inline.} = self.godotArray.len.int diff --git a/godot/core/basis.nim b/godot/core/basis.nim index 75b2aab..6f7e9d9 100644 --- a/godot/core/basis.nim +++ b/godot/core/basis.nim @@ -2,10 +2,7 @@ import math import godotbase, vector3, quats - -type - Basis* {.byref.} = object - elements*: array[3, Vector3] +import godotcoretypes proc setCells*(basis: var Basis, xx, xy, xz, yx, yy, yz, zx, zy, zz: float32) = basis.elements[0].x = xx diff --git a/godot/core/colors.nim b/godot/core/colors.nim index 3d4376a..dedb1a2 100644 --- a/godot/core/colors.nim +++ b/godot/core/colors.nim @@ -1,11 +1,6 @@ # Copyright (c) 2017 Xored Software, Inc. -type - Color* {.byref.} = object - r*: float32 - g*: float32 - b*: float32 - a*: float32 +import godotcoretypes, gdnativeapi proc initColor*(r, g, b: float32; a: float32 = 1.0'f32): Color {.inline.} = Color( @@ -19,12 +14,14 @@ proc initColor*(): Color {.inline.} = ## Initializes black color with 1.0 alpha initColor(0, 0, 0) -proc h*(self: Color): float32 {. - importc: "godot_color_get_h".} -proc s*(self: Color): float32 {. - importc: "godot_color_get_s".} -proc v*(self: Color): float32 {. - importc: "godot_color_get_v".} +proc h*(self: Color): float32 {.inline.} = + getGDNativeAPI().colorGetH(self) + +proc s*(self: Color): float32 {.inline.} = + getGDNativeAPI().colorGetS(self) + +proc v*(self: Color): float32 {.inline.} = + getGDNativeAPI().colorGetV(self) proc `$`*(self: Color): string {.inline.} = result = newStringOfCap(50) @@ -58,16 +55,20 @@ proc toARGB32*(self: Color): uint32 {.inline.} = result = (result shl 8) or uint8(self.g * 255) result = (result shl 8) or uint8(self.b * 255) -proc gray*(self: Color): float32 {. - importc: "godot_color_gray".} -proc inverted*(self: Color): Color {. - importc: "godot_color_inverted".} -proc contrasted*(self: Color): Color {. - importc: "godot_color_contrasted".} -proc lerp*(self: Color; b: Color; t: float32): Color {. - importc: "godot_color_linear_interpolate".} -proc blend*(self: Color; over: Color): Color {. - importc: "godot_color_blend".} +proc gray*(self: Color): float32 {.inline.} = + getGDNativeAPI().colorGray(self) + +proc inverted*(self: Color): Color {.inline.} = + getGDNativeAPI().colorInverted(self) + +proc contrasted*(self: Color): Color {.inline.} = + getGDNativeAPI().colorContrasted(self) + +proc lerp*(self: Color; b: Color; t: float32): Color {.inline.} = + getGDNativeAPI().colorLinearInterpolate(self, b, t) + +proc blend*(self: Color; over: Color): Color {.inline.} = + getGDNativeAPI().colorBlend(self, over) proc `==`*(a, b: Color): bool {.inline.} = a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a diff --git a/godot/core/dictionaries.nim b/godot/core/dictionaries.nim index 1276c89..5445d27 100644 --- a/godot/core/dictionaries.nim +++ b/godot/core/dictionaries.nim @@ -1,8 +1,8 @@ # Copyright 2017 Xored Software, Inc. import hashes -import internal.godotstrings, internal.godotdictionaries, - internal.godotvariants +import internal.godotinternaltypes, internal.godotdictionaries, + internal.godotvariants, internal.godotstrings type Dictionary* = ref object diff --git a/godot/core/godotbase.nim b/godot/core/godotbase.nim index 0fda0cd..0f410b8 100644 --- a/godot/core/godotbase.nim +++ b/godot/core/godotbase.nim @@ -2,61 +2,6 @@ import math -type - Error* {.size: sizeof(cint), pure.} = enum - OK, - Failed, ## Generic fail error - Unavailable, ## What is requested is unsupported/unavailable - Unconfigured, ## The object being used hasnt been properly set up yet - Unauthorized, ## Missing credentials for requested resource - ParameterRangeError, ## Parameter given out of range (5) - OutOfMemory, ## Out of memory - FileNotFound, - FileBadDrive, - FileBadPath, - FileNoPermission, ## (10) - FileAlreadyInUse, - FileCantOpen, - FileCantWrite, - FileCantRead, - FileUnrecognized, ## (15) - FileCorrupt, - FileMissingDependencies, - FileEOF, - CantOpen, ## Can't open a resource/socket/file - CantCreate, ## (20) - QueryFailed, - AlreadyInUse, - Locked, ## resource is locked - Timeout, - CantConnect, ## (25) - CantResolve, - ConnectionError, - CantAquireResource, - CantFork, - InvalidData, ## Data passed is invalid (30) - InvalidParameter, ## Parameter passed is invalid - AlreadyExists, ## When adding, item already exists - DoesNotExist, ## When retrieving/erasing, it item does not exist - DatabaseCantRead, ## Database is full - DatabaseCantWrite, ## Database is full (35) - CompilationFailed, - MethodNotFound, - LinkFailed, - ScriptFailed, - CyclicLink, ## (40) - InvalidDeclaration, - DuplicateSymbol, - PauseError, - Busy, - Skip, ## (45) - Help, ## user requested help!! - Bug, - ## a bug in the software certainly happened, due to a double - ## check failing or unexpected behavior. - PrinterOnFire, ## the parallel port printer is engulfed in flames - WTF ## shit happens, has never been used, though - # math helpers const EPSILON = 0.00001'f32 diff --git a/godot/core/godotcoretypes.nim b/godot/core/godotcoretypes.nim new file mode 100644 index 0000000..8b92407 --- /dev/null +++ b/godot/core/godotcoretypes.nim @@ -0,0 +1,102 @@ +# Copyright 2017 Xored Software, Inc. + +type + Color* {.byref.} = object + r*: float32 + g*: float32 + b*: float32 + a*: float32 + + Vector3* {.byref.} = object + x*: float32 + y*: float32 + z*: float32 + + Vector2* {.byref.} = object + x*: float32 + y*: float32 + + Plane* {.byref.} = object + normal*: Vector3 + d*: float32 + + Basis* {.byref.} = object + elements*: array[3, Vector3] + + Quat* {.byref.} = object + x*: float32 + y*: float32 + z*: float32 + w*: float32 + + Rect3* {.byref.} = object + position*: Vector3 + size*: Vector3 + + Rect2* {.byref.} = object + position*: Vector2 + size*: Vector2 + + Transform2D* {.byref.} = object + elements*: array[3, Vector2] + + Transform* {.byref.} = object + basis*: Basis + origin*: Vector3 + + RID* {.byref.} = object + data: array[sizeof(int), byte] + + Error* {.size: sizeof(cint), pure.} = enum + OK, + Failed, ## Generic fail error + Unavailable, ## What is requested is unsupported/unavailable + Unconfigured, ## The object being used hasnt been properly set up yet + Unauthorized, ## Missing credentials for requested resource + ParameterRangeError, ## Parameter given out of range (5) + OutOfMemory, ## Out of memory + FileNotFound, + FileBadDrive, + FileBadPath, + FileNoPermission, ## (10) + FileAlreadyInUse, + FileCantOpen, + FileCantWrite, + FileCantRead, + FileUnrecognized, ## (15) + FileCorrupt, + FileMissingDependencies, + FileEOF, + CantOpen, ## Can't open a resource/socket/file + CantCreate, ## (20) + QueryFailed, + AlreadyInUse, + Locked, ## resource is locked + Timeout, + CantConnect, ## (25) + CantResolve, + ConnectionError, + CantAquireResource, + CantFork, + InvalidData, ## Data passed is invalid (30) + InvalidParameter, ## Parameter passed is invalid + AlreadyExists, ## When adding, item already exists + DoesNotExist, ## When retrieving/erasing, it item does not exist + DatabaseCantRead, ## Database is full + DatabaseCantWrite, ## Database is full (35) + CompilationFailed, + MethodNotFound, + LinkFailed, + ScriptFailed, + CyclicLink, ## (40) + InvalidDeclaration, + DuplicateSymbol, + PauseError, + Busy, + Skip, ## (45) + Help, ## user requested help!! + Bug, + ## a bug in the software certainly happened, due to a double + ## check failing or unexpected behavior. + PrinterOnFire, ## the parallel port printer is engulfed in flames + WTF ## shit happens, has never been used, though diff --git a/godot/core/nodepaths.nim b/godot/core/nodepaths.nim index 3bdd41d..62e30f8 100644 --- a/godot/core/nodepaths.nim +++ b/godot/core/nodepaths.nim @@ -1,6 +1,7 @@ # Copyright 2017 Xored Software, Inc. -import internal.godotnodepaths, internal.godotstrings +import internal.godotinternaltypes, internal.godotnodepaths, + internal.godotstrings type NodePath* = ref object diff --git a/godot/core/planes.nim b/godot/core/planes.nim index 4c6ead5..360953f 100644 --- a/godot/core/planes.nim +++ b/godot/core/planes.nim @@ -2,72 +2,59 @@ import vector3 -import internal.godotstrings +import internal.godotinternaltypes, godotcoretypes, gdnativeapi -type - Plane* {.byref.} = object - normal*: Vector3 - d*: float32 +proc initPlane*(a, b, c, d: float32): Plane {.inline.} = + getGDNativeAPI().planeNewWithReals(result, a, b, c, d) -proc initPlane(dest: var Plane; a, b, c, d: float32) {. - importc: "godot_plane_new_with_reals".} -proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {. - importc: "godot_plane_new_with_vectors".} -proc initPlane(dest: var Plane; normal: Vector3; d: float32) {. - importc: "godot_plane_new_with_normal".} +proc initPlane*(v1, v2, v3: Vector3): Plane {.inline.} = + getGDNativeAPI().planeNewWithVectors(result, v1, v2, v3) -proc initPlane*(a, b, c, d: float32): Plane = - initPlane(result, a, b, c, d) - -proc initPlane*(v1, v2, v3: Vector3): Plane = - initPlane(result, v1, v2, v3) - -proc initPlane*(normal: Vector3; d: float32): Plane = - initPlane(result, normal, d) - -proc toGodotString(self: Plane): GodotString {. - noSideEffect, - importc: "godot_plane_as_string".} +proc initPlane*(normal: Vector3; d: float32): Plane {.inline.} = + result = Plane( + normal: normal, + d: d + ) proc `$`*(self: Plane): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().planeAsString(self) + +proc normalized*(self: Plane): Plane {.inline.} = + getGDNativeAPI().planeNormalized(self) + +proc center*(self: Plane): Vector3 {.inline.} = + getGDNativeAPI().planeCenter(self) + +proc getAnyPoint*(self: Plane): Vector3 {.inline.} = + getGDNativeAPI().planeGetAnyPoint(self) + +proc isPointOver*(self: Plane; point: Vector3): bool {.inline.} = + getGDNativeAPI().planeIsPointOver(self, point) + +proc distanceTo*(self: Plane; point: Vector3): float32 {.inline.} = + getGDNativeAPI().planeDistanceTo(self, point) -proc normalized*(self: Plane): Plane {. - noSideEffect, - importc: "godot_plane_normalized".} -proc center*(self: Plane): Vector3 {. - noSideEffect, - importc: "godot_plane_center".} -proc getAnyPoint*(self: Plane): Vector3 {. - noSideEffect, - importc: "godot_plane_get_any_point".} -proc isPointOver*(self: Plane; point: Vector3): bool {. - noSideEffect, - importc: "godot_plane_is_point_over".} -proc distanceTo*(self: Plane; point: Vector3): float32 {. - noSideEffect, - importc: "godot_plane_distance_to".} proc contains*(self: Plane; point: Vector3; - epsilon: float32): bool {. - noSideEffect, - importc: "godot_plane_has_point".} -proc project*(self: Plane; point: Vector3): Vector3 {. - noSideEffect, - importc: "godot_plane_project".} + epsilon: float32): bool {.inline.} = + getGDNativeAPI().planeHasPoint(self, point, epsilon) + +proc project*(self: Plane; point: Vector3): Vector3 {.inline.} = + getGDNativeAPI().planeProject(self, point) + proc intersect3*(self: Plane; dest: var Vector3; - b, c: Plane): bool {. - noSideEffect, - importc: "godot_plane_intersect_3".} + b, c: Plane): bool {.inline.} = + getGDNativeAPI().planeIntersect3(self, dest, b, c) + proc intersectsRay*(self: Plane; dest: var Vector3; - v, dir: Vector3): bool {. - noSideEffect, - importc: "godot_plane_intersects_ray".} + v, dir: Vector3): bool {.inline.} = + getGDNativeAPI().planeIntersectsRay(self, dest, v, dir) + proc intersectsSegment*(self: Plane; dest: var Vector3; - segmentBegin, segmentEnd: Vector3): bool {. - noSideEffect, importc: "godot_plane_intersects_segment".} -proc `-`*(self: Plane): Plane {. - noSideEffect, - importc: "godot_plane_operator_neg".} -proc `==`*(a, b: Plane): bool {. - noSideEffect, - importc: "godot_plane_operator_equal".} + segmentBegin, segmentEnd: Vector3): bool {.inline.} = + getGDNativeAPI().planeIntersectsSegment(self, dest, segmentBegin, segmentEnd) + +proc `-`*(self: Plane): Plane {.inline.} = + getGDNativeAPI().planeOperatorNeg(self) + +proc `==`*(a, b: Plane): bool {.inline.} = + getGDNativeAPI().planeOperatorEqual(a, b) diff --git a/godot/core/poolarrays.nim b/godot/core/poolarrays.nim index bb263d2..dd3f544 100644 --- a/godot/core/poolarrays.nim +++ b/godot/core/poolarrays.nim @@ -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) diff --git a/godot/core/quats.nim b/godot/core/quats.nim index 9e12d55..016bbd0 100644 --- a/godot/core/quats.nim +++ b/godot/core/quats.nim @@ -1,91 +1,78 @@ # Copyright (c) 2017 Xored Software, Inc. -import vector3 -import internal.godotstrings - -type - Quat* {.byref.} = object - x*: float32 - y*: float32 - z*: float32 - w*: float32 - -proc initQuat(dest: var Quat; x, y, z, w: float32) {. - importc: "godot_quat_new".} -proc initQuat(dest: var Quat; axis: Vector3; angle: float32) {. - importc: "godot_quat_new_with_axis_angle".} +import internal.godotinternaltypes, godotcoretypes, gdnativeapi proc initQuat*(x, y, z, w: float32): Quat {.inline.} = - initQuat(result, x, y, z, w) + result = Quat( + x: x, + y: y, + z: z, + w: w + ) proc initQuat*(axis: Vector3; angle: float32): Quat {.inline.} = - initQuat(result, axis, angle) - -proc toGodotString(self: Quat): GodotString {. - noSideEffect, - importc: "godot_quat_as_string".} + getGDNativeAPI().quatNewWithAxisAngle(result, axis, angle) proc `$`*(self: Quat): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().quatAsString(self) + +proc length*(self: Quat): float32 {.inline.} = + getGDNativeAPI().quatLength(self) + +proc lengthSquared*(self: Quat): float32 {.inline.} = + getGDNativeAPI().quatLengthSquared(self) + +proc normalized*(self: Quat): Quat {.inline.} = + getGDNativeAPI().quatNormalized(self) + +proc isNormalized*(self: Quat): bool {.inline.} = + getGDNativeAPI().quatIsNormalized(self) + +proc inverse*(self: Quat): Quat {.inline.} = + getGDNativeAPI().quatInverse(self) + +proc dot*(a, b: Quat): float32 {.inline.} = + getGDNativeAPI().quatDot(a, b) + +proc xform*(self: Quat; v: Vector3): Vector3 {.inline.} = + getGDNativeAPI().quatXform(self, v) + +proc slerp*(self: Quat; b: Quat; t: float32): Quat {.inline.} = + getGDNativeAPI().quatSlerp(self, b, t) + +proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.inline.} = + getGDNativeAPI().quatSlerpni(self, b, t) + +proc cubicSlerp*(self, b, preA, postB: Quat; + t: float32): Quat {.inline.} = + getGDNativeAPI().quatCubicSlerp(self, b, preA, postB, t) + +proc `*`*(a: Quat, b: float32): Quat {.inline.} = + getGDNativeAPI().quatOperatorMultiply(a, b) -proc length*(self: Quat): float32 {. - noSideEffect, - importc: "godot_quat_length".} -proc lengthSquared*(self: Quat): float32 {. - noSideEffect, - importc: "godot_quat_length_squared".} -proc normalized*(self: Quat): Quat {. - noSideEffect, - importc: "godot_quat_normalized".} -proc isNormalized*(self: Quat): bool {. - noSideEffect, - importc: "godot_quat_is_normalized".} -proc inverse*(self: Quat): Quat {. - noSideEffect, - importc: "godot_quat_inverse".} -proc dot*(a, b: Quat): float32 {. - noSideEffect, - importc: "godot_quat_dot".} -proc xform*(self: Quat; v: Vector3): Vector3 {. - noSideEffect, - importc: "godot_quat_xform".} -proc slerp*(self: Quat; b: Quat; t: float32): Quat {. - noSideEffect, - importc: "godot_quat_slerp".} -proc slerpni*(self: Quat; b: Quat; t: float32): Quat {. - noSideEffect, - importc: "godot_quat_slerpni".} -proc cubicSlerp*(self, b, pre_a, post_b: Quat; - t: float32): Quat {. - noSideEffect, - importc: "godot_quat_cubic_slerp".} -proc `*`*(a: Quat, b: float32): Quat {. - noSideEffect, - importc: "godot_quat_operator_multiply".} proc `*=`*(a: var Quat, b: float32) {.inline.} = a = a * b -proc `+`*(a, b: Quat): Quat {. - noSideEffect, - importc: "godot_quat_operator_add".} +proc `+`*(a, b: Quat): Quat {.inline.} = + getGDNativeAPI().quatOperatorAdd(a, b) + proc `+=`*(a: var Quat, b: Quat) {.inline.} = a = a + b -proc `-`*(a, b: Quat): Quat {. - noSideEffect, - importc: "godot_quat_operator_substract".} +proc `-`*(a, b: Quat): Quat {.inline.} = + getGDNativeAPI().quatOperatorSubtract(a, b) + proc `-=`* (a: var Quat, b: Quat) {.inline.} = a = a - b -proc `/`*(self: Quat; b: float32): Quat {. - noSideEffect, - importc: "godot_quat_operator_divide".} +proc `/`*(self: Quat; b: float32): Quat {.inline.} = + getGDNativeAPI().quatOperatorDivide(self, b) + proc `/=`*(self: var Quat, b: float32) {.inline.} = self = self / b -proc `==`*(a, b: Quat): bool {. - noSideEffect, - importc: "godot_quat_operator_equal".} -proc `-`*(self: Quat): Quat {. - noSideEffect, - importc: "godot_quat_operator_neg".} +proc `==`*(a, b: Quat): bool {.inline.} = + getGDNativeAPI().quatOperatorEqual(a, b) + +proc `-`*(self: Quat): Quat {.inline.} = + getGDNativeAPI().quatOperatorNeg(self) diff --git a/godot/core/rect2.nim b/godot/core/rect2.nim index d2192b1..628e203 100644 --- a/godot/core/rect2.nim +++ b/godot/core/rect2.nim @@ -1,13 +1,7 @@ # Copyright (c) 2017 Xored Software, Inc. import vector2 - -import internal.godotstrings - -type - Rect2* {.byref.} = object - position*: Vector2 - size*: Vector2 +import godotcoretypes, internal.godotinternaltypes, gdnativeapi proc initRect2*(pos, size: Vector2): Rect2 {.inline.} = Rect2(position: pos, size: size) @@ -15,40 +9,35 @@ proc initRect2*(pos, size: Vector2): Rect2 {.inline.} = proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} = Rect2(position: vec2(x, y), size: vec2(sizeX, sizeY)) -proc toGodotString(self: Rect2): GodotString {. - noSideEffect, - importc: "godot_rect2_as_string".} - proc `$`*(self: Rect2): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().rect2AsString(self) -proc area*(self: Rect2): float32 {. - noSideEffect, - importc: "godot_rect2_get_area".} -proc intersects*(a, b: Rect2): bool {. - noSideEffect, - importc: "godot_rect2_intersects".} -proc encloses*(a, b: Rect2): bool {. - noSideEffect, - importc: "godot_rect2_encloses".} -proc hasNoArea*(self: Rect2): bool {. - noSideEffect, - importc: "godot_rect2_has_no_area".} -proc clip*(a, b: Rect2): Rect2 {. - noSideEffect, - importc: "godot_rect2_clip".} -proc merge*(a, b: Rect2): Rect2 {. - noSideEffect, - importc: "godot_rect2_merge".} -proc contains*(self: Rect2; point: Vector2): bool {. - noSideEffect, - importc: "godot_rect2_has_point".} -proc grow*(self: Rect2; by: float32): Rect2 {. - noSideEffect, - importc: "godot_rect2_grow".} -proc expand*(self: Rect2; to: Vector2): Rect2 {. - noSideEffect, - importc: "godot_rect2_expand".} -proc `==`*(a, b: Rect2): bool {. - noSideEffect, - importc: "godot_rect2_operator_equal".} +proc area*(self: Rect2): float32 {.inline.} = + getGDNativeAPI().rect2GetArea(self) + +proc intersects*(a, b: Rect2): bool {.inline.} = + getGDNativeAPI().rect2Intersects(a, b) + +proc encloses*(a, b: Rect2): bool {.inline.} = + getGDNativeAPI().rect2Encloses(a, b) + +proc hasNoArea*(self: Rect2): bool {.inline.} = + getGDNativeAPI().rect2HasNoArea(self) + +proc clip*(self, b: Rect2): Rect2 {.inline.} = + getGDNativeAPI().rect2Clip(self, b) + +proc merge*(self, b: Rect2): Rect2 {.inline.} = + getGDNativeAPI().rect2Merge(self, b) + +proc contains*(self: Rect2; point: Vector2): bool {.inline.} = + getGDNativeAPI().rect2HasPoint(self, point) + +proc grow*(self: Rect2; by: float32): Rect2 {.inline.} = + getGDNativeAPI().rect2Grow(self, by) + +proc expand*(self: Rect2; to: Vector2): Rect2 {.inline.} = + getGDNativeAPI().rect2Expand(self, to) + +proc `==`*(a, b: Rect2): bool {.inline.} = + getGDNativeAPI().rect2OperatorEqual(a, b) diff --git a/godot/core/rect3.nim b/godot/core/rect3.nim index c695ce9..7a2ef72 100644 --- a/godot/core/rect3.nim +++ b/godot/core/rect3.nim @@ -1,84 +1,72 @@ # Copyright (c) 2017 Xored Software, Inc. -import planes, vector3 - -import internal.godotstrings - -type - Rect3* {.byref.} = object - position*: Vector3 - size*: Vector3 +import godotcoretypes, internal.godotinternaltypes, gdnativeapi proc initRect3*(pos, size: Vector3): Rect3 {.inline.} = Rect3(position: pos, size: size) -proc toGodotString(self: Rect3): GodotString {. - noSideEffect, - importc: "godot_rect3_as_string".} - proc `$`*(self: Rect3): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().rect3AsString(self) -proc area*(self: Rect3): float32 {. - noSideEffect, - importc: "godot_rect3_get_area".} -proc hasNoArea*(self: Rect3): bool {. - noSideEffect, - importc: "godot_rect3_has_no_area".} -proc hasNoSurface*(self: Rect3): bool {. - noSideEffect, - importc: "godot_rect3_has_no_surface".} -proc intersects*(a, b: Rect3): bool {. - noSideEffect, - importc: "godot_rect3_intersects".} -proc encloses*(self, other: Rect3): bool {. - noSideEffect, - importc: "godot_rect3_encloses".} -proc merge*(self, other: Rect3): Rect3 {. - noSideEffect, - importc: "godot_rect3_merge".} -proc intersection*(self, other: Rect3): Rect3 {. - noSideEffect, - importc: "godot_rect3_intersection".} -proc intersectsPlane*(self: Rect3; plane: Plane): bool {. - noSideEffect, - importc: "godot_rect3_intersects_plane".} -proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {. - noSideEffect, - importc: "godot_rect3_intersects_segment".} -proc contains*(self: Rect3; point: Vector3): bool {. - noSideEffect, - importc: "godot_rect3_has_point".} -proc getSupport*(self: Rect3; dir: Vector3): Vector3 {. - noSideEffect, - importc: "godot_rect3_get_support".} -proc getLongestAxis*(self: Rect3): Vector3 {. - noSideEffect, - importc: "godot_rect3_get_longest_axis".} -proc getLongestAxisIndex*(self: Rect3): cint {. - noSideEffect, - importc: "godot_rect3_get_longest_axis_index".} -proc getLongestAxisSize*(self: Rect3): float32 {. - noSideEffect, - importc: "godot_rect3_get_longest_axis_size".} -proc getShortestAxis*(self: Rect3): Vector3 {. - noSideEffect, - importc: "godot_rect3_get_shortest_axis".} -proc getShortestAxisIndex*(self: Rect3): cint {. - noSideEffect, - importc: "godot_rect3_get_shortest_axis_index".} -proc getShortestAxisSize*(self: Rect3): float32 {. - noSideEffect, - importc: "godot_rect3_get_shortest_axis_size".} -proc expand*(self: Rect3; toPoint: Vector3): Rect3 {. - noSideEffect, - importc: "godot_rect3_expand".} -proc grow*(self: Rect3; by: float32): Rect3 {. - noSideEffect, - importc: "godot_rect3_grow".} -proc getEndpoint*(self: Rect3; idx: cint): Vector3 {. - noSideEffect, - importc: "godot_rect3_get_endpoint".} -proc `==`*(a, b: Rect3): bool {. - noSideEffect, - importc: "godot_rect3_operator_equal".} +proc area*(self: Rect3): float32 {.inline.} = + getGDNativeAPI().rect3GetArea(self) + +proc hasNoArea*(self: Rect3): bool {.inline.} = + getGDNativeAPI().rect3HasNoArea(self) + +proc hasNoSurface*(self: Rect3): bool {.inline.} = + getGDNativeAPI().rect3HasNoSurface(self) + +proc intersects*(self, other: Rect3): bool {.inline.} = + getGDNativeAPI().rect3Intersects(self, other) + +proc encloses*(self, other: Rect3): bool {.inline.} = + getGDNativeAPI().rect3Encloses(self, other) + +proc merge*(self, other: Rect3): Rect3 {.inline.} = + getGDNativeAPI().rect3Merge(self, other) + +proc intersection*(self, other: Rect3): Rect3 {.inline.} = + getGDNativeAPI().rect3Intersection(self, other) + +proc intersectsPlane*(self: Rect3; plane: Plane): bool {.inline.} = + getGDNativeAPI().rect3IntersectsPlane(self, plane) + +proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.inline.} = + getGDNativeAPI().rect3IntersectsSegment(self, start, to) + +proc contains*(self: Rect3; point: Vector3): bool {.inline.} = + getGDNativeAPI().rect3HasPoint(self, point) + +proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.inline.} = + getGDNativeAPI().rect3GetSupport(self, dir) + +proc getLongestAxis*(self: Rect3): Vector3 {.inline.} = + getGDNativeAPI().rect3GetLongestAxis(self) + +proc getLongestAxisIndex*(self: Rect3): cint {.inline.} = + getGDNativeAPI().rect3GetLongestAxisIndex(self) + +proc getLongestAxisSize*(self: Rect3): float32 {.inline.} = + getGDNativeAPI().rect3GetLongestAxisSize(self) + +proc getShortestAxis*(self: Rect3): Vector3 {.inline.} = + getGDNativeAPI().rect3GetShortestAxis(self) + +proc getShortestAxisIndex*(self: Rect3): cint {.inline.} = + getGDNativeAPI().rect3GetShortestAxisIndex(self) + +proc getShortestAxisSize*(self: Rect3): float32 {.inline.} = + getGDNativeAPI().rect3GetShortestAxisSize(self) + +proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.inline.} = + getGDNativeAPI().rect3Expand(self, toPoint) + +proc grow*(self: Rect3; by: float32): Rect3 {.inline.} = + getGDNativeAPI().rect3Grow(self, by) + +proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.inline.} = + getGDNativeAPI().rect3GetEndpoint(self, idx) + +proc `==`*(a, b: Rect3): bool {.inline.} = + getGDNativeAPI().rect3OperatorEqual(a, b) diff --git a/godot/core/rids.nim b/godot/core/rids.nim index 6ec5b86..a113f60 100644 --- a/godot/core/rids.nim +++ b/godot/core/rids.nim @@ -1,31 +1,21 @@ -import internal.godotobjects +# Copyright (c) 2017 Xored Software, Inc. -type - RID* {.byref.} = object - data: array[sizeof(int), byte] - -proc initRID(dest: var RID) {. - importc: "godot_rid_new".} -proc initRID(dest: var RID; obj: ptr GodotObject) {. - importc: "godot_rid_new_with_resource".} +import godotcoretypes, internal.godotinternaltypes, gdnativeapi proc initRID*(): RID {.inline.} = - initRID(result) + getGDNativeAPI().ridNew(result) proc initRID*(obj: ptr GodotObject): RID {.inline.} = - initRID(result, obj) - -proc idCInt(self: RID): cint {. - noSideEffect, - importc: "godot_rid_get_id".} + getGDNativeAPI().ridNewWithResource(result, obj) proc id*(self: RID): uint32 {.inline.} = - cast[uint32](self.idCInt()) + cast[uint32](getGDNativeAPI().ridGetId(self)) -proc `$`*(self: RID): string = +proc `$`*(self: RID): string {.inline.} = $self.id -proc `==`*(a, b: RID): bool {. - importc: "godot_rid_operator_equal".} -proc `<`*(a, b: RID): bool {. - importc: "godot_rid_operator_less".} +proc `==`*(a, b: RID): bool {.inline.} = + getGDNativeAPI().ridOperatorEqual(a, b) + +proc `<`*(a, b: RID): bool {.inline.} = + getGDNativeAPI().ridOperatorLess(a, b) diff --git a/godot/core/transform2d.nim b/godot/core/transform2d.nim index fece240..67222c6 100644 --- a/godot/core/transform2d.nim +++ b/godot/core/transform2d.nim @@ -1,76 +1,73 @@ # Copyright (c) 2017 Xored Software, Inc. -import vector2, rect2 - -import internal.godotstrings - -type - Transform2D* {.byref.} = object - elements*: array[3, Vector2] - -proc initTransform2D(dest: var Transform2D) {. - importc: "godot_transform2d_new_identity".} -proc initTransform2D(dest: var Transform2D; rot: float32; pos: Vector2) {. - importc: "godot_transform2d_new".} -proc initTransform2D(dest: var Transform2D; xAxis, yAxis, origin: Vector2) {. - importc: "godot_transform2d_new_axis_origin".} +import godotcoretypes, internal.godotinternaltypes, gdnativeapi proc initTransform2D*(): Transform2D {.inline.} = - initTransform2D(result) + getGDNativeAPI().transform2DNewIdentity(result) proc initTransform2D*(rot: float32; pos: Vector2): Transform2D {.inline.} = - initTransform2D(result, rot, pos) + getGDNativeAPI().transform2DNew(result, rot, pos) proc initTransform2D*(xAxis, yAxis, origin: Vector2): Transform2D {.inline.} = - initTransform2D(result, xAxis, yAxis, origin) - -proc toGodotString(self: Transform2D): GodotString {. - importc: "godot_transform2d_as_string".} + getGDNativeAPI().transform2DNewAxisOrigin(result, xAxis, yAxis, origin) proc `$`*(self: Transform2D): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().transform2DAsString(self) -proc inverse*(self: Transform2D): Transform2D {. - importc: "godot_transform2d_inverse".} -proc affineInverse*(self: Transform2D): Transform2D {. - importc: "godot_transform2d_affine_inverse".} -proc rotation*(self: Transform2D): float32 {. - importc: "godot_transform2d_get_rotation".} -proc origin*(self: Transform2D): Vector2 {. - importc: "godot_transform2d_get_origin".} -proc scale*(self: Transform2D): Vector2 {. - importc: "godot_transform2d_get_scale".} -proc orthonormalized*(self: Transform2D): Transform2D {. - importc: "godot_transform2d_orthonormalized".} -proc rotated*(self: Transform2D; phi: float32): Transform2D {. - importc: "godot_transform2d_rotated".} -proc scaled*(self: Transform2D; scale: Vector2): Transform2D {. - importc: "godot_transform2d_scaled".} -proc translated*(self: Transform2D; - offset: Vector2): Transform2D {. - importc: "godot_transform2d_translated".} -proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {. - importc: "godot_transform2d_xform_vector2".} -proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {. - importc: "godot_transform2d_xform_inv_vector2".} -proc basisXformVector2*(self: Transform2D; - v: Vector2): Vector2 {. - importc: "godot_transform2d_basis_xform_vector2".} -proc basisXformInvVector2*(self: Transform2D; - v: Vector2): Vector2 {. - importc: "godot_transform2d_basis_xform_inv_vector2".} -proc xformRect2*(self: Transform2D; v: Rect2): Rect2 {. - importc: "godot_transform2d_xform_rect2".} -proc xformInvRect2*(self: Transform2D; v: Rect2): Rect2 {. - importc: "godot_transform2d_xform_inv_rect2".} +proc inverse*(self: Transform2D): Transform2D {.inline.} = + getGDNativeAPI().transform2DInverse(self) + +proc affineInverse*(self: Transform2D): Transform2D {.inline.} = + getGDNativeAPI().transform2DAffineInverse(self) + +proc rotation*(self: Transform2D): float32 {.inline.} = + getGDNativeAPI().transform2DGetRotation(self) + +proc origin*(self: Transform2D): Vector2 {.inline.} = + getGDNativeAPI().transform2DGetOrigin(self) + +proc scale*(self: Transform2D): Vector2 {.inline.} = + getGDNativeAPI().transform2DGetScale(self) + +proc orthonormalized*(self: Transform2D): Transform2D {.inline.} = + getGDNativeAPI().transform2DOrthonormalized(self) + +proc rotated*(self: Transform2D; phi: float32): Transform2D {.inline.} = + getGDNativeAPI().transform2DRotated(self, phi) + +proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.inline.} = + getGDNativeAPI().transform2DScaled(self, scale) + +proc translated*(self: Transform2D; offset: Vector2): Transform2D {.inline.} = + getGDNativeAPI().transform2DTranslated(self, offset) + +proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} = + getGDNativeAPI().transform2DXformVector2(self, v) + +proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} = + getGDNativeAPI().transform2DXformInvVector2(self, v) + +proc basisXformVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} = + getGDNativeAPI().transform2DBasisXformVector2(self, v) + +proc basisXformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.inline.} = + getGDNativeAPI().transform2DBasisXformInvVector2(self, v) + +proc xformRect2*(self: Transform2D; rect: Rect2): Rect2 {.inline.} = + getGDNativeAPI().transform2DXformRect2(self, rect) + +proc xformInvRect2*(self: Transform2D; rect: Rect2): Rect2 {.inline.} = + getGDNativeAPI().transform2DXformInvRect2(self, rect) proc interpolateWith*(self, m: Transform2D; - c: float32): Transform2D {. - importc: "godot_transform2d_interpolate_with".} -proc `==`*(a, b: Transform2D): bool {. - importc: "godot_transform2d_operator_equal".} -proc `*`*(a, b: Transform2D): Transform2D {. - importc: "godot_transform2d_operator_multiply".} + c: float32): Transform2D {.inline.} = + getGDNativeAPI().transform2DInterpolateWith(self, m, c) + +proc `==`*(a, b: Transform2D): bool {.inline.} = + getGDNativeAPI().transform2DOperatorEqual(a, b) + +proc `*`*(a, b: Transform2D): Transform2D {.inline.} = + getGDNativeAPI().transform2DOperatorMultiply(a, b) proc `*=`*(a: var Transform2D, b: Transform2D) {.inline.} = a = a * b diff --git a/godot/core/transforms.nim b/godot/core/transforms.nim index 7765ab3..550136c 100644 --- a/godot/core/transforms.nim +++ b/godot/core/transforms.nim @@ -1,13 +1,7 @@ # Copyright (c) 2017 Xored Software, Inc. -import basis, vector3, planes, rect3 - -import internal.godotstrings - -type - Transform* {.byref.} = object - basis*: Basis - origin*: Vector3 +import godotcoretypes, internal.godotinternaltypes, gdnativeapi +import basis proc initTransform*(): Transform {.inline.} = result.basis = initBasis() @@ -23,45 +17,54 @@ proc initTransform*(xAxis, yAxis, zAxis, proc initTransform*(basis: Basis, origin: Vector3): Transform {.inline.} = Transform(basis: basis, origin: origin) -proc toGodotString(self: Transform): GodotString {. - importc: "godot_transform_as_string".} - proc `$`*(self: Transform): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().transformAsString(self) + +proc inverse*(self: Transform): Transform {.inline.} = + getGDNativeAPI().transformInverse(self) + +proc affineInverse*(self: Transform): Transform {.inline.} = + getGDNativeAPI().transformAffineInverse(self) + +proc orthonormalized*(self: Transform): Transform {.inline.} = + getGDNativeAPI().transformOrthonormalized(self) -proc inverse*(self: Transform): Transform {. - importc: "godot_transform_inverse".} -proc affineInverse*(self: Transform): Transform {. - importc: "godot_transform_affine_inverse".} -proc orthonormalized*(self: Transform): Transform {. - importc: "godot_transform_orthonormalized".} proc rotated*(self: Transform; axis: Vector3; - phi: float32): Transform {. - importc: "godot_transform_rotated".} -proc scaled*(self: Transform; scale: Vector3): Transform {. - importc: "godot_transform_scaled".} -proc translated*(self: Transform; offset: Vector3): Transform {. - importc: "godot_transform_translated".} -proc lookingAt*(self: Transform; - target, up: Vector3): Transform {. - importc: "godot_transform_looking_at".} + phi: float32): Transform {.inline.} = + getGDNativeAPI().transformRotated(self, axis, phi) -proc xformPlane*(self: Transform; v: Plane): Plane {. - importc: "godot_transform_xform_plane".} -proc xformInvPlane*(self: Transform; v: Plane): Plane {. - importc: "godot_transform_xform_inv_plane".} -proc xformVector3*(self: Transform; v: Vector3): Vector3 {. - importc: "godot_transform_xform_vector3".} -proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {. - importc: "godot_transform_xform_inv_vector3".} -proc xformRect3*(self: Transform; v: Rect3): Rect3 {. - importc: "godot_transform_xform_rect3".} -proc xformInvRect3*(self: Transform; v: Rect3): Rect3 {. - importc: "godot_transform_xform_inv_rect3".} +proc scaled*(self: Transform; scale: Vector3): Transform {.inline.} = + getGDNativeAPI().transformScaled(self, scale) -proc `==`*(self: Transform; b: Transform): bool {. - importc: "godot_transform_operator_equal".} -proc `*`*(a, b: Transform): Transform {. - importc: "godot_transform_operator_multiply".} -proc `*=`*(a: var Transform, b: Transform) {.inline.} = - a = a * b +proc translated*(self: Transform; offset: Vector3): Transform {.inline.} = + getGDNativeAPI().transformTranslated(self, offset) + +proc lookingAt*(self: Transform; target, up: Vector3): Transform {.inline.} = + getGDNativeAPI().transformLookingAt(self, target, up) + +proc xformPlane*(self: Transform; plane: Plane): Plane {.inline.} = + getGDNativeAPI().transformXformPlane(self, plane) + +proc xformInvPlane*(self: Transform; plane: Plane): Plane {.inline.} = + getGDNativeAPI().transformXformInvPlane(self, plane) + +proc xformVector3*(self: Transform; v: Vector3): Vector3 {.inline.} = + getGDNativeAPI().transformXformVector3(self, v) + +proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.inline.} = + getGDNativeAPI().transformXformInvVector3(self, v) + +proc xformRect3*(self: Transform; rect: Rect3): Rect3 {.inline.} = + getGDNativeAPI().transformXformRect3(self, rect) + +proc xformInvRect3*(self: Transform; rect: Rect3): Rect3 {.inline.} = + getGDNativeAPI().transformXformInvRect3(self, rect) + +proc `==`*(self: Transform; b: Transform): bool {.inline.} = + getGDNativeAPI().transformOperatorEqual(self, b) + +proc `*`*(self, other: Transform): Transform {.inline.} = + getGDNativeAPI().transformOperatorMultiply(self, other) + +proc `*=`*(self: var Transform, other: Transform) {.inline.} = + self = self * other diff --git a/godot/core/variants.nim b/godot/core/variants.nim index c5e2359..2dcc8d8 100644 --- a/godot/core/variants.nim +++ b/godot/core/variants.nim @@ -1,7 +1,8 @@ import tables -import internal.godotobjects, internal.godotvariants, internal.godotpoolarrays, - internal.godotstrings, internal.godotnodepaths +import godotcoretypes +import internal.godotinternaltypes, internal.godotvariants, + internal.godotstrings type Variant* = ref object @@ -267,5 +268,5 @@ proc `<`*(self, other: Variant): bool = proc hashCompare*(self, other: Variant): bool = self.godotVariant.hashCompare(other.godotVariant) -proc booleanize*(self: Variant; isValid: var bool): bool = - self.godotVariant.booleanize(isValid) +proc booleanize*(self: Variant): bool = + self.godotVariant.booleanize() diff --git a/godot/core/vector2.nim b/godot/core/vector2.nim index 8b9f6da..94b5b40 100644 --- a/godot/core/vector2.nim +++ b/godot/core/vector2.nim @@ -1,109 +1,121 @@ # Copyright (c) 2017 Xored Software, Inc. -import internal.godotstrings - -type - Vector2* {.byref.} = object - x*: float32 - y*: float32 +import internal.godotinternaltypes, godotcoretypes, gdnativeapi proc vec2*(x, y: float32): Vector2 {.inline.} = Vector2(x: x, y: y) -proc toGodotString(self: Vector2): GodotString {. - importc: "godot_vector2_as_string".} - proc `$`*(self: Vector2): string {.inline.} = - $self.toGodotString() + $getGDNativeAPI().vector2AsString(self) -proc normalized*(self: Vector2): Vector2 {. - importc: "godot_vector2_normalized".} -proc length*(self: Vector2): float32 {. - importc: "godot_vector2_length".} -proc angle*(self: Vector2): float32 {. - importc: "godot_vector2_angle".} -proc lengthSquared*(self: Vector2): float32 {. - importc: "godot_vector2_length_squared".} -proc isNormalized*(self: Vector2): bool {. - importc: "godot_vector2_is_normalized".} -proc distanceTo*(self, to: Vector2): float32 {. - importc: "godot_vector2_distance_to".} -proc distanceSquaredTo*(self, to: Vector2): float32 {. - importc: "godot_vector2_distance_squared_to".} -proc angleTo*(self, to: Vector2): float32 {. - importc: "godot_vector2_angle_to".} -proc angleToPoint*(self, to: Vector2): float32 {. - importc: "godot_vector2_angle_to_point".} -proc lerp*(self, b: Vector2; t: float32): Vector2 {. - importc: "godot_vector2_linear_interpolate".} -proc cubicInterpolate*(self, b, pre_a, post_b: Vector2; t: float32): Vector2 {. - importc: "godot_vector2_cubic_interpolate".} -proc rotated*(self: Vector2; phi: float32): Vector2 {. - importc: "godot_vector2_rotated".} -proc tangent*(self: Vector2): Vector2 {. - importc: "godot_vector2_tangent".} -proc floor*(self: Vector2): Vector2 {. - importc: "godot_vector2_floor".} -proc snapped*(self: Vector2; by: Vector2): Vector2 {. - importc: "godot_vector2_snapped".} -proc aspect*(self: Vector2): float32 {. - importc: "godot_vector2_aspect".} -proc dot*(a, b: Vector2): float32 {. - importc: "godot_vector2_dot".} -proc slide*(self, n: Vector2): Vector2 {. - importc: "godot_vector2_slide".} -proc bounce*(self, n: Vector2): Vector2 {. - importc: "godot_vector2_bounce".} -proc reflect*(self, n: Vector2): Vector2 {. - importc: "godot_vector2_reflect".} -proc abs*(self: Vector2): Vector2 {. - importc: "godot_vector2_abs".} -proc clamped*(self: Vector2; length: float32): Vector2 {. - importc: "godot_vector2_clamped".} +proc normalized*(self: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Normalized(self) -proc `+`*(a, b: Vector2): Vector2 {. - importc: "godot_vector2_operator_add".} -proc `+=`*(a: var Vector2, b: Vector2) {.inline.} = - a += b +proc length*(self: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2Length(self) -proc `-`*(a, b: Vector2): Vector2 {. - importc: "godot_vector2_operator_substract".} -proc `-=`*(a: var Vector2, b: Vector2) {.inline.} = - a = a - b +proc angle*(self: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2Angle(self) -proc `*`*(a, b: Vector2): Vector2 {. - importc: "godot_vector2_operator_multiply_vector".} +proc lengthSquared*(self: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2LengthSquared(self) -proc `*=`*(a: var Vector2, b: Vector2) {.inline.} = - a = a * b +proc isNormalized*(self: Vector2): bool {.inline.} = + getGDNativeAPI().vector2IsNormalized(self) + +proc distanceTo*(self, to: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2DistanceTo(self, to) + +proc distanceSquaredTo*(self, to: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2DistanceSquaredTo(self, to) + +proc angleTo*(self, to: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2AngleTo(self, to) + +proc angleToPoint*(self, to: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2AngleToPoint(self, to) + +proc lerp*(self, b: Vector2; t: float32): Vector2 {.inline.} = + getGDNativeAPI().vector2LinearInterpolate(self, b, t) + +proc cubicInterpolate*(self, b, preA, postB: Vector2; + t: float32): Vector2 {.inline.} = + getGDNativeAPI().vector2CubicInterpolate(self, b, preA, postB, t) + +proc rotated*(self: Vector2; phi: float32): Vector2 {.inline.} = + getGDNativeAPI().vector2Rotated(self, phi) + +proc tangent*(self: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Tangent(self) + +proc floor*(self: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Floor(self) + +proc snapped*(self: Vector2; by: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Snapped(self, by) + +proc aspect*(self: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2Aspect(self) + +proc dot*(a, b: Vector2): float32 {.inline.} = + getGDNativeAPI().vector2Dot(a, b) + +proc slide*(self, n: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Slide(self, n) + +proc bounce*(self, n: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Bounce(self, n) + +proc reflect*(self, n: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Reflect(self, n) + +proc abs*(self: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2Abs(self) + +proc clamped*(self: Vector2; length: float32): Vector2 {.inline.} = + getGDNativeAPI().vector2Clamped(self, length) + +proc `+`*(self, other: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2OperatorAdd(self, other) + +proc `+=`*(self: var Vector2, other: Vector2) {.inline.} = + self += other + +proc `-`*(self, other: Vector2): Vector2 = + getGDNativeAPI().vector2OperatorSubtract(self, other) + +proc `-=`*(self: var Vector2, other: Vector2) {.inline.} = + self = self - other + +proc `*`*(self, other: Vector2): Vector2 = + getGDNativeAPI().vector2OperatorMultiplyVector(self, other) + +proc `*=`*(self: var Vector2, other: Vector2) {.inline.} = + self = self * other + +proc `*`*(self: Vector2, scalar: float32): Vector2 = + getGDNativeAPI().vector2OperatorMultiplyScalar(self, scalar) -proc `*`*(self: Vector2, scalar: float32): Vector2 {. - importc: "godot_vector2_operator_multiply_scalar".} proc `*=`*(self: var Vector2, scalar: float32) {.inline.} = self = self * scalar -proc `/`*(a, b: Vector2): Vector2 {. - importc: "godot_vector2_operator_divide_vector".} -proc `/=`*(a: var Vector2, b: Vector2) {.inline.} = - a = a / b +proc `/`*(self, other: Vector2): Vector2 = + getGDNativeAPI().vector2OperatorDivideVector(self, other) + +proc `/=`*(self: var Vector2, other: Vector2) {.inline.} = + self = self / other + +proc `/`*(self: Vector2; scalar: float32): Vector2 = + getGDNativeAPI().vector2OperatorDivideScalar(self, scalar) -proc `/`*(self: Vector2; scalar: float32): Vector2 {. - importc: "godot_vector2_operator_divide_scalar".} proc `/=`*(self: var Vector2; scalar: float32) {.inline.} = self = self / scalar -proc `==`*(a, b: Vector2): bool {. - importc: "godot_vector2_operator_equal".} -proc `<`*(a, b: Vector2): bool {. - importc: "godot_vector2_operator_less".} -proc `-`*(self: Vector2): Vector2 {. - importc: "godot_vector2_operator_neg".} +proc `==`*(self, other: Vector2): bool {.inline.} = + getGDNativeAPI().vector2OperatorEqual(self, other) -proc `x=`*(self: var Vector2; x: float32) {. - importc: "godot_vector2_set_x".} -proc `y=`*(self: var Vector2; y: float32) {. - importc: "godot_vector2_set_y".} -proc x*(self: Vector2): float32 {. - importc: "godot_vector2_get_x".} -proc y*(self: Vector2): float32 {. - importc: "godot_vector2_get_y".} +proc `<`*(self, other: Vector2): bool {.inline.} = + getGDNativeAPI().vector2OperatorLess(self, other) + +proc `-`*(self: Vector2): Vector2 {.inline.} = + getGDNativeAPI().vector2OperatorNeg(self) diff --git a/godot/core/vector3.nim b/godot/core/vector3.nim index c4c614b..ded30ce 100644 --- a/godot/core/vector3.nim +++ b/godot/core/vector3.nim @@ -1,13 +1,7 @@ # Copyright (c) 2017 Xored Software, Inc. import math -import godotbase - -type - Vector3* {.byref.} = object - x*: float32 - y*: float32 - z*: float32 +import godotbase, godotcoretypes proc vec3*(): Vector3 {.inline.} = Vector3() diff --git a/godot/gdnativeapi.nim b/godot/gdnativeapi.nim new file mode 100644 index 0000000..c93e5fa --- /dev/null +++ b/godot/gdnativeapi.nim @@ -0,0 +1,1378 @@ +# Copyright 2017 Xored Software, Inc. + +import internal.godotinternaltypes, core.godotcoretypes + +type GDNativeAPI* = object + next: pointer + version: cstring + + # Color API + colorNewRGBA*: proc (dest: var Color, r, g, b, a: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorNewRGB*: proc (dest: var Color, r, g, b: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetR*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorSetR*: proc (self: var Color, r: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetG*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorSetG*: proc (self: var Color, g: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetB*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorSetB*: proc (self: var Color, b: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetA*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorSetA*: proc (self: var Color, a: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetH*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetS*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGetV*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorAsString*: proc (self: Color): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorToRGBA32*: proc (self: Color): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorAsARGB32*: proc (self: Color): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorGray*: proc (self: Color): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorInverted*: proc (self: Color): Color + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorContrasted*: proc (self: Color): Color + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorLinearInterpolate*: proc (self, other: Color, t: float32): Color + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + colorBlend*: proc (self, other: Color): Color + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorToHtml*: proc (self: Color, withAlpha: bool): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorOperatorEqual*: proc (self, other: Color): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + colorOperatorLess*: proc (self, other: Color): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Vector2 API + vector2New*: proc (dest: var Vector2, x, y: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2AsString*: proc (self: Vector2): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Normalized*: proc (self: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Length*: proc (self: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Angle*: proc (self: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2LengthSquared*: proc (self: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2IsNormalized*: proc (self: Vector2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2DistanceTo*: proc (self, to: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2DistanceSquaredTo*: proc (self, to: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2AngleTo*: proc (self, to: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2AngleToPoint*: proc (self, to: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2LinearInterpolate*: proc (self, b: Vector2, t: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2CubicInterpolate*: proc (self, b, preA, postB: Vector2, + t: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2Rotated*: proc (self: Vector2, phi: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Tangent*: proc (self: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Floor*: proc (self: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Snapped*: proc (self, by: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Aspect*: proc (self: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Dot*: proc (self, other: Vector2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Slide*: proc (self, n: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Bounce*: proc (self, n: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Reflect*: proc (self, n: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Abs*: proc (self: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2Clamped*: proc (self: Vector2, length: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2OperatorAdd*: proc (self, other: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2OperatorSubtract*: proc (self, other: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2OperatorMultiplyVector*: proc (self, other: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2OperatorMultiplyScalar*: proc (self: Vector2, scalar: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2OperatorDivideVector*: proc (self, other: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2OperatorDivideScalar*: proc (self: Vector2, scalar: float32): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + vector2OperatorEqual*: proc (self, other: Vector2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2OperatorLess*: proc (self, other: Vector2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2OperatorNeg*: proc (self: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + vector2SetX: pointer + vector2SetY: pointer + vector2GetX: pointer + vector2GetY: pointer + + # Quat API + quatNew*: proc (dest: var Quat, x, y, z, w: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatNewWithAxisAngle*: proc (dest: Quat, axis: Vector3, + angle: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatGetX*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSetX*: proc (self: var Quat, val: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatGetY*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSetY*: proc (self: var Quat, val: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatGetZ*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSetZ*: proc (self: var Quat, val: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatGetW*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSetW*: proc (self: var Quat, val: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatAsString*: proc (self: Quat): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatLength*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatLengthSquared*: proc (self: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatNormalized*: proc (self: Quat): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatIsNormalized*: proc (self: Quat): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatInverse*: proc (self: Quat): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatDot*: proc (self, other: Quat): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatXform*: proc (self: Quat, v: Vector3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSlerp*: proc (self, other: Quat, t: float32): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatSlerpni*: proc (self, other: Quat, t: float32): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatCubicSlerp*: proc (self, other, preA, postB: Quat, t: float32): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorMultiply*: proc (self: Quat, b: float32): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorAdd*: proc (self, other: Quat): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorSubtract*: proc (self, other: Quat): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorDivide*: proc (self: Quat, divider: float32): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorEqual*: proc (self, other: Quat): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + quatOperatorNeg*: proc (self: Quat): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Basis API + basisNewWithRows: pointer + basisNewWithAxisAndAngle: pointer + basisNewWithEuler: pointer + basisAsString: pointer + basisInverse: pointer + basisTransposed: pointer + basisOrthonormalized: pointer + basisDeterminant: pointer + basisRotated: pointer + basisScaled: pointer + basisGetScale: pointer + basisGetEuler: pointer + basisTdotx: pointer + basisTdoty: pointer + basisTdotz: pointer + basisXform: pointer + basisXformInv: pointer + basisGetOrthogonalIndex: pointer + basisNew: pointer + basisNewWithEulerQuat: pointer + basisGetElements: pointer + basisGetAxis: pointer + basisSetAxis: pointer + basisGetRow: pointer + basisSetRow: pointer + basisOperatorEqual: pointer + basisOperatorAdd: pointer + basisOperatorSubstract: pointer + basisOperatorMultiplyVector: pointer + basisOperatorMultiplyScalar: pointer + + # Vector3 API + vector3New: pointer + vector3AsString: pointer + vector3MinAxis: pointer + vector3MaxAxis: pointer + vector3Length: pointer + vector3Length_squared: pointer + vector3IsNormalized: pointer + vector3Normalized: pointer + vector3Inverse: pointer + vector3Snapped: pointer + vector3Rotated: pointer + vector3LinearInterpolate: pointer + vector3CubicInterpolate: pointer + vector3Dot: pointer + vector3Cross: pointer + vector3Outer: pointer + vector3ToDiagonalMatrix: pointer + vector3Abs: pointer + vector3Floor: pointer + vector3Ceil: pointer + vector3DistanceTo: pointer + vector3DistanceSquaredTo: pointer + vector3AngleTo: pointer + vector3Slide: pointer + vector3Bounce: pointer + vector3Reflect: pointer + vector3OperatorAdd: pointer + vector3OperatorSubstract: pointer + vector3OperatorMultiplyVector: pointer + vector3OperatorMultiplyScalar: pointer + vector3OperatorDivideVector: pointer + vector3OperatorDivideScalar: pointer + vector3OperatorEqual: pointer + vector3OperatorLess: pointer + vector3OperatorNeg: pointer + vector3SetAxis: pointer + vector3GetAxis: pointer + + # PoolByteArray API + poolByteArrayNew*: proc (dest: var GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayNewCopy*: proc (dest: var GodotPoolByteArray, + src: GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayNewWithArray*: proc (dest: var GodotPoolByteArray, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolByteArrayAppend*: proc (self: var GodotPoolByteArray, + val: byte) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayAppendArray*: proc (self: var GodotPoolByteArray, + arr: GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolByteArrayInsert*: proc (self: var GodotPoolByteArray, + idx: cint, val: byte): Error + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayInvert*: proc (self: var GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayPushBack*: proc (self: var GodotPoolByteArray, val: byte) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolByteArrayRemove*: proc (self: var GodotPoolByteArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayResize*: proc (self: var GodotPoolByteArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArraySet*: proc (self: var GodotPoolByteArray, idx: cint, data: byte) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayGet*: proc (self: GodotPoolByteArray, idx: cint): byte + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArraySize*: proc (self: GodotPoolByteArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolByteArrayDestroy*: proc (self: GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # PoolIntArray API + poolIntArrayNew*: proc (dest: var GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayNewCopy*: proc (dest: var GodotPoolIntArray, + src: GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayNewWithArray*: proc (dest: var GodotPoolIntArray, src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolIntArrayAppend*: proc (self: var GodotPoolIntArray, val: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayAppendArray*: proc (self: var GodotPoolIntArray, + arr: GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolIntArrayInsert*: proc (self: var GodotPoolIntArray, idx: cint, + val: cint): Error + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayInvert*: proc (self: var GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayPushBack*: proc (self: var GodotPoolIntArray, val: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayRemove*: proc (self: var GodotPoolIntArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayResize*: proc (self: var GodotPoolIntArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArraySet*: proc (self: var GodotPoolIntArray, idx: cint, data: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayGet*: proc (self: GodotPoolIntArray, idx: cint): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArraySize*: proc (self: GodotPoolIntArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolIntArrayDestroy*: proc (self: GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # PoolRealArray API + poolRealArrayNew*: proc (dest: var GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayNewCopy*: proc (dest: var GodotPoolRealArray, + src: GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayNewWithArray*: proc (dest: var GodotPoolRealArray, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolRealArrayAppend*: proc (self: var GodotPoolRealArray, val: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayAppendArray*: proc (self: var GodotPoolRealArray, + arr: GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolRealArrayInsert*: proc (self: var GodotPoolRealArray, + idx: cint, val: float32): Error + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayInvert*: proc (self: var GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayPushBack*: proc (self: var GodotPoolRealArray, val: float32) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolRealArrayRemove*: proc (self: var GodotPoolRealArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayResize*: proc (self: var GodotPoolRealArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArraySet*: proc (self: var GodotPoolRealArray, idx: cint, + data: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayGet*: proc (self: GodotPoolRealArray, idx: cint): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArraySize*: proc (self: GodotPoolRealArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolRealArrayDestroy*: proc (self: GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # PoolStringArray API + poolStringArrayNew*: proc (dest: var GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolStringArrayNewCopy*: proc (dest: var GodotPoolStringArray, + src: GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayNewWithArray*: proc (dest: var GodotPoolStringArray, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayAppend*: proc (self: var GodotPoolStringArray, + val: GodotString) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayAppendArray*: proc (self: var GodotPoolStringArray, + arr: GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayInsert*: proc (self: var GodotPoolStringArray, + idx: cint, val: GodotString): Error + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayInvert*: proc (self: var GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayPushBack*: proc (self: var GodotPoolStringArray, + val: GodotString) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayRemove*: proc (self: var GodotPoolStringArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArrayResize*: proc (self: var GodotPoolStringArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolStringArraySet*: proc (self: var GodotPoolStringArray, idx: cint, + data: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolStringArrayGet*: proc (self: GodotPoolStringArray, idx: cint): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolStringArraySize*: proc (self: GodotPoolStringArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolStringArrayDestroy*: proc (self: GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # PoolVector2 API + poolVector2ArrayNew*: proc (dest: var GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector2ArrayNewCopy*: proc (dest: var GodotPoolVector2Array, + src: GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayNewWithArray*: proc (dest: var GodotPoolVector2Array, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayAppend*: proc (self: var GodotPoolVector2Array, val: Vector2) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayAppendArray*: proc (self: var GodotPoolVector2Array, + arr: GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayInsert*: proc (self: var GodotPoolVector2Array, idx: cint, + val: Vector2): Error + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayInvert*: proc (self: var GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayPushBack*: proc (self: var GodotPoolVector2Array, + val: Vector2) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayRemove*: proc (self: var GodotPoolVector2Array, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArrayResize*: proc (self: var GodotPoolVector2Array, size: cint) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector2ArraySet*: proc (self: var GodotPoolVector2Array, idx: cint, + data: Vector2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector2ArrayGet*: proc (self: GodotPoolVector2Array, idx: cint): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector2ArraySize*: proc (self: GodotPoolVector2Array): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector2ArrayDestroy*: proc (self: GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # PoolVector3 API + poolVector3ArrayNew*: proc (dest: var GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector3ArrayNewCopy*: proc (dest: var GodotPoolVector3Array, + src: GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayNewWithArray*: proc (dest: var GodotPoolVector3Array, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayAppend*: proc (self: var GodotPoolVector3Array, val: Vector3) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayAppendArray*: proc (self: var GodotPoolVector3Array, + arr: GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayInsert*: proc (self: var GodotPoolVector3Array, idx: cint, + val: Vector3): Error + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayInvert*: proc (self: var GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolVector3ArrayPushBack*: proc (self: var GodotPoolVector3Array, + val: Vector3) {.noconv, raises: [], gcsafe, + tags: [], locks: 0.} + poolVector3ArrayRemove*: proc (self: var GodotPoolVector3Array, + idx: cint) {.noconv, raises: [], gcsafe, + tags: [], locks: 0.} + poolVector3ArrayResize*: proc (self: var GodotPoolVector3Array, + size: cint) {.noconv, raises: [], gcsafe, + tags: [], locks: 0.} + poolVector3ArraySet*: proc (self: var GodotPoolVector3Array, idx: cint, + data: Vector3) {.noconv, raises: [], gcsafe, + tags: [], locks: 0.} + poolVector3ArrayGet*: proc (self: GodotPoolVector3Array, idx: cint): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector3ArraySize*: proc (self: GodotPoolVector3Array): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolVector3ArrayDestroy*: proc (self: GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # PoolColorArray API + poolColorArrayNew*: proc (dest: var GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayNewCopy*: proc (dest: var GodotPoolColorArray, + src: GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolColorArrayNewWithArray*: proc (dest: var GodotPoolColorArray, + src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolColorArrayAppend*: proc (self: var GodotPoolColorArray, + val: Color) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayAppendArray*: proc (self: var GodotPoolColorArray, + arr: GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolColorArrayInsert*: proc (self: var GodotPoolColorArray, + idx: cint, val: Color): Error + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayInvert*: proc (self: var GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayPushBack*: proc (self: var GodotPoolColorArray, val: Color) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + poolColorArrayRemove*: proc (self: var GodotPoolColorArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayResize*: proc (self: var GodotPoolColorArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArraySet*: proc (self: var GodotPoolColorArray, idx: cint, + data: Color) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayGet*: proc (self: GodotPoolColorArray, idx: cint): Color + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArraySize*: proc (self: GodotPoolColorArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + poolColorArrayDestroy*: proc (self: GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # Array API + arrayNew*: proc (dest: var GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayNewCopy*: proc (dest: var GodotArray, src: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayNewPoolColorArray*: proc (dest: var GodotArray, src: GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arrayNewPoolVector3Array*: proc (dest: var GodotArray, + src: GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arrayNewPoolVector2Array*: proc (dest: var GodotArray, + src: GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arrayNewPoolStringArray*: proc (dest: var GodotArray, + src: GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arrayNewPoolRealArray*: proc (dest: var GodotArray, src: GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arrayNewPoolIntArray*: proc (dest: var GodotArray, src: GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayNewPoolByteArray*: proc (dest: var GodotArray, src: GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + arraySet*: proc (self: var GodotArray, idx: cint, val: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayGet*: proc (self: GodotArray, idx: cint): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayOperatorIndex*: proc (self: var GodotArray, idx: cint): ptr GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayAppend*: proc (self: var GodotArray, val: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayClear*: proc (self: var GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayCount*: proc (self: GodotArray, val: GodotVariant): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayEmpty*: proc (self: GodotArray): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayErase*: proc (self: var GodotArray, val: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayFront*: proc (self: GodotArray): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayBack*: proc (self: GodotArray): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayFind*: proc (self: GodotArray, what: GodotVariant, fromIdx: cint): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayFindLast*: proc (self: GodotArray, what: GodotVariant): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayHas*: proc (self: GodotArray, val: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayHash*: proc (self: GodotArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayInsert*: proc (self: var GodotArray, pos: cint, val: GodotVariant): Error + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayInvert*: proc (self: var GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayPopFront*: proc (self: GodotArray): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayPopBack*: proc (self: GodotArray): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayPushBack*: proc (self: var GodotArray, val: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayPushFront*: proc (self: var GodotArray, val: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayRemove*: proc (self: var GodotArray, idx: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayResize*: proc (self: var GodotArray, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayRFind*: proc (self: GodotArray, what: GodotVariant, fromIdx: cint): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arraySize*: proc (self: GodotArray): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arraySort*: proc (self: var GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arraySortCustom*: proc (self: var GodotArray, obj: ptr GodotObject, + f: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + arrayDestroy*: proc (self: var GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Dictionary API + dictionaryNew*: proc (dest: var GodotDictionary) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryNewCopy*: proc (dest: var GodotDictionary, src: GodotDictionary) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryDestroy*: proc (self: var GodotDictionary) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionarySize*: proc (self: GodotDictionary): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryEmpty*: proc (self: GodotDictionary): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryClear*: proc (self: var GodotDictionary) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryHas*: proc (self: GodotDictionary, key: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryHasAll*: proc (self: GodotDictionary, keys: GodotArray): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryErase*: proc (self: var GodotDictionary, key: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryHash*: proc (self: GodotDictionary): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryKeys*: proc (self: GodotDictionary): GodotArray + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryValues*: proc (self: GodotDictionary): GodotArray + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryGet*: proc (self: GodotDictionary, key: GodotVariant): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionarySet*: proc (self: var GodotDictionary, key, value: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryOperatorIndex*: proc (self: var GodotDictionary, + key: GodotVariant): ptr GodotVariant + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + dictionaryNext*: proc (self: GodotDictionary, + key: GodotVariant): ptr GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + dictionaryOperatorEqual*: proc (self, other: GodotDictionary): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + dictionaryToJson*: proc (self: GodotDictionary): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # NodePath API + nodePathNew*: proc (dest: var GodotNodePath, src: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathNewCopy*: proc (dest: var GodotNodePath, src: GodotNodePath) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathDestroy*: proc (self: var GodotNodePath) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathAsString*: proc (self: GodotNodePath): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathIsAbsolute*: proc (self: GodotNodePath): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathGetNameCount*: proc (self: GodotNodePath): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathGetName*: proc (self: GodotNodePath, idx: cint): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathGetSubnameCount*: proc (self: GodotNodePath): cint + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nodePathGetSubname*: proc (self: GodotNodePath, idx: cint): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathGetProperty*: proc (self: GodotNodePath): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathIsEmpty*: proc (self: GodotNodePath): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + nodePathOperatorEqual*: proc (self, other: GodotNodePath): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # Plane API + planeNewWithReals*: proc (dest: var Plane, a, b, c, d: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeNewWithVectors*: proc (dest: var Plane, v1, v2, v3: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeNewWithNormal*: proc (dest: var Plane, normal: Vector3, d: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeAsString*: proc (self: Plane): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeNormalized*: proc (self: Plane): Plane + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeCenter*: proc (self: Plane): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeGetAnyPoint*: proc (self: Plane): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeIsPointOver*: proc (self: Plane, point: Vector3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeDistanceTo*: proc (self: Plane, point: Vector3): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeHasPoint*: proc (self: Plane, point: Vector3, epsilon: float32): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeProject*: proc (self: Plane, point: Vector3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeIntersect3*: proc (self: Plane, dest: var Vector3, b, c: Plane): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeIntersectsRay*: proc (self: Plane, dest: var Vector3, + point, dir: Vector3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeIntersectsSegment*: proc (self: Plane, dest: var Vector3, + segmentBegin, segmentEnd: Vector3): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + planeOperatorNeg*: proc (self: Plane): Plane + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeOperatorEqual*: proc (self, other: Plane): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeSetNormal*: proc (self: var Plane, normal: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeGetNormal*: proc (self: Plane): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeGetD*: proc (self: Plane): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + planeSetD*: proc (self: var Plane, d: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Rect2 API + rect2NewWithPositionAndSize*: proc (dest: var Rect2, pos, size: Vector2) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect2New*: proc (dest: var Rect2, x, y, width, height: float32) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2AsString*: proc (self: Rect2): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2GetArea*: proc (self: Rect2): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Intersects*: proc (self, other: Rect2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Encloses*: proc (self, other: Rect2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2HasNoArea*: proc (self: Rect2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Clip*: proc (self, other: Rect2): Rect2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Merge*: proc (self, other: Rect2): Rect2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2HasPoint*: proc (self: Rect2, point: Vector2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Grow*: proc (self: Rect2, by: float32): Rect2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2Expand*: proc (self: Rect2, to: Vector2): Rect2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2OperatorEqual*: proc (self, other: Rect2): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2GetPosition*: proc (self: Rect2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2GetSize*: proc (self: Rect2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2SetPosition*: proc (self: var Rect2, pos: Vector2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect2SetSize*: proc (self: var Rect2, size: Vector2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Rect3 API + rect3New*: proc (dest: var Rect3, pos, size: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetPosition*: proc (self: Rect3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3SetPosition*: proc (self: var Rect3, pos: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetSize*: proc (self: Rect3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3SetSize*: proc (self: var Rect3, pos: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3AsString*: proc (self: Rect3): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetArea*: proc (self: Rect3): float32 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3HasNoArea*: proc (self: Rect3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3HasNoSurface*: proc (self: Rect3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3Intersects*: proc (self, other: Rect3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3Encloses*: proc (self, other: Rect3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3Merge*: proc (self, other: Rect3): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3Intersection*: proc (self, other: Rect3): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3IntersectsPlane*: proc (self: Rect3, plane: Plane): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3IntersectsSegment*: proc (self: Rect3, vFrom, vTo: Vector3): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect3HasPoint*: proc (self: Rect3, point: Vector3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetSupport*: proc (self: Rect3, dir: Vector3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetLongestAxis*: proc (self: Rect3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetLongestAxisIndex*: proc (self: Rect3): cint + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect3GetLongestAxisSize*: proc (self: Rect3): float32 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect3GetShortestAxis*: proc (self: Rect3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetShortestAxisIndex*: proc (self: Rect3): cint + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect3GetShortestAxisSize*: proc (self: Rect3): float32 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + rect3Expand*: proc (self: Rect3, toPoint: Vector3): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3Grow*: proc (self: Rect3, by: float32): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3GetEndpoint*: proc (self: Rect3, idx: cint): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + rect3OperatorEqual*: proc (self, other: Rect3): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # RID API + ridNew*: proc (dest: var RID) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + ridGetID*: proc (self: RID): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + ridNewWithResource*: proc (dest: var RID, obj: ptr GodotObject) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + ridOperatorEqual*: proc (self, other: RID): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + ridOperatorLess*: proc (self, other: RID): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Transform API + transformNewWithAxisOrigin*: proc (dest: var Transform, + xAxis, yAxis, zAxis, origin: Vector3) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformNew*: proc (dest: var Transform, basis: Basis, origin: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformGetBasis*: proc (self: Transform): Basis + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformSetBasis*: proc (self: var Transform, basis: Basis) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformGetOrigin*: proc (self: Transform): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformSetOrigin*: proc (self: var Transform, v: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformAsString*: proc (self: Transform): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformInverse*: proc (self: Transform): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformAffineInverse*: proc (self: Transform): Transform + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformOrthonormalized*: proc (self: Transform): Transform + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformRotated*: proc (self: Transform, axis: Vector3, + phi: float32): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformScaled*: proc (self: Transform, scale: Vector3): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformTranslated*: proc (self: Transform, offset: Vector3): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformLookingAt*: proc (self: Transform, target, up: Vector3): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformXformPlane*: proc (self: Transform, plane: Plane): Plane + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformXformInvPlane*: proc (self: Transform, plane: Plane): Plane + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformNewIdentity*: proc (dest: var Transform) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformOperatorEqual*: proc (self, other: Transform): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformOperatorMultiply*: proc (self, other: Transform): Transform + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformXformVector3*: proc (self: Transform, v: Vector3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformXformInvVector3*: proc (self: Transform, v: Vector3): Vector3 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transformXformRect3*: proc (self: Transform, v: Rect3): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transformXformInvRect3*: proc (self: Transform, v: Rect3): Rect3 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # Transform2D API + transform2DNew*: proc (dest: var Transform2D, rot: float32, pos: Vector2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DNewAxisOrigin*: proc (dest: var Transform2D, + xAxis, yAxis, origin: Vector2) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DAsString*: proc (self: Transform2D): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DInverse*: proc (self: Transform2D): Transform2D + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DAffineInverse*: proc (self: Transform2D): Transform2D + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DGetRotation*: proc (self: Transform2D): float32 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DGetOrigin*: proc (self: Transform2D): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DGetScale*: proc (self: Transform2D): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DOrthonormalized*: proc (self: Transform2D): Transform2D + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DRotated*: proc (self: Transform2D, phi: float32): Transform2D + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DScaled*: proc (self: Transform2D, scale: Vector2): Transform2D + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + transform2DTranslated*: proc (self: Transform2D, offset: Vector2): Transform2D + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DXformVector2*: proc (self: Transform2D, v: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DXformInvVector2*: proc (self: Transform2D, v: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DBasisXformVector2*: proc (self: Transform2D, v: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DBasisXformInvVector2*: proc (self: Transform2D, + v: Vector2): Vector2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DInterpolateWith*: proc (self, other: Transform2D, + t: float32): Transform2D + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DOperatorEqual*: proc (self, other: Transform2D): bool + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DOperatorMultiply*: proc (self, other: Transform2D): Transform2D + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DNewIdentity*: proc (dest: var Transform2D) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DXformRect2*: proc (self: Transform2D, v: Rect2): Rect2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + transform2DXformInvRect2*: proc (self: Transform2D, v: Rect2): Rect2 + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + + # Variant API + variantGetType*: proc (v: GodotVariant): VariantType + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewCopy*: proc (dest: var GodotVariant, src: GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewNil*: proc (dest: var GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewBool*: proc (dest: var GodotVariant, val: bool) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewUInt*: proc (dest: var GodotVariant, val: uint64) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewInt*: proc (dest: var GodotVariant, val: int64) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewReal*: proc (dest: var GodotVariant, val: float64) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewString*: proc (dest: var GodotVariant, val: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewVector2*: proc (dest: var GodotVariant, val: Vector2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewRect2*: proc (dest: var GodotVariant, val: Rect2) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewVector3*: proc (dest: var GodotVariant, val: Vector3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewTransform2D*: proc (dest: var GodotVariant, val: Transform2D) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPlane*: proc (dest: var GodotVariant, val: Plane) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewQuat*: proc (dest: var GodotVariant, val: Quat) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewRect3*: proc (dest: var GodotVariant, val: Rect3) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewBasis*: proc (dest: var GodotVariant, val: Basis) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewTransform*: proc (dest: var GodotVariant, val: Transform) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewColor*: proc (dest: var GodotVariant, val: Color) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewNodePath*: proc (dest: var GodotVariant, val: GodotNodePath) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewRID*: proc (dest: var GodotVariant, val: RID) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewObject*: proc (dest: var GodotVariant, val: ptr GodotObject) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewDictionary*: proc (dest: var GodotVariant, val: GodotDictionary) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewArray*: proc (dest: var GodotVariant, val: GodotArray) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantNewPoolByteArray*: proc (dest: var GodotVariant, + val: GodotPoolByteArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolIntArray*: proc (dest: var GodotVariant, val: GodotPoolIntArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolRealArray*: proc (dest: var GodotVariant, + val: GodotPoolRealArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolStringArray*: proc (dest: var GodotVariant, + val: GodotPoolStringArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolVector2Array*: proc (dest: var GodotVariant, + val: GodotPoolVector2Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolVector3Array*: proc (dest: var GodotVariant, + val: GodotPoolVector3Array) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantNewPoolColorArray*: proc (dest: var GodotVariant, + val: GodotPoolColorArray) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsBool*: proc (self: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsUInt*: proc (self: GodotVariant): uint64 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsInt*: proc (self: GodotVariant): int64 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsReal*: proc (self: GodotVariant): float64 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsString*: proc (self: GodotVariant): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsVector2*: proc (self: GodotVariant): Vector2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsRect2*: proc (self: GodotVariant): Rect2 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsVector3*: proc (self: GodotVariant): Vector3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsTransform2D*: proc (self: GodotVariant): Transform2D + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsPlane*: proc (self: GodotVariant): Plane + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsQuat*: proc (self: GodotVariant): Quat + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsRect3*: proc (self: GodotVariant): Rect3 + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsBasis*: proc (self: GodotVariant): Basis + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsTransform*: proc (self: GodotVariant): Transform + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsColor*: proc (self: GodotVariant): Color + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsNodePath*: proc (self: GodotVariant): GodotNodePath + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsRID*: proc (self: GodotVariant): RID + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsObject*: proc (self: GodotVariant): ptr GodotObject + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsDictionary*: proc (self: GodotVariant): GodotDictionary + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsArray*: proc (self: GodotVariant): GodotArray + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantAsPoolByteArray*: proc (self: GodotVariant): GodotPoolByteArray + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolIntArray*: proc (self: GodotVariant): GodotPoolIntArray + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolRealArray*: proc (self: GodotVariant): GodotPoolRealArray + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolStringArray*: proc (self: GodotVariant): GodotPoolStringArray + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolVector2Array*: proc (self: GodotVariant): GodotPoolVector2Array + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolVector3Array*: proc (self: GodotVariant): GodotPoolVector3Array + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantAsPoolColorArray*: proc (self: GodotVariant): GodotPoolColorArray + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + variantCall*: proc (self: var GodotVariant, meth: GodotString, + args: ptr array[MAX_ARG_COUNT, ptr GodotVariant], + argcount: cint, + callError: var VariantCallError): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantHasMethod*: proc (self: GodotVariant, meth: GodotString): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantOperatorEqual*: proc (self, other: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantOperatorLess*: proc (self, other: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantHashCompare*: proc (self, other: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantBooleanize*: proc (self: GodotVariant): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + variantDestroy*: proc (self: var GodotVariant) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # String API + stringNew*: proc (dest: var GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringNewCopy*: proc (dest: var GodotString, src: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringNewData*: proc (dest: var GodotString, contents: cstring, size: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringNewUTF16Data: pointer + stringGetData*: proc (self: GodotString, dest: cstring, size: var cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringOperatorIndex: pointer + stringCStr*: proc (self: GodotString): cstring + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringUTF16Str: pointer + stringOperatorEqual*: proc (self, other: GodotString): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringOperatorLess*: proc (self, other: GodotString): bool + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringOperatorPlus*: proc (self, other: GodotString): GodotString + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringLength*: proc (self: GodotString): cint + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + stringBeginsWith: pointer + stringBeginsWithCharArray: pointer + stringBigrams: pointer + stringChr: pointer + stringEndsWith: pointer + stringFind: pointer + stringFindFrom: pointer + stringFindmk: pointer + stringFindmkFrom: pointer + stringFindmkFromInPlace: pointer + stringFindn: pointer + stringFindnFrom: pointer + stringFindLast: pointer + stringFormat: pointer + stringFormatWithCustomPlaceholder: pointer + stringHexEncodeBuffer: pointer + stringHexToInt: pointer + stringHexToIntWithoutPrefix: pointer + stringInsert: pointer + stringIsNumeric: pointer + stringIsSubsequenceOf: pointer + stringIsSubsequenceOfi: pointer + stringLpad: pointer + stringLpadWithCustomCharacter: pointer + stringMatch: pointer + stringMatchn: pointer + stringMd5: pointer + stringNum: pointer + stringNumInt64: pointer + stringNumInt64Capitalized: pointer + stringNumReal: pointer + stringNumScientific: pointer + stringNumWithDecimals: pointer + stringPadDecimals: pointer + stringPadZeros: pointer + stringReplaceFirst: pointer + stringReplace: pointer + stringReplacen: pointer + stringRfind: pointer + stringRfindn: pointer + stringRfindFrom: pointer + stringRfindnFrom: pointer + stringRpad: pointer + stringRpadWithCustomCharacter: pointer + stringSimilarity: pointer + stringSprintf: pointer + stringSubstr: pointer + stringToDouble: pointer + stringToFloat: pointer + stringToInt: pointer + stringCamelcaseToUnderscore: pointer + stringCamelcaseToUnderscoreLowercased: pointer + stringCapitalize: pointer + stringCharToDouble: pointer + stringCharToInt: pointer + stringWcharToInt: pointer + stringCharToIntWithLen: pointer + stringCharToInt64WithLen: pointer + stringHexToInt64: pointer + stringHexToInt64WithPrefix: pointer + stringToInt64: pointer + stringUnicodeCharToDouble: pointer + stringGetSliceCount: pointer + stringGetSlice: pointer + stringGetSlicec: pointer + stringSplit: pointer + stringSplitAllowEmpty: pointer + stringSplitFloats: pointer + stringSplitFloatsAllowsEmpty: pointer + stringSplitFloatsMk: pointer + stringSplitFloatsMkAllowsEmpty: pointer + stringSplitInts: pointer + stringSplitIntsAllowsEmpty: pointer + stringSplitIntsMk: pointer + stringSplitIntsMkAllowsEmpty: pointer + stringSplitSpaces: pointer + stringCharLowercase: pointer + stringCharUppercase: pointer + stringToLower: pointer + stringToUpper: pointer + stringGetBasename: pointer + stringGetExtension: pointer + stringLeft: pointer + stringOrdAt: pointer + stringPlusFile: pointer + stringRight: pointer + stringStripEdges: pointer + stringStripEscapes: pointer + stringErase: pointer + stringAscii: pointer + stringAsciiExtended: pointer + stringUtf8: pointer + stringParseUtf8: pointer + stringParseUtf8WithLen: pointer + stringCharsToUtf8: pointer + stringCharsToUtf8WithLen: pointer + stringHash: pointer + stringHash64: pointer + stringHashChars: pointer + stringHashCharsWithLen: pointer + stringHashUtf8Chars: pointer + stringHashUtf8CharsWithLen: pointer + stringMd5Buffer: pointer + stringMd5Text: pointer + stringSha256Buffer: pointer + stringSha256Text: pointer + stringEmpty: pointer + stringGetBaseDir: pointer + stringGetFile: pointer + stringHumanizeSize: pointer + stringIsAbsPath: pointer + stringIsRelPath: pointer + stringIsResourceFile: pointer + stringPathTo: pointer + stringPathToFile: pointer + stringSimplifyPath: pointer + stringCEscape: pointer + stringCEscapeMultiline: pointer + stringCUnescape: pointer + stringHttpEscape: pointer + stringHttpUnescape: pointer + stringJsonEscape: pointer + stringWordWrap: pointer + stringXmlEscape: pointer + stringXmlEscapeWithQuotes: pointer + stringXmlUnescape: pointer + stringPercentDecode: pointer + stringPercentEncode: pointer + stringIsValidFloat: pointer + stringIsValidHexNumber: pointer + stringIsValidHtmlColor: pointer + stringIsValidIdentifier: pointer + stringIsValidInteger: pointer + stringIsValidIpAddress: pointer + stringDestroy*: proc (self: var GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # Misc API + objectDestroy*: proc (self: ptr GodotObject) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + globalGetSingleton*: proc (name: cstring): ptr GodotObject + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + methodBindGetMethod*: proc (className, + methodName: cstring): ptr GodotMethodBind + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + methodBindPtrCall*: proc (methodBind: ptr GodotMethodBind, + obj: ptr GodotObject, + args: ptr array[MAX_ARG_COUNT, pointer], + ret: pointer) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + methodBindCall*: proc (methodBind: ptr GodotMethodBind, obj: ptr GodotObject, + args: ptr array[MAX_ARG_COUNT, ptr GodotVariant], + argCount: cint, + callError: var VariantCallError): GodotVariant + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + getClassConstructor*: proc (className: cstring): GodotClassConstructor + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + alloc*: proc (bytes: cint): pointer + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + realloc*: proc (p: pointer, bytes: cint): pointer + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + free*: proc (p: pointer) {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + printError*: proc (description, function, file: cstring, line: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + printWarning*: proc (description, function, file: cstring, line: cint) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + print*: proc (message: GodotString) + {.noconv, raises: [], gcsafe, tags: [], locks: 0.} + + # NativeScript API + nativeScriptRegisterClass*: proc (gdnativeHandle: pointer, + name, base: cstring, + createFunc: GodotInstanceCreateFunc, + destroyFunc: GodotInstanceDestroyFunc) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nativeScriptRegisterToolClass*: proc (gdnativeHandle: pointer, + name, base: cstring, + createFunc: GodotInstanceCreateFunc, + destroyFunc: GodotInstanceDestroyFunc) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nativeScriptRegisterMethod*: proc (gdnativeHandle: pointer, + name, functionName: cstring, + attr: GodotMethodAttributes, + meth: GodotInstanceMethod) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nativeScriptRegisterProperty*: proc (gdnativeHandle: pointer, + name, path: cstring, + attr: ptr GodotPropertyAttributes, + setFunc: GodotPropertySetFunc, + getFunc: GodotPropertyGetFunc) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nativeScriptRegisterSignal*: proc (gdnativeHandle: pointer, name: cstring, + signal: GodotSignal) + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + nativeScriptGetUserdata*: proc (obj: ptr GodotObject): pointer + {.noconv, raises: [], gcsafe, tags: [], + locks: 0.} + +var gdNativeAPI: ptr GDNativeAPI + +proc getGDNativeAPI*(): ptr GDNativeAPI {.inline.} = + gdNativeAPI + +proc setGDNativeAPI*(apiStruct: pointer) {.inline.} = + gdNativeAPI = cast[ptr GDNativeAPI](apiStruct) diff --git a/godot/godot.nim b/godot/godot.nim index eb38a58..bab24f7 100644 --- a/godot/godot.nim +++ b/godot/godot.nim @@ -1,6 +1,7 @@ # Copyright 2017 Xored Software, Inc. import core.godotbase, godotinternal +import core.godotcoretypes import core.vector2, core.rect2, core.vector3, core.transform2d, core.planes, core.quats import core.rect3, core.basis, core.transforms, core.colors, core.nodepaths, @@ -9,9 +10,9 @@ import core.dictionaries, core.arrays, core.poolarrays, core.variants import nim.godotmacros, nim.godotnim -export godotbase, vector2, rect2, vector3, transform2d, planes, quats, - rect3, basis, transforms, colors, nodepaths, rids, dictionaries, arrays, - poolarrays, variants +export godotbase, godotcoretypes, vector2, rect2, vector3, transform2d, planes, + quats, rect3, basis, transforms, colors, nodepaths, rids, dictionaries, + arrays, poolarrays, variants export godotmacros, godotnim export GodotPropertyHint, GodotPropertyUsage \ No newline at end of file diff --git a/godot/godotinternal.nim b/godot/godotinternal.nim index c241d77..c89ea6c 100644 --- a/godot/godotinternal.nim +++ b/godot/godotinternal.nim @@ -1,259 +1,87 @@ # Copyright 2017 Xored Software, Inc. -import internal.godotobjects, internal.godotarrays, internal.godotnodepaths, - internal.godotpoolarrays, internal.godotstrings, internal.godotvariants, - internal.godotdictionaries +import internal.godotinternaltypes, internal.godotarrays, + internal.godotnodepaths, internal.godotpoolarrays, internal.godotstrings, + internal.godotvariants, internal.godotdictionaries -export godotobjects, godotarrays, godotnodepaths, godotpoolarrays, +import gdnativeapi +export godotinternaltypes, godotarrays, godotnodepaths, godotpoolarrays, godotstrings, godotvariants, godotdictionaries -const MAX_ARG_COUNT* = 128 +proc getMethod*(className: cstring; + methodName: cstring): ptr GodotMethodBind {.inline.} = + getGDNativeAPI().methodBindGetMethod(className, methodName) -# MethodBind API - -type GodotMethodBind* = object - -proc getMethod*(className: cstring; methodName: cstring): ptr GodotMethodBind {. - importc: "godot_method_bind_get_method".} proc ptrCall*(methodBind: ptr GodotMethodBind; instance: ptr GodotObject; args: ptr array[MAX_ARG_COUNT, pointer]; - ret: pointer) {. - importc: "godot_method_bind_ptrcall".} + ret: pointer) {.inline.} = + getGDNativeAPI().methodBindPtrCall(methodBind, instance, args, ret) + proc call*(methodBind: ptr GodotMethodBind; instance: ptr GodotObject; args: ptr array[MAX_ARG_COUNT, ptr GodotVariant]; argCount: cint; - callError: var VariantCallError): GodotVariant {. - importc: "godot_method_bind_call".} + callError: var VariantCallError): GodotVariant {.inline.} = + getGDNativeAPI().methodBindCall( + methodBind, instance, args, argCount, callError) -# Script API +proc nativeScriptRegisterClass*(libHandle: pointer; name, base: cstring; + createFunc: GodotInstanceCreateFunc; + destroyFunc: GodotInstanceDestroyFunc) + {.inline.} = + let api = getGDNativeAPI() + api.nativeScriptRegisterClass( + libHandle, name, base, createFunc, destroyFunc) -type - GodotNativeInitOptions* = object - inEditor*: bool - coreApiHash*: uint64 - editorApiHash*: uint64 - noApiHash*: uint64 - gdNativeLibrary*: ptr GodotObject +proc nativeScriptRegisterToolClass*(libHandle: pointer; name, base: cstring; + createFunc: GodotInstanceCreateFunc; + destroyFunc: GodotInstanceDestroyFunc) + {.inline.} = + getGDNativeAPI().nativeScriptRegisterToolClass( + libHandle, name, base, createFunc, destroyFunc) - GodotNativeTerminateOptions* = object - inEditor*: bool +proc nativeScriptRegisterMethod*(libHandle: pointer; + name: cstring; function_name: cstring; + attr: GodotMethodAttributes; + meth: GodotInstanceMethod) {.inline.} = + getGDNativeAPI().nativeScriptRegisterMethod( + libHandle, name, functionName, attr, meth) - GodotMethodRPCMode* {.size: sizeof(cint), pure.} = enum - Disabled, - Remote, - Sync, - Master, - Slave +proc nativeScriptRegisterProperty*(libHandle: pointer; + name, path: cstring; + attr: ptr GodotPropertyAttributes; + setFunc: GodotPropertySetFunc; + getFunc: GodotPropertyGetFunc) {.inline.} = + getGDNativeAPI().nativeScriptRegisterProperty( + libHandle, name, path, attr, setFunc, getFunc) - GodotMethodAttributes* = object - rpcMode*: GodotMethodRPCMode +proc nativeScriptRegisterSignal*(libHandle: pointer; name: cstring; + signal: GodotSignal) {.inline.} = + getGDNativeAPI().nativeScriptRegisterSignal(libHandle, name, signal) - GodotPropertyHint* {.size: sizeof(cint), pure.} = enum - None, ## no hint provided. - Range, ## hint_text = "min,max,step,slider; // slider is optional" - ExpRange, ## hint_text = "min,max,step", exponential edit - Enum, ## hint_text= "val1,val2,val3,etc" - ExpEasing, ## exponential easing funciton (Math::ease) - Length, ## hint_text= "length" (as integer) - SpriteFrame, - KeyAccel, ## hint_text= "length" (as integer) - Flags, ## hint_text= "flag1,flag2,etc" (as bit flags) - Layers2DRender, - Layers2DPhysics, - Layers3DRender, - Layers3DPhysics, - File, ## a file path must be passed, hint_text (optionally) - ## is a filter "*.png,*.wav,*.doc," - Dir, ## a directort path must be passed - GlobalFile, ## a file path must be passed, hint_text (optionally) is a - ## filter "*.png,*.wav,*.doc," - GlobalDir, ## a directort path must be passed - ResourceType, ## a resource object type - MultilineText, ## used for string properties that can contain multiple lines - ColorNoAlpha, ## used for ignoring alpha component when editing a color - ImageCompressLossy, - ImageCompressLossless, - ObjectId, - TypeString, ## a type string, the hint is the base type to choose - NodePathToEditedNode, ## so something else can provide this - ## (used in scripts) - MethodOfVariantType, ## a method of a type - MethodOfBaseType, ## a method of a base type - MethodOfInstance, ## a method of an instance - MethodOfScript, ## a method of a script & base - PropertyOfVariantType, ## a property of a type - PropertyOfBaseType, ## a property of a base type - PropertyOfInstance, ## a property of an instance - PropertyOfScript, ## a property of a script & base - PropertyHintMax +proc getUserdata*(instance: ptr GodotObject): pointer {.inline.} = + getGDNativeAPI().nativeScriptGetUserdata(instance) -const - GODOT_PROPERTY_USAGE_STORAGE_VALUE = 1.cint - GODOT_PROPERTY_USAGE_EDITOR_VALUE = 2.cint - GODOT_PROPERTY_USAGE_NETWORK_VALUE = 4.cint - GODOT_PROPERTY_USAGE_EDITOR_HELPER_VALUE = 8.cint - GODOT_PROPERTY_USAGE_CHECKABLE_VALUE = 16.cint - GODOT_PROPERTY_USAGE_CHECKED_VALUE = 32.cint - GODOT_PROPERTY_USAGE_INTERNATIONALIZED_VALUE = 64.cint - GODOT_PROPERTY_USAGE_GROUP_VALUE = 128.cint - GODOT_PROPERTY_USAGE_CATEGORY_VALUE = 256.cint - GODOT_PROPERTY_USAGE_STORE_IF_NONZERO_VALUE = 512.cint - GODOT_PROPERTY_USAGE_STORE_IF_NONONE_VALUE = 1024.cint - GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE_VALUE = 2048.cint - GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED_VALUE = 4096.cint - GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE_VALUE = 8192.cint - GODOT_PROPERTY_USAGE_STORE_IF_NULL_VALUE = 16384.cint - GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER_VALUE = 32768.cint - GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE = 65536.cint +proc getClassConstructor*(className: cstring): GodotClassConstructor + {.inline.} = + getGDNativeAPI().getClassConstructor(className) - GODOT_PROPERTY_USAGE_DEFAULT_VALUE: cint = - GODOT_PROPERTY_USAGE_STORAGE_VALUE or GODOT_PROPERTY_USAGE_EDITOR_VALUE or - GODOT_PROPERTY_USAGE_NETWORK_VALUE - GODOT_PROPERTY_USAGE_DEFAULT_INTL_VALUE: cint = - GODOT_PROPERTY_USAGE_STORAGE_VALUE or - GODOT_PROPERTY_USAGE_EDITOR_VALUE or GODOT_PROPERTY_USAGE_NETWORK_VALUE or - GODOT_PROPERTY_USAGE_INTERNATIONALIZED_VALUE - GODOT_PROPERTY_USAGE_NOEDITOR_VALUE: cint = - GODOT_PROPERTY_USAGE_STORAGE_VALUE or GODOT_PROPERTY_USAGE_NETWORK_VALUE - -type - GodotPropertyUsage* {.size: sizeof(cint), pure.} = enum - Storage = GODOT_PROPERTY_USAGE_STORAGE_VALUE - Editor = GODOT_PROPERTY_USAGE_EDITOR_VALUE - Network = GODOT_PROPERTY_USAGE_NETWORK_VALUE - NoEditor = GODOT_PROPERTY_USAGE_NOEDITOR_VALUE - Default = GODOT_PROPERTY_USAGE_DEFAULT_VALUE - EditorHelper = GODOT_PROPERTY_USAGE_EDITOR_HELPER_VALUE - Checkable = GODOT_PROPERTY_USAGE_CHECKABLE_VALUE - ## used for editing global variables - Checked = GODOT_PROPERTY_USAGE_CHECKED_VALUE - ## used for editing global variables - Internationalized = GODOT_PROPERTY_USAGE_INTERNATIONALIZED_VALUE - ## hint for internationalized strings - DefaultIntl = GODOT_PROPERTY_USAGE_DEFAULT_INTL_VALUE - Group = GODOT_PROPERTY_USAGE_GROUP_VALUE - ## used for grouping props in the editor - Category = GODOT_PROPERTY_USAGE_CATEGORY_VALUE - NonZero = GODOT_PROPERTY_USAGE_STORE_IF_NONZERO_VALUE - ## only store if nonzero - NonOne = GODOT_PROPERTY_USAGE_STORE_IF_NONONE_VALUE - ## only store if false - NoInstanceState = GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE_VALUE - RestartIfChanged = GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED_VALUE - ScriptVariable = GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE_VALUE - StoreIfNull = GODOT_PROPERTY_USAGE_STORE_IF_NULL_VALUE - AnimateAsTrigger = GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER_VALUE - UpdateAllIfModified = GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE - - GodotPropertyAttributes* {.bycopy.} = object - rsetType*: GodotMethodRPCMode - typ*: cint - hint*: GodotPropertyHint - hintString*: GodotString - usage*: cint - defaultValue*: GodotVariant - - GodotInstanceCreateFunc* {.bycopy.} = object - createFunc*: - proc (obj: ptr GodotObject; methodData: pointer): pointer {.noconv.} - ## returns user data - methodData*: pointer - freeFunc*: proc (a2: pointer) {.noconv.} - - GodotInstanceDestroyFunc* {.bycopy.} = object - destroyFunc*: - proc (obj: ptr GodotObject; methodData: pointer; - userData: pointer) {.noconv.} - methodData*: pointer - freeFunc*: proc (a2: pointer) {.noconv.} - -proc godotScriptRegisterClass*(libHandle: pointer; name, base: cstring; - create_func: GodotInstanceCreateFunc; - destroy_func: GodotInstanceDestroyFunc) {. - importc: "godot_nativescript_register_class".} -proc godotScriptRegisterToolClass*(libHandle: pointer; name, base: cstring; - createFunc: GodotInstanceCreateFunc; - destroyFunc: GodotInstanceDestroyFunc) {. - importc: "godot_nativescript_register_tool_class".} -type - GodotInstanceMethod* {.bycopy.} = object - meth*: - proc (obj: ptr GodotObject; methodData: pointer; - userData: pointer; numArgs: cint; - args: var array[MAX_ARG_COUNT, ptr GodotVariant]): - GodotVariant {.noconv.} - methodData*: pointer - freeFunc*: proc (a2: pointer) {.noconv.} - -proc godotScriptRegisterMethod*(libHandle: pointer; - name: cstring; function_name: cstring; - attr: GodotMethodAttributes; - meth: GodotInstanceMethod) {. - importc: "godot_nativescript_register_method".} -type - GodotPropertySetFunc* {.bycopy.} = object - setFunc*: proc (obj: ptr GodotObject; methodData: pointer; - userData: pointer; value: GodotVariant) {.noconv.} - methodData*: pointer - freeFunc*: proc (a2: pointer) {.noconv.} - - GodotPropertyGetFunc* {.bycopy.} = object - getFunc*: proc (obj: ptr GodotObject; methodData: pointer; - userData: pointer): GodotVariant {.noconv.} - methodData*: pointer - freeFunc*: proc (a2: pointer) {.noconv.} - -proc godotScriptRegisterProperty*(libHandle: pointer; - name: cstring; path: cstring; - attr: ptr GodotPropertyAttributes; - setFunc: GodotPropertySetFunc; - getFunc: GodotPropertyGetFunc) {. - importc: "godot_nativescript_register_property".} - -type - GodotSignalArgument* {.bycopy.} = object - name*: GodotString - typ*: cint - hint*: GodotPropertyHint - hintString*: GodotString - usage*: cint - defaultValue*: GodotVariant - - GodotSignal* = object - name*: GodotString - numArgs*: cint - args*: ptr GodotSignalArgument - numDefaultArgs*: cint - defaultArgs*: ptr GodotVariant - - -proc godotScriptRegisterSignal*(libHandle: pointer; name: cstring; - signal: GodotSignal) {. - importc: "godot_nativescript_register_signal".} - -proc getUserdata*(instance: ptr GodotObject): pointer {. - importc: "godot_nativescript_get_userdata".} - -type ClassConstructor = proc (): ptr GodotObject {.noconv.} -proc getClassConstructor*(className: cstring): ClassConstructor {. - importc: "godot_get_class_constructor".} - -proc deinit*(o: ptr GodotObject) {. - importc: "godot_object_destroy".} +proc deinit*(o: ptr GodotObject) {.inline.} = + getGDNativeAPI().objectDestroy(o) # print using Godot's error handler list -proc godotPrintError*(description: cstring; function: cstring; file: cstring; - line: cint) {. - importc: "godot_print_error".} +proc godotPrintError*(description, function, file: cstring; + line: cint) {.inline.} = + let api = getGDNativeAPI() + api.printError(description, function, file, line) -proc godotPrintWarning*(description: cstring; function: cstring; - file: cstring; line: cint) {. - importc: "godot_print_warning".} +proc godotPrintWarning*(description, function, file: cstring; + line: cint) {.inline.} = + getGDNativeAPI().printWarning(description, function, file, line) -proc godotPrint*(message: GodotString) {. - importc: "godot_print".} +proc godotPrint*(message: GodotString) {.inline.} = + getGDNativeAPI().print(message) var getClassMethodBind: ptr GodotMethodBind proc getClassName*(o: ptr GodotObject): string = @@ -267,22 +95,25 @@ proc getClassName*(o: ptr GodotObject): string = # There are physics type not known by ClassDB result = result[0..result.len-3] -proc getGodotSingleton*(name: cstring): ptr GodotObject {. - importc: "godot_global_get_singleton".} +proc getGodotSingleton*(name: cstring): ptr GodotObject {.inline.} = + getGDNativeAPI().globalGetSingleton(name) # System Functions -proc godotAlloc*(bytes: cint): pointer {. - importc: "godot_alloc".} +proc godotAlloc*(bytes: cint): pointer {.inline.} = ## Allocates the specified number of bytes. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. -proc godotRealloc*(p: pointer; bytes: cint): pointer {. - importc: "godot_realloc".} + getGDNativeAPI().alloc(bytes) + +proc godotRealloc*(p: pointer; bytes: cint): pointer {.inline.} = ## Reallocates the pointer for the specified number of bytes. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. -proc godotFree*(p: pointer) {.importc: "godot_free".} + getGDNativeAPI().realloc(p, bytes) + +proc godotFree*(p: pointer) {.inline.} = ## Frees the memory pointed to by the pointer. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. + getGDNativeAPI().free(p) diff --git a/godot/internal/godotarrays.nim b/godot/internal/godotarrays.nim index d6ee910..676e6cd 100644 --- a/godot/internal/godotarrays.nim +++ b/godot/internal/godotarrays.nim @@ -1,107 +1,130 @@ # Copyright (c) 2017 Xored Software, Inc. -type - GodotArray* {.byref.} = object - data: array[sizeof(int), byte] +import godotinternaltypes, gdnativeapi, core.godotcoretypes -proc len*(self: GodotArray): cint {. - noSideEffect, - importc: "godot_array_size".} +proc len*(self: GodotArray): cint {.inline.} = + getGDNativeAPI().arraySize(self) import hashes -import godotobjects, godotpoolarrays, godotvariants, godotstrings -proc initGodotArray*(dest: var GodotArray) {. - importc: "godot_array_new".} -proc initGodotArray*(dest: var GodotArray; pca: GodotPoolColorArray) {. - importc: "godot_array_new_pool_coloarray".} -proc initGodotArray*(dest: var GodotArray; pv3a: GodotPoolVector3Array) {. - importc: "godot_array_new_pool_vector3_array".} -proc initGodotArray*(dest: var GodotArray; pv2a: GodotPoolVector2Array) {. - importc: "godot_array_new_pool_vector2_array".} -proc initGodotArray*(dest: var GodotArray; psa: GodotPoolStringArray) {. - importc: "godot_array_new_pool_string_array".} -proc initGodotArray*(dest: var GodotArray; pra: GodotPoolRealArray) {. - importc: "godot_array_new_pool_real_array".} -proc initGodotArray*(dest: var GodotArray; pia: GodotPoolIntArray) {. - importc: "godot_array_new_pool_int_array".} -proc initGodotArray*(dest: var GodotArray; pba: GodotPoolByteArray) {. - importc: "godot_array_new_pool_byte_array".} -proc iniGodotArray*(dest: var GodotArray; src: GodotArray) {. - importc: "godot_array_new_copy".} +proc initGodotArray*(dest: var GodotArray) {.inline.} = + getGDNativeAPI().arrayNew(dest) -proc deinit*(self: var GodotArray) {.importc: "godot_array_destroy".} +proc initGodotArray*(dest: var GodotArray; + pca: GodotPoolColorArray) {.inline.} = + getGDNativeAPI().arrayNewPoolColorArray(dest, pca) -proc `[]=`*(self: var GodotArray; idx: cint; - value: GodotVariant) {. - noSideEffect, - importc: "godot_array_set".} -proc `[]`*(self: GodotArray; idx: cint): GodotVariant {. - noSideEffect, - importc: "godot_array_get".} -proc mget*(self: var GodotArray; idx: cint): ptr GodotVariant {. - importc: "godot_array_operator_index".} +proc initGodotArray*(dest: var GodotArray; + pv3a: GodotPoolVector3Array) {.inline.} = + getGDNativeAPI().arrayNewPoolVector3Array(dest, pv3a) + +proc initGodotArray*(dest: var GodotArray; + pv2a: GodotPoolVector2Array) {.inline.} = + getGDNativeAPI().arrayNewPoolVector2Array(dest, pv2a) + +proc initGodotArray*(dest: var GodotArray; + psa: GodotPoolStringArray) {.inline.} = + getGDNativeAPI().arrayNewPoolStringArray(dest, psa) + +proc initGodotArray*(dest: var GodotArray; + pra: GodotPoolRealArray) {.inline.} = + getGDNativeAPI().arrayNewPoolRealArray(dest, pra) + +proc initGodotArray*(dest: var GodotArray; + pia: GodotPoolIntArray) {.inline.} = + getGDNativeAPI().arrayNewPoolIntArray(dest, pia) + +proc initGodotArray*(dest: var GodotArray; + pba: GodotPoolByteArray) {.inline.} = + getGDNativeAPI().arrayNewPoolByteArray(dest, pba) + +proc initGodotArray*(dest: var GodotArray; src: GodotArray) {.inline.} = + getGDNativeAPI().arrayNewCopy(dest, src) + +proc deinit*(self: var GodotArray) {.inline.} = + getGDNativeAPI().arrayDestroy(self) + +proc `[]=`*(self: var GodotArray; idx: cint; value: GodotVariant) {.inline.} = + getGDNativeAPI().arraySet(self, idx, value) + +proc `[]`*(self: GodotArray; idx: cint): GodotVariant {.inline.} = + getGDNativeAPI().arrayGet(self, idx) + +proc mget*(self: var GodotArray; idx: cint): ptr GodotVariant {.inline.} = + getGDNativeAPI().arrayOperatorIndex(self, idx) + +proc add*(self: var GodotArray; value: GodotVariant) {.inline.} = + getGDNativeAPI().arrayPushBack(self, value) + +proc clear*(self: var GodotArray) {.inline.} = + getGDNativeAPI().arrayClear(self) + +proc count*(self: GodotArray; value: GodotVariant): cint {.inline.} = + getGDNativeAPI().arrayCount(self, value) + +proc isEmpty*(self: GodotArray): bool {.inline.} = + getGDNativeAPI().arrayEmpty(self) + +proc erase*(self: var GodotArray; value: GodotVariant) {.inline.} = + getGDNativeAPI().arrayErase(self, value) + +proc first*(self: GodotArray): GodotVariant {.inline.} = + getGDNativeAPI().arrayFront(self) + +proc last*(self: GodotArray): GodotVariant {.inline.} = + getGDNativeAPI().arrayBack(self) -proc add*(self: var GodotArray; value: GodotVariant) {. - noSideEffect, - importc: "godot_array_append".} -proc clear*(self: var GodotArray) {.importc: "godot_array_clear".} -proc count*(self: GodotArray; value: GodotVariant): cint {. - noSideEffect, - importc: "godot_array_count".} -proc isEmpty*(self: GodotArray): bool {. - noSideEffect, - importc: "godot_array_empty".} -proc erase*(self: var GodotArray; value: GodotVariant) {. - importc: "godot_array_erase".} -proc first*(self: GodotArray): GodotVariant {. - noSideEffect, - importc: "godot_array_front".} -proc last*(self: GodotArray): GodotVariant {. - noSideEffect, - importc: "godot_array_back".} proc find*(self: GodotArray; what: GodotVariant; - f: cint): cint {. - noSideEffect, - importc: "godot_array_find".} -proc findLast*(self: GodotArray; what: GodotVariant): cint {. - noSideEffect, - importc: "godot_array_find_last".} -proc contains*(self: GodotArray; value: GodotVariant): bool {. - noSideEffect, - importc: "godot_array_has".} + fromIdx: cint): cint {.inline.} = + getGDNativeAPI().arrayFind(self, what, fromIdx) + +proc findLast*(self: GodotArray; what: GodotVariant): cint {.inline.} = + getGDNativeAPI().arrayFindLast(self, what) + +proc contains*(self: GodotArray; value: GodotVariant): bool {.inline.} = + getGDNativeAPI().arrayHas(self, value) + +proc godotHash*(self: GodotArray): cint {.inline.} = + getGDNativeAPI().arrayHash(self) -proc godotHash*(self: GodotArray): cint {. - noSideEffect, - importc: "godot_array_hash".} proc hash*(self: GodotArray): Hash {.inline.} = hash(godotHash(self)) proc insert*(self: var GodotArray; pos: cint; - value: GodotVariant) {. - importc: "godot_array_insert".} -proc reverse*(self: var GodotArray) {.importc: "godot_array_invert".} -proc popLast*(self: var GodotArray): GodotVariant {. - importc: "godot_array_pop_back".} -proc popFirst*(self: var GodotArray): GodotVariant {. - importc: "godot_array_pop_front".} -proc addLast*(self: var GodotArray; value: GodotVariant) {. - importc: "godot_array_push_back".} -proc addFirst*(self: var GodotArray; value: GodotVariant) {. - importc: "godot_array_push_front".} + value: GodotVariant): Error {.discardable, inline.} = + getGDNativeAPI().arrayInsert(self, pos, value) + +proc reverse*(self: var GodotArray) {.inline.} = + getGDNativeAPI().arrayInvert(self) + +proc popLast*(self: var GodotArray): GodotVariant {.inline.} = + getGDNativeAPI().arrayPopBack(self) + +proc popFirst*(self: var GodotArray): GodotVariant {.inline.} = + getGDNativeAPI().arrayPopFront(self) + +proc addLast*(self: var GodotArray; value: GodotVariant) {.inline.} = + getGDNativeAPI().arrayPushBack(self, value) + +proc addFirst*(self: var GodotArray; value: GodotVariant) {.inline.} = + getGDNativeAPI().arrayPushFront(self, value) + +proc delete*(self: var GodotArray; idx: cint) {.inline.} = + getGDNativeAPI().arrayRemove(self, idx) + +proc setLen*(self: var GodotArray; size: cint) {.inline.} = + getGDNativeAPI().arrayResize(self, size) -proc delete*(self: var GodotArray; idx: cint) {. - importc: "godot_array_remove".} -proc setLen*(self: var GodotArray; size: cint) {. - importc: "godot_array_resize".} proc rfind*(self: GodotArray; what: GodotVariant; - f: cint): cint {. - noSideEffect, - importc: "godot_array_rfind".} -proc sort*(self: var GodotArray) {.importc: "godot_array_sort".} -proc sortCustom*(self: var GodotArray; obj: var GodotObject; - funcName: GodotString) {. - importc: "godot_array_sort_custom".} + fromIdx: cint): cint {.inline.} = + getGDNativeAPI().arrayRFind(self, what, fromIdx) + +proc sort*(self: var GodotArray) {.inline.} = + getGDNativeAPI().arraySort(self) + +proc sortCustom*(self: var GodotArray; obj: ptr GodotObject; + funcName: GodotString) {.inline.} = + getGDNativeAPI().arraySortCustom(self, obj, funcName) iterator items*(self: GodotArray): GodotVariant = for i in 0..