Migrate to NativeScript+GDNative
This commit is contained in:
parent
1e6646713f
commit
b41a37681f
22 changed files with 608 additions and 611 deletions
|
|
@ -4,28 +4,28 @@ import hashes
|
|||
import godotbase, poolarray, variant, strings
|
||||
|
||||
proc initArray(dest: var Array) {.
|
||||
importc: "godot_array_new", header: "godot_array.h".}
|
||||
importc: "godot_array_new", header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pca: PoolColorArray) {.
|
||||
importc: "godot_array_new_pool_coloarray",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pv3a: PoolVector3Array) {.
|
||||
importc: "godot_array_new_pool_vector3_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pv2a: PoolVector2Array) {.
|
||||
importc: "godot_array_new_pool_vector2_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; psa: PoolStringArray) {.
|
||||
importc: "godot_array_new_pool_string_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pra: PoolRealArray) {.
|
||||
importc: "godot_array_new_pool_real_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pia: PoolIntArray) {.
|
||||
importc: "godot_array_new_pool_int_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc initArray(dest: var Array; pba: PoolByteArray) {.
|
||||
importc: "godot_array_new_pool_byte_array",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
|
||||
proc initArray*(): Array {.inline.} =
|
||||
initArray(result)
|
||||
|
|
@ -54,79 +54,79 @@ proc initArray*(pba: PoolByteArray): Array {.inline.} =
|
|||
proc `[]=`*(self: var Array; idx: cint;
|
||||
value: Variant) {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_set", header: "godot_array.h".}
|
||||
importc: "godot_array_set", header: "godot/array.h".}
|
||||
proc `[]`*(self: Array; idx: cint): Variant {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_get", header: "godot_array.h".}
|
||||
importc: "godot_array_get", header: "godot/array.h".}
|
||||
proc mget*(self: var Array; idx: cint): ptr Variant {.
|
||||
importc: "godot_array_operator_index", header: "godot_array.h".}
|
||||
importc: "godot_array_operator_index", header: "godot/array.h".}
|
||||
|
||||
proc add*(self: var Array; value: Variant) {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_append", header: "godot_array.h".}
|
||||
importc: "godot_array_append", header: "godot/array.h".}
|
||||
proc clear*(self: var Array) {.importc: "godot_array_clear",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc count*(self: Array; value: Variant): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_count", header: "godot_array.h".}
|
||||
importc: "godot_array_count", header: "godot/array.h".}
|
||||
proc isEmpty*(self: Array): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_empty", header: "godot_array.h".}
|
||||
importc: "godot_array_empty", header: "godot/array.h".}
|
||||
proc erase*(self: var Array; value: Variant) {.
|
||||
importc: "godot_array_erase", header: "godot_array.h".}
|
||||
importc: "godot_array_erase", header: "godot/array.h".}
|
||||
proc first*(self: Array): Variant {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_front", header: "godot_array.h".}
|
||||
importc: "godot_array_front", header: "godot/array.h".}
|
||||
proc last*(self: Array): Variant {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_back", header: "godot_array.h".}
|
||||
importc: "godot_array_back", header: "godot/array.h".}
|
||||
proc find*(self: Array; what: Variant;
|
||||
f: cint): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_find", header: "godot_array.h".}
|
||||
importc: "godot_array_find", header: "godot/array.h".}
|
||||
proc findLast*(self: Array; what: Variant): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_find_last", header: "godot_array.h".}
|
||||
importc: "godot_array_find_last", header: "godot/array.h".}
|
||||
proc contains*(self: Array; value: Variant): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_has", header: "godot_array.h".}
|
||||
importc: "godot_array_has", header: "godot/array.h".}
|
||||
|
||||
proc godotHash*(self: Array): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_hash", header: "godot_array.h".}
|
||||
importc: "godot_array_hash", header: "godot/array.h".}
|
||||
proc hash*(self: Array): Hash {.inline.} =
|
||||
hash(godotHash(self))
|
||||
|
||||
proc insert*(self: var Array; pos: cint;
|
||||
value: Variant) {.
|
||||
importc: "godot_array_insert", header: "godot_array.h".}
|
||||
importc: "godot_array_insert", header: "godot/array.h".}
|
||||
proc reverse*(self: var Array) {.importc: "godot_array_invert",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc popLast*(self: var Array): Variant {.
|
||||
importc: "godot_array_pop_back", header: "godot_array.h".}
|
||||
importc: "godot_array_pop_back", header: "godot/array.h".}
|
||||
proc popFirst*(self: var Array): Variant {.
|
||||
importc: "godot_array_pop_front", header: "godot_array.h".}
|
||||
importc: "godot_array_pop_front", header: "godot/array.h".}
|
||||
proc addLast*(self: var Array; value: Variant) {.
|
||||
importc: "godot_array_push_back", header: "godot_array.h".}
|
||||
importc: "godot_array_push_back", header: "godot/array.h".}
|
||||
proc addFirst*(self: var Array; value: Variant) {.
|
||||
importc: "godot_array_push_front", header: "godot_array.h".}
|
||||
importc: "godot_array_push_front", header: "godot/array.h".}
|
||||
|
||||
proc delete*(self: var Array; idx: cint) {.
|
||||
importc: "godot_array_remove", header: "godot_array.h".}
|
||||
importc: "godot_array_remove", header: "godot/array.h".}
|
||||
proc setLen*(self: var Array; size: cint) {.
|
||||
importc: "godot_array_resize", header: "godot_array.h".}
|
||||
importc: "godot_array_resize", header: "godot/array.h".}
|
||||
proc rfind*(self: Array; what: Variant;
|
||||
f: cint): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_rfind", header: "godot_array.h".}
|
||||
importc: "godot_array_rfind", header: "godot/array.h".}
|
||||
proc len*(self: Array): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_array_size", header: "godot_array.h".}
|
||||
importc: "godot_array_size", header: "godot/array.h".}
|
||||
proc sort*(self: var Array) {.importc: "godot_array_sort",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
proc sortCustom*(self: var Array; obj: var GodotObject;
|
||||
funcName: GodotString) {.
|
||||
importc: "godot_array_sort_custom", header: "godot_array.h".}
|
||||
importc: "godot_array_sort_custom", header: "godot/array.h".}
|
||||
|
||||
iterator items*(arr: Array): Variant =
|
||||
for i in 0..<arr.len:
|
||||
|
|
|
|||
|
|
@ -3,22 +3,22 @@
|
|||
import godotbase, vector3, quat, strings
|
||||
|
||||
type
|
||||
Basis* {.importc: "godot_basis", header: "godot_basis.h", byref.} = object
|
||||
Basis* {.importc: "godot_basis", header: "godot/basis.h", byref.} = object
|
||||
|
||||
proc initBasis(dest: var Basis) {.importc: "godot_basis_new",
|
||||
header: "godot_basis.h".}
|
||||
header: "godot/basis.h".}
|
||||
proc initBasis(dest: var Basis;
|
||||
xAxis: Vector3;
|
||||
yAxis: Vector3;
|
||||
zAxis: Vector3) {.
|
||||
importc: "godot_basis_new_with_rows", header: "godot_basis.h".}
|
||||
importc: "godot_basis_new_with_rows", header: "godot/basis.h".}
|
||||
proc initBasis(dest: var Basis;
|
||||
euler: Quat) {.
|
||||
importc: "godot_basis_new_with_euler_quat", header: "godot_basis.h".}
|
||||
importc: "godot_basis_new_with_euler_quat", header: "godot/basis.h".}
|
||||
proc initBasis(dest: var Basis; axis: Vector3; phi: float32) {.
|
||||
importc: "godot_basis_new_with_axis_and_angle", header: "godot_basis.h".}
|
||||
importc: "godot_basis_new_with_axis_and_angle", header: "godot/basis.h".}
|
||||
proc initBasis(dest: var Basis; euler: Vector3) {.
|
||||
importc: "godot_basis_new_with_euler", header: "godot_basis.h".}
|
||||
importc: "godot_basis_new_with_euler", header: "godot/basis.h".}
|
||||
|
||||
proc initBasis*(): Basis {.inline.} =
|
||||
initBasis(result)
|
||||
|
|
@ -37,104 +37,104 @@ proc initBasis*(euler: Vector3): Basis {.inline.} =
|
|||
|
||||
proc toGodotString*(self: Basis): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_as_string", header: "godot_basis.h".}
|
||||
importc: "godot_basis_as_string", header: "godot/basis.h".}
|
||||
|
||||
proc `$`*(self: Basis): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc inverse*(self: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_inverse", header: "godot_basis.h".}
|
||||
importc: "godot_basis_inverse", header: "godot/basis.h".}
|
||||
proc transposed*(self: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_transposed", header: "godot_basis.h".}
|
||||
importc: "godot_basis_transposed", header: "godot/basis.h".}
|
||||
proc orthonormalized*(self: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_orthonormalized", header: "godot_basis.h".}
|
||||
importc: "godot_basis_orthonormalized", header: "godot/basis.h".}
|
||||
proc determinant*(self: Basis): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_determinant", header: "godot_basis.h".}
|
||||
importc: "godot_basis_determinant", header: "godot/basis.h".}
|
||||
proc rotated*(self: Basis; axis: Vector3;
|
||||
phi: float32): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_rotated", header: "godot_basis.h".}
|
||||
importc: "godot_basis_rotated", header: "godot/basis.h".}
|
||||
proc scaled*(self: Basis; scale: Vector3): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_scaled", header: "godot_basis.h".}
|
||||
importc: "godot_basis_scaled", header: "godot/basis.h".}
|
||||
|
||||
proc setScale*(self: var Basis; scale: Vector3) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_set_scale", header: "godot_basis.h".}
|
||||
importc: "godot_basis_set_scale", header: "godot/basis.h".}
|
||||
proc setRotationEuler*(self: var Basis;
|
||||
euler: Vector3) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_set_rotation_euler", header: "godot_basis.h".}
|
||||
importc: "godot_basis_set_rotation_euler", header: "godot/basis.h".}
|
||||
proc setRotationAxisAngle*(self: var Basis; axis: Vector3; angle: float32) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_set_rotation_axis_angle", header: "godot_basis.h".}
|
||||
importc: "godot_basis_set_rotation_axis_angle", header: "godot/basis.h".}
|
||||
|
||||
proc scale*(self: Basis): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_scale", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_scale", header: "godot/basis.h".}
|
||||
proc euler*(self: Basis): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_euler", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_euler", header: "godot/basis.h".}
|
||||
|
||||
proc tdotx*(self: Basis; x: Vector3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_tdotx", header: "godot_basis.h".}
|
||||
importc: "godot_basis_tdotx", header: "godot/basis.h".}
|
||||
proc tdoty*(self: Basis; y: Vector3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_tdoty", header: "godot_basis.h".}
|
||||
importc: "godot_basis_tdoty", header: "godot/basis.h".}
|
||||
proc tdotz*(self: Basis; z: Vector3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_tdotz", header: "godot_basis.h".}
|
||||
importc: "godot_basis_tdotz", header: "godot/basis.h".}
|
||||
|
||||
proc xform*(self: Basis; v: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_xform", header: "godot_basis.h".}
|
||||
importc: "godot_basis_xform", header: "godot/basis.h".}
|
||||
proc xformInv*(self: Basis; v: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_xform_inv", header: "godot_basis.h".}
|
||||
importc: "godot_basis_xform_inv", header: "godot/basis.h".}
|
||||
|
||||
proc orthogonalIndex*(self: Basis): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_orthogonal_index", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_orthogonal_index", header: "godot/basis.h".}
|
||||
|
||||
proc godot_basis_get_elements(self: Basis;
|
||||
elements: var array[3, Vector3]) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_elements", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_elements", header: "godot/basis.h".}
|
||||
|
||||
proc elements*(self: Basis): array[3, Vector3] {.inline.} =
|
||||
godot_basis_get_elements(self, result)
|
||||
|
||||
proc `[]`*(self: Basis; axis: range[0..2]): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_axis", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_axis", header: "godot/basis.h".}
|
||||
proc `[]=`*(self: var Basis; axis: range[0..2];
|
||||
value: Vector3) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_set_axis", header: "godot_basis.h".}
|
||||
importc: "godot_basis_set_axis", header: "godot/basis.h".}
|
||||
proc row*(self: Basis; row: cint): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_get_row", header: "godot_basis.h".}
|
||||
importc: "godot_basis_get_row", header: "godot/basis.h".}
|
||||
proc setRow*(self: var Basis; row: cint;
|
||||
value: Vector3) {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_set_row", header: "godot_basis.h".}
|
||||
importc: "godot_basis_set_row", header: "godot/basis.h".}
|
||||
proc `==`*(self: Basis; b: Basis): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_operator_equal", header: "godot_basis.h".}
|
||||
importc: "godot_basis_operator_equal", header: "godot/basis.h".}
|
||||
proc `+`*(self: Basis; b: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_operator_add", header: "godot_basis.h".}
|
||||
importc: "godot_basis_operator_add", header: "godot/basis.h".}
|
||||
proc `-`*(self: Basis; b: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_operator_substract", header: "godot_basis.h".}
|
||||
importc: "godot_basis_operator_substract", header: "godot/basis.h".}
|
||||
proc `*`*(self: Basis; b: Basis): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_operator_multiply_vector", header: "godot_basis.h".}
|
||||
importc: "godot_basis_operator_multiply_vector", header: "godot/basis.h".}
|
||||
proc `*`*(self: Basis; b: float32): Basis {.
|
||||
noSideEffect,
|
||||
importc: "godot_basis_operator_multiply_scalar", header: "godot_basis.h".}
|
||||
importc: "godot_basis_operator_multiply_scalar", header: "godot/basis.h".}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
import godotbase, strings
|
||||
|
||||
type
|
||||
Color* {.importc: "godot_color", header: "godot_color.h", byref.} = object
|
||||
Color* {.importc: "godot_color", header: "godot/color.h", byref.} = object
|
||||
|
||||
proc initColor(dest: var Color; r, g, b, a: float32) {.
|
||||
importc: "godot_color_new_rgba", header: "godot_color.h".}
|
||||
importc: "godot_color_new_rgba", header: "godot/color.h".}
|
||||
proc initColor(dest: var Color; r, g, b: float32) {.
|
||||
importc: "godot_color_new_rgb",
|
||||
header: "godot_color.h".}
|
||||
header: "godot/color.h".}
|
||||
|
||||
proc initColor*(r, g, b, a: float32): Color {.inline.} =
|
||||
initColor(result, r, g, b, a)
|
||||
|
|
@ -18,41 +18,41 @@ proc initColor*(r, g, b: float32): Color {.inline.} =
|
|||
initColor(result, r, g, b)
|
||||
|
||||
proc r*(self: Color): float32 {.
|
||||
importc: "godot_color_get_r", header: "godot_color.h".}
|
||||
importc: "godot_color_get_r", header: "godot/color.h".}
|
||||
proc `r=`*(self: var Color; r: float32) {.
|
||||
importc: "godot_color_set_r", header: "godot_color.h".}
|
||||
importc: "godot_color_set_r", header: "godot/color.h".}
|
||||
proc g*(self: Color): float32 {.
|
||||
importc: "godot_color_get_g", header: "godot_color.h".}
|
||||
importc: "godot_color_get_g", header: "godot/color.h".}
|
||||
proc `g=`*(self: var Color; g: float32) {.
|
||||
importc: "godot_color_set_g", header: "godot_color.h".}
|
||||
importc: "godot_color_set_g", header: "godot/color.h".}
|
||||
proc b*(self: Color): float32 {.
|
||||
importc: "godot_color_get_b", header: "godot_color.h".}
|
||||
importc: "godot_color_get_b", header: "godot/color.h".}
|
||||
proc `b=`*(self: var Color; b: float32) {.
|
||||
importc: "godot_color_set_b", header: "godot_color.h".}
|
||||
importc: "godot_color_set_b", header: "godot/color.h".}
|
||||
proc a*(self: Color): float32 {.
|
||||
importc: "godot_color_get_a", header: "godot_color.h".}
|
||||
importc: "godot_color_get_a", header: "godot/color.h".}
|
||||
proc `a=`*(self: var Color; a: float32) {.
|
||||
importc: "godot_color_set_a", header: "godot_color.h".}
|
||||
importc: "godot_color_set_a", header: "godot/color.h".}
|
||||
|
||||
proc h*(self: Color): float32 {.
|
||||
importc: "godot_color_get_h", header: "godot_color.h".}
|
||||
importc: "godot_color_get_h", header: "godot/color.h".}
|
||||
proc s*(self: Color): float32 {.
|
||||
importc: "godot_color_get_s", header: "godot_color.h".}
|
||||
importc: "godot_color_get_s", header: "godot/color.h".}
|
||||
proc v*(self: Color): float32 {.
|
||||
importc: "godot_color_get_v", header: "godot_color.h".}
|
||||
importc: "godot_color_get_v", header: "godot/color.h".}
|
||||
|
||||
proc toGodotString*(self: Color): GodotString {.
|
||||
importc: "godot_color_as_string", header: "godot_color.h".}
|
||||
importc: "godot_color_as_string", header: "godot/color.h".}
|
||||
proc `$`*(self: Color): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc toHtml*(self: Color; with_alpha: bool): GodotString {.
|
||||
importc: "godot_color_to_html", header: "godot_color.h".}
|
||||
importc: "godot_color_to_html", header: "godot/color.h".}
|
||||
|
||||
proc to32CInt(self: Color): cint {.
|
||||
importc: "godot_color_to_32", header: "godot_color.h".}
|
||||
importc: "godot_color_to_32", header: "godot/color.h".}
|
||||
proc toARGB32CInt(self: Color): cint {.
|
||||
importc: "godot_color_to_ARGB32", header: "godot_color.h".}
|
||||
importc: "godot_color_to_ARGB32", header: "godot/color.h".}
|
||||
|
||||
proc to32*(self: Color): uint32 {.inline.}=
|
||||
cast[uint32](to32CInt(self))
|
||||
|
|
@ -60,17 +60,17 @@ proc toARGB32*(self: Color): uint32 {.inline.} =
|
|||
cast[uint32](toARGB32CInt(self))
|
||||
|
||||
proc gray*(self: Color): float32 {.
|
||||
importc: "godot_color_gray", header: "godot_color.h".}
|
||||
importc: "godot_color_gray", header: "godot/color.h".}
|
||||
proc inverted*(self: Color): Color {.
|
||||
importc: "godot_color_inverted", header: "godot_color.h".}
|
||||
importc: "godot_color_inverted", header: "godot/color.h".}
|
||||
proc contrasted*(self: Color): Color {.
|
||||
importc: "godot_color_contrasted", header: "godot_color.h".}
|
||||
importc: "godot_color_contrasted", header: "godot/color.h".}
|
||||
proc lerp*(self: Color; b: Color; t: float32): Color {.
|
||||
importc: "godot_color_linear_interpolate", header: "godot_color.h".}
|
||||
importc: "godot_color_linear_interpolate", header: "godot/color.h".}
|
||||
proc blend*(self: Color; over: Color): Color {.
|
||||
importc: "godot_color_blend", header: "godot_color.h".}
|
||||
importc: "godot_color_blend", header: "godot/color.h".}
|
||||
|
||||
proc `==`*(self, b: Color): bool {.
|
||||
importc: "godot_color_operator_equal", header: "godot_color.h".}
|
||||
importc: "godot_color_operator_equal", header: "godot/color.h".}
|
||||
proc `<`*(self, b: Color): bool {.
|
||||
importc: "godot_color_operator_less", header: "godot_color.h".}
|
||||
importc: "godot_color_operator_less", header: "godot/color.h".}
|
||||
|
|
|
|||
|
|
@ -5,25 +5,25 @@ import godotbase, arrays, variant, strings
|
|||
|
||||
type
|
||||
Dictionary* {.importc: "godot_dictionary",
|
||||
header: "godot_dictionary.h", byref.} = object
|
||||
header: "godot/dictionary.h", byref.} = object
|
||||
|
||||
proc initVariant(dest: var Variant; dict: Dictionary) {.
|
||||
importc: "godot_variant_new_dictionary",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
|
||||
proc variant*(dict: Dictionary): Variant {.inline.} =
|
||||
initVariant(result, dict)
|
||||
|
||||
proc asDictionary*(self: Variant): Dictionary {.
|
||||
importc: "godot_variant_as_dictionary", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_dictionary", header: "godot/variant.h".}
|
||||
|
||||
proc initDictionary(dest: var Dictionary;
|
||||
src: Dictionary) {.
|
||||
importc: "godot_dictionary_new_copy",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
|
||||
proc deinit(self: var Dictionary) {.
|
||||
importc: "godot_dictionary_destroy", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_destroy", header: "godot/dictionary.h".}
|
||||
|
||||
proc `=`(self: var Dictionary, other: Dictionary) {.inline.} =
|
||||
initDictionary(self, other)
|
||||
|
|
@ -32,36 +32,36 @@ proc `=destroy`(self: Dictionary) {.inline.} =
|
|||
unsafeAddr(self)[].deinit()
|
||||
|
||||
proc initDictionary(dest: var Dictionary) {.
|
||||
importc: "godot_dictionary_new", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_new", header: "godot/dictionary.h".}
|
||||
proc initDictionary*(): Dictionary {.inline.} =
|
||||
initDictionary(result)
|
||||
|
||||
proc len*(self: Dictionary): cint {.
|
||||
importc: "godot_dictionary_size", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_size", header: "godot/dictionary.h".}
|
||||
proc isEmpty*(self: Dictionary): bool {.
|
||||
importc: "godot_dictionary_empty", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_empty", header: "godot/dictionary.h".}
|
||||
proc clear*(self: var Dictionary) {.
|
||||
importc: "godot_dictionary_clear", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_clear", header: "godot/dictionary.h".}
|
||||
proc contains*(self: Dictionary; key: Variant): bool {.
|
||||
importc: "godot_dictionary_has",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
proc contains*(self: Dictionary; keys: Array): bool {.
|
||||
importc: "godot_dictionary_has_all",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
proc del*(self: var Dictionary; key: Variant) {.
|
||||
importc: "godot_dictionary_erase", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_erase", header: "godot/dictionary.h".}
|
||||
|
||||
proc godotHash*(self: Dictionary): cint {.
|
||||
importc: "godot_dictionary_hash", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_hash", header: "godot/dictionary.h".}
|
||||
proc hash*(self: Dictionary): Hash {.inline.} =
|
||||
hash(godotHash(self))
|
||||
|
||||
proc keys*(self: Dictionary): Array {.
|
||||
importc: "godot_dictionary_keys", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_keys", header: "godot/dictionary.h".}
|
||||
proc values*(self: Dictionary): Array {.
|
||||
importc: "godot_dictionary_values", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_values", header: "godot/dictionary.h".}
|
||||
proc `[]`*(self: Dictionary; key: Variant): Variant {.
|
||||
importc: "godot_dictionary_get", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_get", header: "godot/dictionary.h".}
|
||||
|
||||
proc `[]`*(self: Dictionary; keyStr: string): Variant =
|
||||
let key = variant(keyStr)
|
||||
|
|
@ -69,17 +69,17 @@ proc `[]`*(self: Dictionary; keyStr: string): Variant =
|
|||
|
||||
proc `[]=`*(self: var Dictionary; key, value: Variant) {.
|
||||
importc: "godot_dictionary_set",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
proc mget*(self: var Dictionary; key: Variant): ptr Variant {.
|
||||
importc: "godot_dictionary_operator_index",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
|
||||
proc `==`*(self, other: Dictionary): bool {.
|
||||
importc: "godot_dictionary_operator_equal",
|
||||
header: "godot_dictionary.h".}
|
||||
header: "godot/dictionary.h".}
|
||||
|
||||
proc toJson*(self: Dictionary): GodotString {.
|
||||
importc: "godot_dictionary_to_json", header: "godot_dictionary.h".}
|
||||
importc: "godot_dictionary_to_json", header: "godot/dictionary.h".}
|
||||
|
||||
iterator keys*(dict: Dictionary): Variant =
|
||||
let keyArr = dict.keys()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Error* {.importc: "godot_error", header: "../godot.h",
|
||||
Error* {.importc: "godot_error", header: "godot/gdnative.h",
|
||||
size: sizeof(cint), pure.} = enum
|
||||
OK,
|
||||
Failed, ## Generic fail error
|
||||
|
|
@ -59,17 +59,17 @@ type
|
|||
const MAX_ARG_COUNT* = 128
|
||||
|
||||
type
|
||||
GodotObject* {.importc: "godot_object", header: "../godot.h".} = object
|
||||
Array* {.importc: "godot_array", header: "godot_array.h", byref.} = object
|
||||
GodotObject* {.importc: "godot_object", header: "godot/gdnative.h".} = object
|
||||
Array* {.importc: "godot_array", header: "godot/array.h", byref.} = object
|
||||
Variant* {.importc: "godot_variant",
|
||||
header: "godot_variant.h", byref.} = object
|
||||
header: "godot/variant.h", byref.} = object
|
||||
|
||||
proc initArray(dest: var Array, src: Array) {.
|
||||
importc: "godot_array_new_copy",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
|
||||
proc deinit(self: var Array) {.importc: "godot_array_destroy",
|
||||
header: "godot_array.h".}
|
||||
header: "godot/array.h".}
|
||||
|
||||
proc `=`(self: var Array, other: Array) {.inline.} =
|
||||
initArray(self, other)
|
||||
|
|
@ -78,10 +78,10 @@ proc `=destroy`(self: Array) {.inline.} =
|
|||
unsafeAddr(self).deinit()
|
||||
|
||||
proc initVariant(dest: var Variant; src: Variant) {.
|
||||
importc: "godot_variant_new_copy", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_copy", header: "godot/variant.h".}
|
||||
|
||||
proc deinit*(self: var Variant) {.
|
||||
importc: "godot_variant_destroy", header: "godot_variant.h".}
|
||||
importc: "godot_variant_destroy", header: "godot/variant.h".}
|
||||
|
||||
proc `=`(self: var Variant, other: Variant) {.inline.} =
|
||||
initVariant(self, other)
|
||||
|
|
@ -92,16 +92,16 @@ proc `=destroy`(self: Variant) {.inline.} =
|
|||
# System Functions
|
||||
|
||||
proc godotAlloc*(bytes: cint): pointer {.
|
||||
importc: "godot_alloc", header: "../godot.h".}
|
||||
importc: "godot_alloc", header: "godot/gdnative.h".}
|
||||
## 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", header: "../godot.h".}
|
||||
importc: "godot_realloc", header: "godot/gdnative.h".}
|
||||
## 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", header: "../godot.h".}
|
||||
proc godotFree*(p: pointer) {.importc: "godot_free", header: "godot/gdnative.h".}
|
||||
## 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.
|
||||
|
|
|
|||
|
|
@ -13,36 +13,37 @@ export godotbase, strings, vector2, rect2, vector3, transform2d, plane, quat,
|
|||
|
||||
type
|
||||
GodotMethodBind* {.importc: "godot_method_bind",
|
||||
header: "../godot.h".} = object
|
||||
header: "godot/gdnative.h".} = object
|
||||
|
||||
proc getMethod*(className: cstring; methodName: cstring): ptr GodotMethodBind {.
|
||||
importc: "godot_method_bind_get_method", header: "../godot.h".}
|
||||
importc: "godot_method_bind_get_method", header: "godot/gdnative.h".}
|
||||
proc ptrCall*(methodBind: ptr GodotMethodBind;
|
||||
instance: ptr GodotObject;
|
||||
args: ptr array[MAX_ARG_COUNT, pointer];
|
||||
ret: pointer) {.
|
||||
importc: "godot_method_bind_ptrcall", header: "../godot.h".}
|
||||
importc: "godot_method_bind_ptrcall", header: "godot/gdnative.h".}
|
||||
proc call*(methodBind: ptr GodotMethodBind;
|
||||
instance: ptr GodotObject;
|
||||
args: ptr array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
||||
callError: var VariantCallError): Variant {.
|
||||
importc: "godot_method_bind_call", header: "../godot.h".}
|
||||
importc: "godot_method_bind_call", header: "godot/gdnative.h".}
|
||||
|
||||
# Script API
|
||||
|
||||
type
|
||||
GodotNativeInitOptions* {.importc: "godot_native_init_options",
|
||||
header: "../godot.h".} = object
|
||||
GodotNativeInitOptions* {.importc: "godot_gdnative_init_options",
|
||||
header: "godot/gdnative.h".} = object
|
||||
inEditor* {.importc: "in_editor".}: bool
|
||||
coreApiHash* {.importc: "core_api_hash".}: uint64
|
||||
editorApiHash* {.importc: "editor_api_hash".}: uint64
|
||||
noApiHash* {.importc: "no_api_hash".}: uint64
|
||||
|
||||
GodotNativeTerminateOptions* {.importc: "godot_native_terminate_options",
|
||||
header: "../godot.h".} = object
|
||||
GodotNativeTerminateOptions* {.importc: "godot_gdnative_terminate_options",
|
||||
header: "godot/gdnative.h".} = object
|
||||
inEditor* {.importc: "in_editor".}: bool
|
||||
|
||||
GodotMethodRPCMode* {.importc: "godot_method_rpc_mode", header: "../godot.h",
|
||||
GodotMethodRPCMode* {.importc: "godot_method_rpc_mode",
|
||||
header: "godot_nativescript.h",
|
||||
size: sizeof(cint), pure.} = enum
|
||||
Disabled,
|
||||
Remote,
|
||||
|
|
@ -51,10 +52,11 @@ type
|
|||
Slave
|
||||
|
||||
GodotMethodAttributes* {.importc: "godot_method_attributes",
|
||||
header: "../godot.h".} = object
|
||||
header: "godot_nativescript.h".} = object
|
||||
rpcMode* {.importc: "rpc_type".}: GodotMethodRPCMode
|
||||
|
||||
GodotPropertyHint* {.importc: "godot_property_hint", header: "../godot.h",
|
||||
GodotPropertyHint* {.importc: "godot_property_hint",
|
||||
header: "godot_nativescript.h",
|
||||
size: sizeof(cint), pure.} = enum
|
||||
None, ## no hint provided.
|
||||
Range, ## hint_text = "min,max,step,slider; // slider is optional"
|
||||
|
|
@ -125,7 +127,7 @@ const
|
|||
|
||||
type
|
||||
GodotPropertyUsageFlags* {.importc: "godot_property_usage_flags",
|
||||
header: "../godot.h", size: sizeof(cint),
|
||||
header: "godot_nativescript.h", size: sizeof(cint),
|
||||
pure.} = enum
|
||||
Storage = GODOT_PROPERTY_USAGE_STORAGE_VALUE
|
||||
Editor = GODOT_PROPERTY_USAGE_EDITOR_VALUE
|
||||
|
|
@ -155,7 +157,7 @@ type
|
|||
UpdateAllIfModified = GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE
|
||||
|
||||
GodotPropertyAttributes* {.importc: "godot_property_attributes",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
rsetType* {.importc: "rset_type".}: GodotMethodRPCMode
|
||||
typ* {.importc: "type".}: cint
|
||||
hint* {.importc: "hint".}: GodotPropertyHint
|
||||
|
|
@ -164,7 +166,7 @@ type
|
|||
defaultValue* {.importc: "default_value".}: Variant
|
||||
|
||||
GodotInstanceCreateFunc* {.importc: "godot_instance_create_func",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
createFunc* {.importc: "create_func".}:
|
||||
proc (obj: ptr GodotObject; methodData: pointer): pointer {.noconv.}
|
||||
## returns user data
|
||||
|
|
@ -172,24 +174,26 @@ type
|
|||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
||||
|
||||
GodotInstanceDestroyFunc* {.importc: "godot_instance_destroy_func",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
destroyFunc* {.importc: "destroy_func".}:
|
||||
proc (obj: ptr GodotObject; methodData: pointer;
|
||||
userData: pointer) {.noconv.}
|
||||
methodData* {.importc: "method_data".}: pointer
|
||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
||||
|
||||
proc godotScriptRegisterClass*(name, base: cstring;
|
||||
proc godotScriptRegisterClass*(libHandle: pointer; name, base: cstring;
|
||||
create_func: GodotInstanceCreateFunc;
|
||||
destroy_func: GodotInstanceDestroyFunc) {.
|
||||
importc: "godot_script_register_class", header: "../godot.h".}
|
||||
proc godotScriptRegisterToolClass*(name, base: cstring;
|
||||
importc: "godot_nativescript_register_class",
|
||||
header: "godot_nativescript.h".}
|
||||
proc godotScriptRegisterToolClass*(libHandle: pointer; name, base: cstring;
|
||||
createFunc: GodotInstanceCreateFunc;
|
||||
destroyFunc: GodotInstanceDestroyFunc) {.
|
||||
importc: "godot_script_register_tool_class", header: "../godot.h".}
|
||||
importc: "godot_nativescript_register_tool_class",
|
||||
header: "godot_nativescript.h".}
|
||||
type
|
||||
GodotInstanceMethod* {.importc: "godot_instance_method",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
meth* {.importc: "method".}:
|
||||
proc (obj: ptr GodotObject; methodData: pointer;
|
||||
userData: pointer; numArgs: cint;
|
||||
|
|
@ -197,13 +201,15 @@ type
|
|||
methodData* {.importc: "method_data".}: pointer
|
||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
||||
|
||||
proc godotScriptRegisterMethod*(name: cstring; function_name: cstring;
|
||||
proc godotScriptRegisterMethod*(libHandle: pointer;
|
||||
name: cstring; function_name: cstring;
|
||||
attr: GodotMethodAttributes;
|
||||
meth: GodotInstanceMethod) {.
|
||||
importc: "godot_script_register_method", header: "../godot.h".}
|
||||
importc: "godot_nativescript_register_method",
|
||||
header: "godot_nativescript.h".}
|
||||
type
|
||||
GodotPropertySetFunc* {.importc: "godot_property_set_func",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
setFunc* {.importc: "set_func".}: proc (obj: ptr GodotObject;
|
||||
methodData: pointer;
|
||||
userData: pointer;
|
||||
|
|
@ -212,22 +218,24 @@ type
|
|||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
||||
|
||||
GodotPropertyGetFunc* {.importc: "godot_property_get_func",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
getFunc* {.importc: "get_func".}:
|
||||
proc (obj: ptr GodotObject; methodData: pointer;
|
||||
userData: pointer): Variant {.noconv.}
|
||||
methodData* {.importc: "method_data".}: pointer
|
||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
||||
|
||||
proc godotScriptRegisterProperty*(name: cstring; path: cstring;
|
||||
proc godotScriptRegisterProperty*(libHandle: pointer;
|
||||
name: cstring; path: cstring;
|
||||
attr: var GodotPropertyAttributes;
|
||||
setFunc: GodotPropertySetFunc;
|
||||
getFunc: GodotPropertyGetFunc) {.
|
||||
importc: "godot_script_register_property", header: "../godot.h".}
|
||||
importc: "godot_nativescript_register_property",
|
||||
header: "godot_nativescript.h".}
|
||||
|
||||
type
|
||||
GodotSignalArgument* {.importc: "godot_signal_argument",
|
||||
header: "../godot.h", bycopy.} = object
|
||||
header: "godot_nativescript.h", bycopy.} = object
|
||||
name* {.importc: "name".}: GodotString
|
||||
typ* {.importc: "type".}: cint
|
||||
hint* {.importc: "hint".}: GodotPropertyHint
|
||||
|
|
@ -235,45 +243,43 @@ type
|
|||
usage* {.importc: "usage".}: GodotPropertyUsageFlags
|
||||
defaultValue* {.importc: "default_value".}: Variant
|
||||
|
||||
GodotSignal* {.importc: "godot_signal", header: "../godot.h".} = object
|
||||
GodotSignal* {.importc: "godot_signal",
|
||||
header: "godot_nativescript.h".} = object
|
||||
name* {.importc: "name".}: GodotString
|
||||
numArgs* {.importc: "num_args".}: cint
|
||||
args* {.importc: "args".}: ptr GodotSignalArgument
|
||||
numDefaultArgs* {.importc: "num_default_args".}: cint
|
||||
defaultArgs* {.importc: "default_args".}: ptr Variant
|
||||
|
||||
proc godotScriptRegisterSignal*(name: cstring; signal: GodotSignal) {.
|
||||
importc: "godot_script_register_signal", header: "../godot.h".}
|
||||
proc godotScriptRegisterSignal*(libHandle: pointer; name: cstring;
|
||||
signal: GodotSignal) {.
|
||||
importc: "godot_nativescript_register_signal",
|
||||
header: "godot_nativescript.h".}
|
||||
|
||||
proc getUserdata*(instance: ptr GodotObject): pointer {.
|
||||
importc: "godot_native_get_userdata", header: "../godot.h".}
|
||||
importc: "godot_nativescript_get_userdata", header: "godot_nativescript.h".}
|
||||
|
||||
type
|
||||
GodotClassConstructor* = proc (): ptr GodotObject {.gcsafe, noconv.}
|
||||
|
||||
proc getClassConstructor*(className: cstring): GodotClassConstructor {.
|
||||
importc: "godot_get_class_constructor", header: "../godot.h".}
|
||||
proc getGlobalConstants*(): Dictionary {.
|
||||
importc: "godot_get_global_constants", header: "../godot.h".}
|
||||
proc godotNew*(p_classname: cstring): ptr GodotObject {.
|
||||
importc: "godot_new", header: "../godot.h".}
|
||||
importc: "godot_nativescript_new", header: "godot_nativescript.h".}
|
||||
|
||||
proc godotStackBottom*(): pointer {.
|
||||
importc: "godot_get_stack_bottom", header: "../godot.h".}
|
||||
importc: "godot_get_stack_bottom", header: "godot/gdnative.h".}
|
||||
|
||||
proc deinit*(o: ptr GodotObject) {.
|
||||
importc: "godot_object_destroy", header: "../godot.h".}
|
||||
importc: "godot_object_destroy", header: "godot/gdnative.h".}
|
||||
|
||||
# print using Godot's error handler list
|
||||
|
||||
proc godotPrintError(description: cstring; function: cstring; file: cstring;
|
||||
line: cint) {.
|
||||
importc: "godot_print_error", header: "../godot.h".}
|
||||
importc: "godot_print_error", header: "godot/gdnative.h".}
|
||||
|
||||
proc godotPrintWarning(description: cstring; function: cstring;
|
||||
file: cstring; line: cint) {.
|
||||
importc: "godot_print_warning", header: "../godot.h".}
|
||||
importc: "godot_print_warning", header: "godot/gdnative.h".}
|
||||
|
||||
proc godotPrint(message: GodotString) {.
|
||||
importc: "godot_print", header: "../godot.h".}
|
||||
importc: "godot_print", header: "godot/gdnative.h".}
|
||||
|
||||
proc print*(message: string) {.inline.} =
|
||||
let s = message.toGodotString()
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ import godotbase, strings
|
|||
|
||||
type
|
||||
NodePath* {.importc: "godot_node_path",
|
||||
header: "godot_node_path.h", byref.} = object
|
||||
header: "godot/node_path.h", byref.} = object
|
||||
|
||||
proc initNodePath(dest: var NodePath; s: GodotString) {.
|
||||
importc: "godot_node_path_new", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_new", header: "godot/node_path.h".}
|
||||
proc initNodePath(dest: var NodePath;
|
||||
src: NodePath) {.
|
||||
importc: "godot_node_path_new_copy", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_new_copy", header: "godot/node_path.h".}
|
||||
proc deinit(self: var NodePath) {.
|
||||
importc: "godot_node_path_destroy", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_destroy", header: "godot/node_path.h".}
|
||||
|
||||
proc initNodePath*(s: string): NodePath {.inline.} =
|
||||
initNodePath(result, s.toGodotString())
|
||||
|
|
@ -24,32 +24,32 @@ proc `=`(self: var NodePath, other: NodePath) {.inline.} =
|
|||
initNodePath(self, other)
|
||||
|
||||
proc toGodotString*(self: NodePath): GodotString {.
|
||||
importc: "godot_node_path_as_string", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_as_string", header: "godot/node_path.h".}
|
||||
proc `$`*(self: NodePath): string {.inline.} =
|
||||
let s = self.toGodotString()
|
||||
result = $s
|
||||
|
||||
proc isAbsolute*(self: NodePath): bool {.
|
||||
importc: "godot_node_path_is_absolute", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_is_absolute", header: "godot/node_path.h".}
|
||||
proc nameCount*(self: NodePath): cint {.
|
||||
importc: "godot_node_path_get_name_count",
|
||||
header: "godot_node_path.h".}
|
||||
header: "godot/node_path.h".}
|
||||
proc getName*(self: NodePath; idx: cint): GodotString {.
|
||||
importc: "godot_node_path_get_name", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_get_name", header: "godot/node_path.h".}
|
||||
proc subnameCount*(self: NodePath): cint {.
|
||||
importc: "godot_node_path_get_subname_count",
|
||||
header: "godot_node_path.h".}
|
||||
header: "godot/node_path.h".}
|
||||
proc getSubname*(self: NodePath; idx: cint): GodotString {.
|
||||
importc: "godot_node_path_get_subname",
|
||||
header: "godot_node_path.h".}
|
||||
header: "godot/node_path.h".}
|
||||
proc property*(self: NodePath): GodotString {.
|
||||
importc: "godot_node_path_get_property", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_get_property", header: "godot/node_path.h".}
|
||||
proc isEmpty*(self: NodePath): bool {.
|
||||
importc: "godot_node_path_is_empty", header: "godot_node_path.h".}
|
||||
importc: "godot_node_path_is_empty", header: "godot/node_path.h".}
|
||||
|
||||
proc `==`*(a, b: NodePath): bool {.
|
||||
importc: "godot_node_path_operator_equal",
|
||||
header: "godot_node_path.h".}
|
||||
header: "godot/node_path.h".}
|
||||
|
||||
converter fromString*(s: string): NodePath =
|
||||
initNodePath(result, s.toGodotString())
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
import godotbase, vector3, strings
|
||||
|
||||
type
|
||||
Plane* {.importc: "godot_plane", header: "godot_plane.h", byref.} = object
|
||||
Plane* {.importc: "godot_plane", header: "godot/plane.h", byref.} = object
|
||||
|
||||
proc initPlane(dest: var Plane; a, b, c, d: float32) {.
|
||||
importc: "godot_plane_new_with_reals", header: "godot_plane.h".}
|
||||
importc: "godot_plane_new_with_reals", header: "godot/plane.h".}
|
||||
proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {.
|
||||
importc: "godot_plane_new_with_vectors",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
proc initPlane(dest: var Plane; normal: Vector3; d: float32) {.
|
||||
importc: "godot_plane_new_with_normal",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
|
||||
proc initPlane*(a, b, c, d: float32): Plane =
|
||||
initPlane(result, a, b, c, d)
|
||||
|
|
@ -25,60 +25,60 @@ proc initPlane*(normal: Vector3; d: float32): Plane =
|
|||
|
||||
proc toGodotString*(self: Plane): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_as_string", header: "godot_plane.h".}
|
||||
importc: "godot_plane_as_string", header: "godot/plane.h".}
|
||||
proc `$`*(self: Plane): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc normalized*(self: Plane): Plane {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_normalized", header: "godot_plane.h".}
|
||||
importc: "godot_plane_normalized", header: "godot/plane.h".}
|
||||
proc center*(self: Plane): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_center", header: "godot_plane.h".}
|
||||
importc: "godot_plane_center", header: "godot/plane.h".}
|
||||
proc getAnyPoint*(self: Plane): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_get_any_point", header: "godot_plane.h".}
|
||||
importc: "godot_plane_get_any_point", header: "godot/plane.h".}
|
||||
proc isPointOver*(self: Plane; point: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_is_point_over",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
proc distanceTo*(self: Plane; point: Vector3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_distance_to", header: "godot_plane.h".}
|
||||
importc: "godot_plane_distance_to", header: "godot/plane.h".}
|
||||
proc contains*(self: Plane; point: Vector3;
|
||||
epsilon: float32): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_has_point", header: "godot_plane.h".}
|
||||
importc: "godot_plane_has_point", header: "godot/plane.h".}
|
||||
proc project*(self: Plane; point: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_project", header: "godot_plane.h".}
|
||||
importc: "godot_plane_project", header: "godot/plane.h".}
|
||||
proc intersect3*(self: Plane; dest: var Vector3;
|
||||
b, c: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_intersect_3",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
proc intersectsRay*(self: Plane; dest: var Vector3;
|
||||
v, dir: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_intersects_ray",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
proc intersectsSegment*(self: Plane; dest: var Vector3;
|
||||
segmentBegin, segmentEnd: Vector3): bool {.
|
||||
noSideEffect, importc: "godot_plane_intersects_segment",
|
||||
header: "godot_plane.h".}
|
||||
header: "godot/plane.h".}
|
||||
proc `-`*(self: Plane): Plane {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_operator_neg", header: "godot_plane.h".}
|
||||
importc: "godot_plane_operator_neg", header: "godot/plane.h".}
|
||||
proc `==`*(a, b: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_operator_equal", header: "godot_plane.h".}
|
||||
importc: "godot_plane_operator_equal", header: "godot/plane.h".}
|
||||
proc normal*(self: Plane): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_get_normal", header: "godot_plane.h".}
|
||||
importc: "godot_plane_get_normal", header: "godot/plane.h".}
|
||||
proc `normal=`*(self: var Plane; normal: Vector3) {.
|
||||
importc: "godot_plane_set_normal", header: "godot_plane.h".}
|
||||
importc: "godot_plane_set_normal", header: "godot/plane.h".}
|
||||
proc d*(self: Plane): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_plane_get_d", header: "godot_plane.h".}
|
||||
importc: "godot_plane_get_d", header: "godot/plane.h".}
|
||||
proc `d=`*(self: var Plane; d: float32) {.
|
||||
importc: "godot_plane_set_d", header: "godot_plane.h".}
|
||||
importc: "godot_plane_set_d", header: "godot/plane.h".}
|
||||
|
|
@ -4,34 +4,34 @@ import godotbase, color, vector2, vector3, strings
|
|||
|
||||
type
|
||||
PoolByteArray* {.importc: "godot_pool_byte_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolIntArray* {.importc: "godot_pool_int_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolRealArray* {.importc: "godot_pool_real_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolStringArray* {.importc: "godot_pool_string_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolVector2Array* {.importc: "godot_pool_vector2_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolVector3Array* {.importc: "godot_pool_vector3_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
PoolColorArray* {.importc: "godot_pool_color_array",
|
||||
header: "godot_pool_arrays.h", byref.} = object
|
||||
header: "godot/pool_arrays.h", byref.} = object
|
||||
|
||||
# byte
|
||||
|
||||
proc initPoolByteArray(dest: var PoolByteArray) {.
|
||||
importc: "godot_pool_byte_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolByteArray(dest: var PoolByteArray;
|
||||
src: PoolByteArray) {.
|
||||
importc: "godot_pool_byte_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolByteArray(dest: var PoolByteArray; arr: Array) {.
|
||||
importc: "godot_pool_byte_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolByteArray) {.
|
||||
importc: "godot_pool_byte_array_destroy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_destroy", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolByteArray*(): PoolByteArray {.inline.} =
|
||||
initPoolByteArray(result)
|
||||
|
|
@ -47,33 +47,33 @@ proc `=destroy`(self: PoolByteArray) {.inline.} =
|
|||
|
||||
proc add*(self: var PoolByteArray;
|
||||
data: uint8) {.
|
||||
importc: "godot_pool_byte_array_append", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_append", header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolByteArray, data: uint8) {.
|
||||
importc: "godot_pool_byte_array_push_back", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_push_back", header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolByteArray;
|
||||
arr: PoolByteArray) {.
|
||||
importc: "godot_pool_byte_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolByteArray; idx: cint;
|
||||
data: uint8): Error {.
|
||||
importc: "godot_pool_byte_array_insert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_insert", header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolByteArray; idx: cint) {.
|
||||
importc: "godot_pool_byte_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_remove", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc reverse*(self: var PoolByteArray) {.
|
||||
importc: "godot_pool_byte_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_invert", header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolByteArray; size: cint) {.
|
||||
importc: "godot_pool_byte_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_resize", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc `[]=`*(self: var PoolByteArray; idx: cint; data: uint8) {.
|
||||
importc: "godot_pool_byte_array_set", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_set", header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolByteArray; idx: cint): uint8 {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_byte_array_get",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolByteArray): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_byte_array_size", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_byte_array_size", header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolByteArray): byte =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -84,16 +84,16 @@ iterator pairs*(arr: PoolByteArray): tuple[key: cint, val: byte] =
|
|||
yield (i, arr[i])
|
||||
|
||||
proc initPoolIntArray(dest: var PoolIntArray) {.
|
||||
importc: "godot_pool_int_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolIntArray(dest: var PoolIntArray;
|
||||
src: PoolIntArray) {.
|
||||
importc: "godot_pool_int_array_new_copy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_new_copy", header: "godot/pool_arrays.h".}
|
||||
proc initPoolIntArray(dest: var PoolIntArray;
|
||||
arr: Array) {.
|
||||
importc: "godot_pool_int_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc deinit(self: var PoolIntArray) {.
|
||||
importc: "godot_pool_int_array_destroy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_destroy", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolIntArray*(): PoolIntArray {.inline.} =
|
||||
initPoolIntArray(result)
|
||||
|
|
@ -108,32 +108,32 @@ proc `=destroy`(self: PoolIntArray) {.inline.} =
|
|||
unsafeAddr(self).deinit()
|
||||
|
||||
proc add*(self: var PoolIntArray; data: cint) {.
|
||||
importc: "godot_pool_int_array_append", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_append", header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolIntArray; data: cint) {.
|
||||
importc: "godot_pool_int_array_push_back", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_push_back", header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolIntArray; arr: PoolIntArray) {.
|
||||
importc: "godot_pool_int_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolIntArray; idx: cint;
|
||||
data: cint): Error {.
|
||||
importc: "godot_pool_int_array_insert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_insert", header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolIntArray; idx: cint) {.
|
||||
importc: "godot_pool_int_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolIntArray) {.
|
||||
importc: "godot_pool_int_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_invert", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc setLen*(self: var PoolIntArray; size: cint) {.
|
||||
importc: "godot_pool_int_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolIntArray; idx: cint; data: cint) {.
|
||||
importc: "godot_pool_int_array_set", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_int_array_set", header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolIntArray; idx: cint): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_int_array_get",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolIntArray): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_int_array_size",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolIntArray): cint =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -146,17 +146,17 @@ iterator pairs*(arr: PoolIntArray): tuple[key: cint, val: cint] =
|
|||
# Real
|
||||
|
||||
proc initPoolRealArray(dest: var PoolRealArray) {.
|
||||
importc: "godot_pool_real_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolRealArray(dest: var PoolRealArray;
|
||||
src: PoolRealArray) {.
|
||||
importc: "godot_pool_real_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolRealArray(dest: var PoolRealArray; arr: Array) {.
|
||||
importc: "godot_pool_real_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolRealArray) {.
|
||||
importc: "godot_pool_real_array_destroy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_destroy", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolRealArray*(): PoolRealArray {.inline.} =
|
||||
initPoolRealArray(result)
|
||||
|
|
@ -172,30 +172,30 @@ proc `=destroy`(self: PoolRealArray) {.inline.} =
|
|||
|
||||
proc add*(self: var PoolRealArray; data: float32) {.
|
||||
importc: "godot_pool_real_array_append",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolRealArray; data: float32) {.
|
||||
importc: "godot_pool_real_array_push_back", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_push_back", header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolRealArray; arr: PoolRealArray) {.
|
||||
importc: "godot_pool_real_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolRealArray;
|
||||
idx: cint; data: float32): Error {.
|
||||
importc: "godot_pool_real_array_insert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_insert", header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolRealArray; idx: cint) {.
|
||||
importc: "godot_pool_real_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolRealArray) {.
|
||||
importc: "godot_pool_real_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_invert", header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolRealArray; size: cint) {.
|
||||
importc: "godot_pool_real_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolRealArray; idx: cint; data: float32) {.
|
||||
importc: "godot_pool_real_array_set", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_set", header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolRealArray; idx: cint): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_real_array_get",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolRealArray): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_real_array_size", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_real_array_size", header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolRealArray): float32 =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -208,18 +208,18 @@ iterator pairs*(arr: PoolRealArray): tuple[key: cint, val: float32] =
|
|||
# String
|
||||
|
||||
proc initPoolStringArray(dest: var PoolStringArray) {.
|
||||
importc: "godot_pool_string_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_string_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolStringArray(dest: var PoolStringArray;
|
||||
src: PoolStringArray) {.
|
||||
importc: "godot_pool_string_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolStringArray(dest: var PoolStringArray; arr: Array) {.
|
||||
importc: "godot_pool_string_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolStringArray) {.
|
||||
importc: "godot_pool_string_array_destroy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolStringArray*(): PoolStringArray {.inline.} =
|
||||
initPoolStringArray(result)
|
||||
|
|
@ -235,35 +235,35 @@ proc `=destroy`(self: PoolStringArray) {.inline.} =
|
|||
|
||||
proc add*(self: var PoolStringArray; data: GodotString) {.
|
||||
importc: "godot_pool_string_array_append",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolStringArray; data: GodotString) {.
|
||||
importc: "godot_pool_string_array_push_back",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolStringArray; arr: PoolStringArray) {.
|
||||
importc: "godot_pool_string_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolStringArray;
|
||||
idx: cint; data: GodotString): Error {.
|
||||
importc: "godot_pool_string_array_insert",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolStringArray; idx: cint) {.
|
||||
importc: "godot_pool_string_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_string_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolStringArray) {.
|
||||
importc: "godot_pool_string_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_string_array_invert", header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolStringArray; size: cint) {.
|
||||
importc: "godot_pool_string_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_string_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolStringArray; idx: cint;
|
||||
data: GodotString) {.
|
||||
importc: "godot_pool_string_array_set",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolStringArray; idx: cint): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_string_array_get",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolStringArray): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_string_array_size",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolStringArray): GodotString =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -276,17 +276,17 @@ iterator pairs*(arr: PoolStringArray): tuple[key: cint, val: GodotString] =
|
|||
# Vector2
|
||||
|
||||
proc initPoolVector2Array(dest: var PoolVector2Array) {.
|
||||
importc: "godot_pool_vector2_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolVector2Array(dest: var PoolVector2Array;
|
||||
src: PoolVector2Array) {.
|
||||
importc: "godot_pool_vector2_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolVector2Array(dest: var PoolVector2Array; arr: Array) {.
|
||||
importc: "godot_pool_vector2_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolVector2Array) {.
|
||||
importc: "godot_pool_vector2_array_destroy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_destroy", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolVector2Array*(): PoolVector2Array {.inline.} =
|
||||
initPoolVector2Array(result)
|
||||
|
|
@ -302,34 +302,34 @@ proc `=destroy`(self: PoolVector2Array) {.inline.} =
|
|||
|
||||
proc add*(self: var PoolVector2Array; data: Vector2) {.
|
||||
importc: "godot_pool_vector2_array_append",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolVector2Array; data: Vector2) {.
|
||||
importc: "godot_pool_vector2_array_push_back",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolVector2Array;
|
||||
arr: PoolVector2Array) {.
|
||||
importc: "godot_pool_vector2_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolVector2Array;
|
||||
idx: cint; data: Vector2): Error {.
|
||||
importc: "godot_pool_vector2_array_insert",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolVector2Array; idx: cint) {.
|
||||
importc: "godot_pool_vector2_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolVector2Array) {.
|
||||
importc: "godot_pool_vector2_array_invert",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolVector2Array; size: cint) {.
|
||||
importc: "godot_pool_vector2_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolVector2Array; idx: cint;
|
||||
data: ptr Vector2) {.
|
||||
importc: "godot_pool_vector2_array_set", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_set", header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolVector2Array; idx: cint): Vector2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_vector2_array_get", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_get", header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolVector2Array): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_vector2_array_size", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector2_array_size", header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolVector2Array): Vector2 =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -342,18 +342,18 @@ iterator pairs*(arr: PoolVector2Array): tuple[key: cint, val: Vector2] =
|
|||
# Vector3
|
||||
|
||||
proc initPoolVector3Array*(dest: var PoolVector3Array) {.
|
||||
importc: "godot_pool_vector3_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector3_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolVector3Array*(dest: var PoolVector3Array;
|
||||
src: PoolVector3Array) {.
|
||||
importc: "godot_pool_vector3_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolVector3Array*(dest: var PoolVector3Array; arr: Array) {.
|
||||
importc: "godot_pool_vector3_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolVector3Array) {.
|
||||
importc: "godot_pool_vector3_array_destroy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolVector3Array*(): PoolVector3Array {.inline.} =
|
||||
initPoolVector3Array(result)
|
||||
|
|
@ -370,38 +370,38 @@ proc `=destroy`(self: PoolVector3Array) {.inline.} =
|
|||
proc add*(self: var PoolVector3Array;
|
||||
data: Vector3) {.
|
||||
importc: "godot_pool_vector3_array_append",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolVector3Array;
|
||||
data: Vector3) {.
|
||||
importc: "godot_pool_vector3_array_push_back",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolVector3Array;
|
||||
arr: PoolVector3Array) {.
|
||||
importc: "godot_pool_vector3_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolVector3Array;
|
||||
idx: cint; data: Vector3): Error {.
|
||||
importc: "godot_pool_vector3_array_insert",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolVector3Array; idx: cint) {.
|
||||
importc: "godot_pool_vector3_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector3_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolVector3Array) {.
|
||||
importc: "godot_pool_vector3_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector3_array_invert", header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolVector3Array; size: cint) {.
|
||||
importc: "godot_pool_vector3_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_vector3_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolVector3Array;
|
||||
idx: cint; data: Vector3) {.
|
||||
importc: "godot_pool_vector3_array_set",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolVector3Array;
|
||||
idx: cint): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_vector3_array_get",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolVector3Array): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_vector3_array_size",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolVector3Array): Vector3 =
|
||||
for i in 0..<arr.len:
|
||||
|
|
@ -414,17 +414,17 @@ iterator pairs*(arr: PoolVector3Array): tuple[key: cint, val: Vector3] =
|
|||
# Color
|
||||
|
||||
proc initPoolColorArray(dest: var PoolColorArray) {.
|
||||
importc: "godot_pool_color_array_new", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_new", header: "godot/pool_arrays.h".}
|
||||
proc initPoolColorArray(dest: var PoolColorArray;
|
||||
src: PoolColorArray) {.
|
||||
importc: "godot_pool_color_array_new_copy",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc initPoolColorArray(dest: var PoolColorArray; arr: Array) {.
|
||||
importc: "godot_pool_color_array_new_with_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
|
||||
proc deinit(self: var PoolColorArray) {.
|
||||
importc: "godot_pool_color_array_destroy", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_destroy", header: "godot/pool_arrays.h".}
|
||||
|
||||
proc initPoolColorArray*(): PoolColorArray {.inline.} =
|
||||
initPoolColorArray(result)
|
||||
|
|
@ -440,32 +440,32 @@ proc `=destroy`(self: PoolColorArray) {.inline.} =
|
|||
|
||||
proc add*(self: var PoolColorArray; data: Color) {.
|
||||
importc: "godot_pool_color_array_append",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc addFirst*(self: var PoolColorArray; data: Color) {.
|
||||
importc: "godot_pool_color_array_push_back",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc add*(self: var PoolColorArray; arr: PoolColorArray) {.
|
||||
importc: "godot_pool_color_array_append_array",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc insert*(self: var PoolColorArray;
|
||||
idx: cint; data: Color): Error {.
|
||||
importc: "godot_pool_color_array_insert",
|
||||
header: "godot_pool_arrays.h".}
|
||||
header: "godot/pool_arrays.h".}
|
||||
proc delete*(self: var PoolColorArray; idx: cint) {.
|
||||
importc: "godot_pool_color_array_remove", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_remove", header: "godot/pool_arrays.h".}
|
||||
proc reverse*(self: var PoolColorArray) {.
|
||||
importc: "godot_pool_color_array_invert", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_invert", header: "godot/pool_arrays.h".}
|
||||
proc setLen*(self: var PoolColorArray; size: cint) {.
|
||||
importc: "godot_pool_color_array_resize", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_resize", header: "godot/pool_arrays.h".}
|
||||
proc `[]=`*(self: var PoolColorArray; idx: cint;
|
||||
data: Color) {.
|
||||
importc: "godot_pool_color_array_set", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_set", header: "godot/pool_arrays.h".}
|
||||
proc `[]`*(self: PoolColorArray; idx: cint): Color {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_color_array_get", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_get", header: "godot/pool_arrays.h".}
|
||||
proc len*(self: PoolColorArray): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_pool_color_array_size", header: "godot_pool_arrays.h".}
|
||||
importc: "godot_pool_color_array_size", header: "godot/pool_arrays.h".}
|
||||
|
||||
iterator items*(arr: PoolColorArray): Color =
|
||||
for i in 0..<arr.len:
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
import godotbase, vector3, strings
|
||||
|
||||
type
|
||||
Quat* {.importc: "godot_quat", header: "godot_quat.h", byref.} = object
|
||||
Quat* {.importc: "godot_quat", header: "godot/quat.h", byref.} = object
|
||||
|
||||
proc initQuat(dest: var Quat; x, y, z, w: float32) {.
|
||||
importc: "godot_quat_new", header: "godot_quat.h".}
|
||||
importc: "godot_quat_new", header: "godot/quat.h".}
|
||||
proc initQuat(dest: var Quat; axis: Vector3; angle: float32) {.
|
||||
importc: "godot_quat_new_with_axis_angle",
|
||||
header: "godot_quat.h".}
|
||||
header: "godot/quat.h".}
|
||||
|
||||
proc initQuat*(x, y, z, w: float32): Quat {.inline.} =
|
||||
initQuat(result, x, y, z, w)
|
||||
|
|
@ -19,96 +19,96 @@ proc initQuat*(axis: Vector3; angle: float32): Quat {.inline.} =
|
|||
|
||||
proc x*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_get_x", header: "godot_quat.h".}
|
||||
importc: "godot_quat_get_x", header: "godot/quat.h".}
|
||||
proc `x=`*(self: var Quat; val: float32) {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_set_x", header: "godot_quat.h".}
|
||||
importc: "godot_quat_set_x", header: "godot/quat.h".}
|
||||
proc y*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_get_y", header: "godot_quat.h".}
|
||||
importc: "godot_quat_get_y", header: "godot/quat.h".}
|
||||
proc `y=`*(self: var Quat; val: float32) {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_set_y", header: "godot_quat.h".}
|
||||
importc: "godot_quat_set_y", header: "godot/quat.h".}
|
||||
proc z*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_get_z", header: "godot_quat.h".}
|
||||
importc: "godot_quat_get_z", header: "godot/quat.h".}
|
||||
proc `z=`*(self: var Quat; val: float32) {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_set_z", header: "godot_quat.h".}
|
||||
importc: "godot_quat_set_z", header: "godot/quat.h".}
|
||||
proc w*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_get_w", header: "godot_quat.h".}
|
||||
importc: "godot_quat_get_w", header: "godot/quat.h".}
|
||||
proc `w=`*(self: var Quat; val: float32) {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_set_w", header: "godot_quat.h".}
|
||||
importc: "godot_quat_set_w", header: "godot/quat.h".}
|
||||
|
||||
proc toGodotString*(self: Quat): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_as_string", header: "godot_quat.h".}
|
||||
importc: "godot_quat_as_string", header: "godot/quat.h".}
|
||||
proc `$`*(self: Quat): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc length*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_length", header: "godot_quat.h".}
|
||||
importc: "godot_quat_length", header: "godot/quat.h".}
|
||||
proc lengthSquared*(self: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_length_squared", header: "godot_quat.h".}
|
||||
importc: "godot_quat_length_squared", header: "godot/quat.h".}
|
||||
proc normalized*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_normalized", header: "godot_quat.h".}
|
||||
importc: "godot_quat_normalized", header: "godot/quat.h".}
|
||||
proc isNormalized*(self: Quat): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_is_normalized", header: "godot_quat.h".}
|
||||
importc: "godot_quat_is_normalized", header: "godot/quat.h".}
|
||||
proc inverse*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_inverse", header: "godot_quat.h".}
|
||||
importc: "godot_quat_inverse", header: "godot/quat.h".}
|
||||
proc dot*(a, b: Quat): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_dot", header: "godot_quat.h".}
|
||||
importc: "godot_quat_dot", header: "godot/quat.h".}
|
||||
proc xform*(self: Quat; v: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_xform", header: "godot_quat.h".}
|
||||
importc: "godot_quat_xform", header: "godot/quat.h".}
|
||||
proc slerp*(self: Quat; b: Quat; t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_slerp", header: "godot_quat.h".}
|
||||
importc: "godot_quat_slerp", header: "godot/quat.h".}
|
||||
proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_slerpni", header: "godot_quat.h".}
|
||||
importc: "godot_quat_slerpni", header: "godot/quat.h".}
|
||||
proc cubicSlerp*(self, b, pre_a, post_b: Quat;
|
||||
t: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_cubic_slerp",
|
||||
header: "godot_quat.h".}
|
||||
header: "godot/quat.h".}
|
||||
proc `*`*(a: Quat, b: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_multiply",
|
||||
header: "godot_quat.h".}
|
||||
header: "godot/quat.h".}
|
||||
proc `*=`*(a: var Quat, b: float32) {.inline.} =
|
||||
a = a * b
|
||||
|
||||
proc `+`*(a, b: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_add", header: "godot_quat.h".}
|
||||
importc: "godot_quat_operator_add", header: "godot/quat.h".}
|
||||
proc `+=`*(a: var Quat, b: Quat) {.inline.} =
|
||||
a = a + b
|
||||
|
||||
proc `-`*(a, b: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_substract",
|
||||
header: "godot_quat.h".}
|
||||
header: "godot/quat.h".}
|
||||
proc `-=`* (a: var Quat, b: Quat) {.inline.} =
|
||||
a = a - b
|
||||
|
||||
proc `/`*(self: Quat; b: float32): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_divide", header: "godot_quat.h".}
|
||||
importc: "godot_quat_operator_divide", header: "godot/quat.h".}
|
||||
proc `/=`*(self: var Quat, b: float32) {.inline.} =
|
||||
self = self / b
|
||||
|
||||
proc `==`*(a, b: Quat): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_equal", header: "godot_quat.h".}
|
||||
importc: "godot_quat_operator_equal", header: "godot/quat.h".}
|
||||
proc `-`*(self: Quat): Quat {.
|
||||
noSideEffect,
|
||||
importc: "godot_quat_operator_neg", header: "godot_quat.h".}
|
||||
importc: "godot_quat_operator_neg", header: "godot/quat.h".}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
import godotbase, vector2, strings
|
||||
|
||||
type
|
||||
Rect2* {.importc: "godot_rect2", header: "godot_rect2.h", byref.} = object
|
||||
Rect2* {.importc: "godot_rect2", header: "godot/rect2.h", byref.} = object
|
||||
|
||||
proc initRect2(dest: var Rect2; pos, size: Vector2) {.
|
||||
importc: "godot_rect2_new_with_position_and_size",
|
||||
header: "godot_rect2.h".}
|
||||
header: "godot/rect2.h".}
|
||||
proc initRect2(dest: var Rect2; x, y, sizeX, sizeY: float32) {.
|
||||
importc: "godot_rect2_new", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_new", header: "godot/rect2.h".}
|
||||
|
||||
proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
||||
initRect2(result, pos, size)
|
||||
|
|
@ -19,50 +19,50 @@ proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} =
|
|||
|
||||
proc toGodotString*(self: Rect2): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_as_string", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_as_string", header: "godot/rect2.h".}
|
||||
proc `$`*(self: Rect2): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc area*(self: Rect2): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_get_area", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_get_area", header: "godot/rect2.h".}
|
||||
proc intersects*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_intersects", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_intersects", header: "godot/rect2.h".}
|
||||
proc encloses*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_encloses", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_encloses", header: "godot/rect2.h".}
|
||||
proc hasNoArea*(self: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_no_area", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_has_no_area", header: "godot/rect2.h".}
|
||||
proc clip*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_clip", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_clip", header: "godot/rect2.h".}
|
||||
proc merge*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_merge", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_merge", header: "godot/rect2.h".}
|
||||
proc contains*(self: Rect2; point: Vector2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_point", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_has_point", header: "godot/rect2.h".}
|
||||
proc grow*(self: Rect2; by: float32): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_grow", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_grow", header: "godot/rect2.h".}
|
||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_expand", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_expand", header: "godot/rect2.h".}
|
||||
proc `==`*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_operator_equal",
|
||||
header: "godot_rect2.h".}
|
||||
header: "godot/rect2.h".}
|
||||
proc position*(self: Rect2): Vector2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_get_position", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_get_position", header: "godot/rect2.h".}
|
||||
proc size*(self: Rect2): Vector2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_get_size", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_get_size", header: "godot/rect2.h".}
|
||||
proc setPosition*(self: var Rect2; pos: Vector2) {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_set_position", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_set_position", header: "godot/rect2.h".}
|
||||
proc setSize*(self: var Rect2; size: Vector2) {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_set_size", header: "godot_rect2.h".}
|
||||
importc: "godot_rect2_set_size", header: "godot/rect2.h".}
|
||||
|
|
|
|||
|
|
@ -3,98 +3,98 @@
|
|||
import godotbase, plane, vector3, strings
|
||||
|
||||
type
|
||||
Rect3* {.importc: "godot_rect3", header: "godot_rect3.h", byref.} = object
|
||||
Rect3* {.importc: "godot_rect3", header: "godot/rect3.h", byref.} = object
|
||||
|
||||
proc initRect3(dest: var Rect3; pos, size: Vector3) {.
|
||||
importc: "godot_rect3_new", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_new", header: "godot/rect3.h".}
|
||||
|
||||
proc initRect3*(pos, size: Vector3): Rect3 {.inline.} =
|
||||
initRect3(result, pos, size)
|
||||
|
||||
proc position*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_position", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_position", header: "godot/rect3.h".}
|
||||
proc setPosition*(self: var Rect3; v: Vector3) {.
|
||||
noSideEffect
|
||||
importc: "godot_rect3_set_position", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_set_position", header: "godot/rect3.h".}
|
||||
proc size*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_size", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_size", header: "godot/rect3.h".}
|
||||
proc setSize*(self: var Rect3; v: Vector3) {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_set_size", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_set_size", header: "godot/rect3.h".}
|
||||
proc toGodotString*(self: Rect3): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_as_string", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_as_string", header: "godot/rect3.h".}
|
||||
proc `$`*(self: Rect3): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
proc area*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_area", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_area", header: "godot/rect3.h".}
|
||||
proc hasNoArea*(self: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_no_area", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_has_no_area", header: "godot/rect3.h".}
|
||||
proc hasNoSurface*(self: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_no_surface", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_has_no_surface", header: "godot/rect3.h".}
|
||||
proc intersects*(a, b: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_intersects", header: "godot/rect3.h".}
|
||||
proc encloses*(self, other: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_encloses", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_encloses", header: "godot/rect3.h".}
|
||||
proc merge*(self, other: Rect3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_merge", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_merge", header: "godot/rect3.h".}
|
||||
proc intersection*(self, other: Rect3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersection", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_intersection", header: "godot/rect3.h".}
|
||||
proc intersectsPlane*(self: Rect3; plane: Plane): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects_plane",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_intersects_segment",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc contains*(self: Rect3; point: Vector3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_has_point", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_has_point", header: "godot/rect3.h".}
|
||||
proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_support", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_support", header: "godot/rect3.h".}
|
||||
proc getLongestAxis*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_longest_axis", header: "godot/rect3.h".}
|
||||
proc getLongestAxisIndex*(self: Rect3): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis_index",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc getLongestAxisSize*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_longest_axis_size",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc getShortestAxis*(self: Rect3): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_shortest_axis", header: "godot/rect3.h".}
|
||||
proc getShortestAxisIndex*(self: Rect3): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis_index",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc getShortestAxisSize*(self: Rect3): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_shortest_axis_size",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_expand", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_expand", header: "godot/rect3.h".}
|
||||
proc grow*(self: Rect3; by: float32): Rect3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_grow", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_grow", header: "godot/rect3.h".}
|
||||
proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_get_endpoint", header: "godot_rect3.h".}
|
||||
importc: "godot_rect3_get_endpoint", header: "godot/rect3.h".}
|
||||
proc `==`*(a, b: Rect3): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect3_operator_equal",
|
||||
header: "godot_rect3.h".}
|
||||
header: "godot/rect3.h".}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import godotbase
|
||||
|
||||
type
|
||||
RID* {.importc: "godot_rid", header: "godot_rid.h", byref.} = object
|
||||
RID* {.importc: "godot_rid", header: "godot/rid.h", byref.} = object
|
||||
|
||||
proc initRID(dest: var RID) {.
|
||||
importc: "godot_rid_new",
|
||||
header: "godot_rid.h".}
|
||||
header: "godot/rid.h".}
|
||||
proc initRID(dest: var RID; obj: ptr GodotObject) {.
|
||||
importc: "godot_rid_new_with_resource", header: "godot_rid.h".}
|
||||
importc: "godot_rid_new_with_resource", header: "godot/rid.h".}
|
||||
|
||||
proc initRID*(): RID {.inline.} =
|
||||
initRID(result)
|
||||
|
|
@ -17,12 +17,12 @@ proc initRID*(obj: ptr GodotObject): RID {.inline.} =
|
|||
|
||||
proc idCInt(self: RID): cint {.
|
||||
noSideEffect,
|
||||
importc: "godot_rid_get_id", header: "godot_rid.h".}
|
||||
importc: "godot_rid_get_id", header: "godot/rid.h".}
|
||||
|
||||
proc id*(self: RID): uint32 {.inline.} =
|
||||
cast[uint32](self.idCInt())
|
||||
|
||||
proc `==`*(a, b: RID): bool {.
|
||||
importc: "godot_rid_operator_equal", header: "godot_rid.h".}
|
||||
importc: "godot_rid_operator_equal", header: "godot/rid.h".}
|
||||
proc `<`*(a, b: RID): bool {.
|
||||
importc: "godot_rid_operator_less", header: "godot_rid.h".}
|
||||
importc: "godot_rid_operator_less", header: "godot/rid.h".}
|
||||
|
|
|
|||
|
|
@ -3,22 +3,22 @@
|
|||
import godotbase
|
||||
|
||||
type
|
||||
GodotString* {.importc: "godot_string", header: "godot_string.h",
|
||||
GodotString* {.importc: "godot_string", header: "godot/string.h",
|
||||
byref.} = object
|
||||
|
||||
proc initGodotString(dest: var GodotString) {.
|
||||
importc: "godot_string_new", header: "godot_string.h".}
|
||||
importc: "godot_string_new", header: "godot/string.h".}
|
||||
proc initGodotString(dest: var GodotString; src: GodotString) {.
|
||||
importc: "godot_string_new_copy", header: "godot_string.h".}
|
||||
importc: "godot_string_new_copy", header: "godot/string.h".}
|
||||
proc initGodotString(dest: var GodotString; contents: cstring;
|
||||
size: cint) {.
|
||||
importc: "godot_string_new_data", header: "godot_string.h".}
|
||||
importc: "godot_string_new_data", header: "godot/string.h".}
|
||||
## Initializes ``dest`` from UTF-8 ``contents``
|
||||
proc getData(self: GodotString; dest: cstring;
|
||||
size: var cint) {.
|
||||
noSideEffect
|
||||
importc: "godot_string_get_data",
|
||||
header: "godot_string.h".}
|
||||
header: "godot/string.h".}
|
||||
## Converts ``self`` into UTF-8 encoding, putting the result into ``dest``.
|
||||
|
||||
proc len*(self: GodotString): cint {.inline.} =
|
||||
|
|
@ -26,19 +26,19 @@ proc len*(self: GodotString): cint {.inline.} =
|
|||
getData(self, nil, result)
|
||||
|
||||
proc cstring*(self: GodotString): cstring {.
|
||||
importc: "godot_string_c_str", header: "godot_string.h".}
|
||||
importc: "godot_string_c_str", header: "godot/string.h".}
|
||||
proc `==`*(self, b: GodotString): bool {.
|
||||
importc: "godot_string_operator_equal",
|
||||
header: "godot_string.h".}
|
||||
header: "godot/string.h".}
|
||||
proc `<`*(self, b: GodotString): bool {.
|
||||
importc: "godot_string_operator_less",
|
||||
header: "godot_string.h".}
|
||||
header: "godot/string.h".}
|
||||
proc `&`*(self, b: GodotString): GodotString {.
|
||||
importc: "godot_string_operator_plus",
|
||||
header: "godot_string.h".}
|
||||
header: "godot/string.h".}
|
||||
|
||||
proc deinit*(self: var GodotString) {.importc: "godot_string_destroy",
|
||||
header: "godot_string.h".}
|
||||
header: "godot/string.h".}
|
||||
proc `=destroy`(self: GodotString) {.inline.} =
|
||||
unsafeAddr(self).deinit()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Transform* {.importc: "godot_transform", header: "godot_transform.h",
|
||||
Transform* {.importc: "godot_transform", header: "godot/transform.h",
|
||||
byref.} = object
|
||||
|
||||
import godotbase, basis, variant, vector3, strings, plane, rect3
|
||||
|
||||
proc initTransform(dest: var Transform) {.
|
||||
importc: "godot_transform_new_identity", header: "godot_transform.h".}
|
||||
importc: "godot_transform_new_identity", header: "godot/transform.h".}
|
||||
## Initializes the ``dest`` as identity transform.
|
||||
proc initTransform(dest: var Transform;
|
||||
xAxis, yAxis, zAxis, origin: Vector3) {.
|
||||
importc: "godot_transform_new_with_axis_origin",
|
||||
header: "godot_transform.h".}
|
||||
header: "godot/transform.h".}
|
||||
proc initTransform(dest: var Transform; basis: Basis;
|
||||
origin: Vector3) {.
|
||||
importc: "godot_transform_new",
|
||||
header: "godot_transform.h".}
|
||||
header: "godot/transform.h".}
|
||||
|
||||
proc initTransform*(): Transform {.inline.} =
|
||||
initTransform(result)
|
||||
|
|
@ -29,54 +29,54 @@ proc initTransform*(basis: Basis, origin: Vector3): Transform {.inline.} =
|
|||
initTransform(result, basis, origin)
|
||||
|
||||
proc basis*(self: Transform): Basis {.
|
||||
importc: "godot_transform_get_basis", header: "godot_transform.h".}
|
||||
importc: "godot_transform_get_basis", header: "godot/transform.h".}
|
||||
proc `basis=`*(self: var Transform; v: Basis) {.
|
||||
importc: "godot_transform_set_basis", header: "godot_transform.h".}
|
||||
importc: "godot_transform_set_basis", header: "godot/transform.h".}
|
||||
proc origin*(self: Transform): Vector3 {.
|
||||
importc: "godot_transform_get_origin", header: "godot_transform.h".}
|
||||
importc: "godot_transform_get_origin", header: "godot/transform.h".}
|
||||
proc `origin=`*(self: var Transform; v: Vector3) {.
|
||||
importc: "godot_transform_set_origin", header: "godot_transform.h".}
|
||||
importc: "godot_transform_set_origin", header: "godot/transform.h".}
|
||||
|
||||
proc toGodotString*(self: Transform): GodotString {.
|
||||
importc: "godot_transform_as_string", header: "godot_transform.h".}
|
||||
importc: "godot_transform_as_string", header: "godot/transform.h".}
|
||||
proc `$`*(self: Transform): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc inverse*(self: Transform): Transform {.
|
||||
importc: "godot_transform_inverse", header: "godot_transform.h".}
|
||||
importc: "godot_transform_inverse", header: "godot/transform.h".}
|
||||
proc affineInverse*(self: Transform): Transform {.
|
||||
importc: "godot_transform_affine_inverse",
|
||||
header: "godot_transform.h".}
|
||||
header: "godot/transform.h".}
|
||||
proc orthonormalized*(self: Transform): Transform {.
|
||||
importc: "godot_transform_orthonormalized",
|
||||
header: "godot_transform.h".}
|
||||
header: "godot/transform.h".}
|
||||
proc rotated*(self: Transform; axis: Vector3;
|
||||
phi: float32): Transform {.
|
||||
importc: "godot_transform_rotated", header: "godot_transform.h".}
|
||||
importc: "godot_transform_rotated", header: "godot/transform.h".}
|
||||
proc scaled*(self: Transform; scale: Vector3): Transform {.
|
||||
importc: "godot_transform_scaled", header: "godot_transform.h".}
|
||||
importc: "godot_transform_scaled", header: "godot/transform.h".}
|
||||
proc translated*(self: Transform; offset: Vector3): Transform {.
|
||||
importc: "godot_transform_translated", header: "godot_transform.h".}
|
||||
importc: "godot_transform_translated", header: "godot/transform.h".}
|
||||
proc lookingAt*(self: Transform;
|
||||
target, up: Vector3): Transform {.
|
||||
importc: "godot_transform_looking_at", header: "godot_transform.h".}
|
||||
importc: "godot_transform_looking_at", header: "godot/transform.h".}
|
||||
|
||||
proc xformPlane*(self: Transform; v: Plane): Plane {.
|
||||
importc: "godot_transform_xform_plane", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_plane", header: "godot/transform.h".}
|
||||
proc xformInvPlane*(self: Transform; v: Plane): Plane {.
|
||||
importc: "godot_transform_xform_inv_plane", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_inv_plane", header: "godot/transform.h".}
|
||||
proc xformVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||
importc: "godot_transform_xform_vector3", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_vector3", header: "godot/transform.h".}
|
||||
proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||
importc: "godot_transform_xform_inv_vector3", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_inv_vector3", header: "godot/transform.h".}
|
||||
proc xformRect3*(self: Transform; v: Vector3): Rect3 {.
|
||||
importc: "godot_transform_xform_rect3", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_rect3", header: "godot/transform.h".}
|
||||
proc xformInvRect3*(self: Transform; v: Vector3): Vector3 {.
|
||||
importc: "godot_transform_xform_inv_rect3", header: "godot_transform.h".}
|
||||
importc: "godot_transform_xform_inv_rect3", header: "godot/transform.h".}
|
||||
|
||||
proc `==`*(self: Transform; b: Transform): bool {.
|
||||
importc: "godot_transform_operator_equal", header: "godot_transform.h".}
|
||||
importc: "godot_transform_operator_equal", header: "godot/transform.h".}
|
||||
proc `*`*(a, b: Transform): Transform {.
|
||||
importc: "godot_transform_operator_multiply", header: "godot_transform.h".}
|
||||
importc: "godot_transform_operator_multiply", header: "godot/transform.h".}
|
||||
proc `*=`*(a: var Transform, b: Transform) {.inline.} =
|
||||
a = a * b
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Transform2D* {.importc: "godot_transform2d", header: "godot_transform2d.h",
|
||||
Transform2D* {.importc: "godot_transform2d", header: "godot/transform2d.h",
|
||||
byref.} = object
|
||||
|
||||
import godotbase, strings, variant, vector2, rect2
|
||||
|
||||
proc initTransform2D(dest: var Transform2D) {.
|
||||
importc: "godot_transform2d_new_identity", header: "godot_transform2d.h".}
|
||||
importc: "godot_transform2d_new_identity", header: "godot/transform2d.h".}
|
||||
proc initTransform2D(dest: var Transform2D; rot: float32; pos: Vector2) {.
|
||||
importc: "godot_transform2d_new", header: "godot_transform2d.h".}
|
||||
importc: "godot_transform2d_new", header: "godot/transform2d.h".}
|
||||
proc initTransform2D(dest: var Transform2D; xAxis, yAxis, origin: Vector2) {.
|
||||
importc: "godot_transform2d_new_axis_origin",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
|
||||
proc initTransform2D*(): Transform2D {.inline.} =
|
||||
initTransform2D(result)
|
||||
|
|
@ -25,67 +25,67 @@ proc initTransform2D*(xAxis, yAxis, origin: Vector2): Transform2D {.inline.} =
|
|||
|
||||
proc toGodotString*(self: Transform2D): GodotString {.
|
||||
importc: "godot_transform2d_as_string",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc `$`*(self: Transform2D): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc inverse*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_inverse", header: "godot_transform2d.h".}
|
||||
importc: "godot_transform2d_inverse", header: "godot/transform2d.h".}
|
||||
proc affineInverse*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_affine_inverse",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc rotation*(self: Transform2D): float32 {.
|
||||
importc: "godot_transform2d_get_rotation",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc origin*(self: Transform2D): Vector2 {.
|
||||
importc: "godot_transform2d_get_origin",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc scale*(self: Transform2D): Vector2 {.
|
||||
importc: "godot_transform2d_get_scale",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc orthonormalized*(self: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_orthonormalized",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc rotated*(self: Transform2D; phi: float32): Transform2D {.
|
||||
importc: "godot_transform2d_rotated",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.
|
||||
importc: "godot_transform2d_scaled",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc translated*(self: Transform2D;
|
||||
offset: Vector2): Transform2D {.
|
||||
importc: "godot_transform2d_translated",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_xform_vector2",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_xform_inv_vector2",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc basisXformVector2*(self: Transform2D;
|
||||
v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_basis_xform_vector2",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc basisXformInvVector2*(self: Transform2D;
|
||||
v: Vector2): Vector2 {.
|
||||
importc: "godot_transform2d_basis_xform_inv_vector2",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc xformRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||
importc: "godot_transform2d_xform_rect2", header: "godot_transform2d.h".}
|
||||
importc: "godot_transform2d_xform_rect2", header: "godot/transform2d.h".}
|
||||
proc xformInvRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||
importc: "godot_transform2d_xform_inv_rect2",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
|
||||
proc interpolateWith*(self, m: Transform2D;
|
||||
c: float32): Transform2D {.
|
||||
importc: "godot_transform2d_interpolate_with",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc `==`*(a, b: Transform2D): bool {.
|
||||
importc: "godot_transform2d_operator_equal",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
proc `*`*(a, b: Transform2D): Transform2D {.
|
||||
importc: "godot_transform2d_operator_multiply",
|
||||
header: "godot_transform2d.h".}
|
||||
header: "godot/transform2d.h".}
|
||||
|
||||
proc `*=`*(a: var Transform2D, b: Transform2D) {.inline.} =
|
||||
a = a * b
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import strings, transform, transform2d, vector2
|
|||
import vector3, color
|
||||
|
||||
type
|
||||
VariantType* {.importc: "godot_variant_type", header: "godot_variant.h",
|
||||
VariantType* {.importc: "godot_variant_type", header: "godot/variant.h",
|
||||
size: sizeof(cint), pure.} = enum
|
||||
Nil, ## atomic types
|
||||
Bool,
|
||||
|
|
@ -39,7 +39,7 @@ type
|
|||
PoolColorArray
|
||||
|
||||
VariantCallErrorType* {.importc: "godot_variant_call_error_error",
|
||||
header: "godot_variant.h",
|
||||
header: "godot/variant.h",
|
||||
size: sizeof(cint),
|
||||
pure.} = enum
|
||||
OK,
|
||||
|
|
@ -50,79 +50,79 @@ type
|
|||
InstanceIsNull
|
||||
|
||||
VariantCallError* {.importc: "godot_variant_call_error",
|
||||
header: "godot_variant.h".} = object
|
||||
header: "godot/variant.h".} = object
|
||||
error* {.importc: "error".}: VariantCallErrorType
|
||||
argument* {.importc: "argument".}: cint
|
||||
expected* {.importc: "expected".}: VariantType
|
||||
|
||||
proc getType*(p: Variant): VariantType {.
|
||||
importc: "godot_variant_get_type", header: "godot_variant.h".}
|
||||
importc: "godot_variant_get_type", header: "godot/variant.h".}
|
||||
|
||||
proc initNilVariant(dest: var Variant) {.
|
||||
importc: "godot_variant_new_nil", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_nil", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; b: bool) {.
|
||||
importc: "godot_variant_new_bool", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_bool", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; i: uint64) {.
|
||||
importc: "godot_variant_new_uint", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_uint", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; i: int64) {.
|
||||
importc: "godot_variant_new_int", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_int", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; r: cdouble) {.
|
||||
importc: "godot_variant_new_real", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_real", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; s: GodotString) {.
|
||||
importc: "godot_variant_new_string", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_string", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; v2: Vector2) {.
|
||||
importc: "godot_variant_new_vector2", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_vector2", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; rect2: Rect2) {.
|
||||
importc: "godot_variant_new_rect2", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_rect2", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; v3: Vector3) {.
|
||||
importc: "godot_variant_new_vector3", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_vector3", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; t2d: Transform2D) {.
|
||||
importc: "godot_variant_new_transform2d",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; plane: Plane) {.
|
||||
importc: "godot_variant_new_plane", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_plane", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; quat: Quat) {.
|
||||
importc: "godot_variant_new_quat", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_quat", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; rect3: Rect3) {.
|
||||
importc: "godot_variant_new_rect3", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_rect3", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; basis: Basis) {.
|
||||
importc: "godot_variant_new_basis", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_basis", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant;
|
||||
trans: Transform) {.
|
||||
importc: "godot_variant_new_transform",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; color: Color) {.
|
||||
importc: "godot_variant_new_color", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_color", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; nodePath: NodePath) {.
|
||||
importc: "godot_variant_new_node_path",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; rid: RID) {.
|
||||
importc: "godot_variant_new_rid", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_rid", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; obj: ptr GodotObject) {.
|
||||
importc: "godot_variant_new_object", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_object", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; arr: Array) {.
|
||||
importc: "godot_variant_new_array", header: "godot_variant.h".}
|
||||
importc: "godot_variant_new_array", header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pba: PoolByteArray) {.
|
||||
importc: "godot_variant_new_pool_byte_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pia: PoolIntArray) {.
|
||||
importc: "godot_variant_new_pool_int_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pra: PoolRealArray) {.
|
||||
importc: "godot_variant_new_pool_real_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; psa: PoolStringArray) {.
|
||||
importc: "godot_variant_new_pool_string_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pv2a: PoolVector2Array) {.
|
||||
importc: "godot_variant_new_pool_vector2_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pv3a: PoolVector3Array) {.
|
||||
importc: "godot_variant_new_pool_vector3_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc initVariant(dest: var Variant; pca: PoolColorArray) {.
|
||||
importc: "godot_variant_new_pool_color_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
|
||||
proc variant*(): Variant {.inline.} =
|
||||
initNilVariant(result)
|
||||
|
|
@ -210,82 +210,82 @@ proc variant*(pca: PoolColorArray): Variant {.inline.} =
|
|||
initVariant(result, pca)
|
||||
|
||||
proc asBool*(self: Variant): bool {.
|
||||
importc: "godot_variant_as_bool", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_bool", header: "godot/variant.h".}
|
||||
proc asUint*(self: Variant): uint64 {.
|
||||
importc: "godot_variant_as_uint", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_uint", header: "godot/variant.h".}
|
||||
proc asInt*(self: Variant): int64 {.
|
||||
importc: "godot_variant_as_int", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_int", header: "godot/variant.h".}
|
||||
proc asReal*(self: Variant): cdouble {.
|
||||
importc: "godot_variant_as_real", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_real", header: "godot/variant.h".}
|
||||
proc asGodotString*(self: Variant): GodotString {.
|
||||
importc: "godot_variant_as_string", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_string", header: "godot/variant.h".}
|
||||
|
||||
proc asString*(self: Variant): string =
|
||||
let s = self.asGodotString()
|
||||
result = $s
|
||||
|
||||
proc asVector2*(self: Variant): Vector2 {.
|
||||
importc: "godot_variant_as_vector2", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_vector2", header: "godot/variant.h".}
|
||||
proc asRect2*(self: Variant): Rect2 {.
|
||||
importc: "godot_variant_as_rect2", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_rect2", header: "godot/variant.h".}
|
||||
proc asVector3*(self: Variant): Vector3 {.
|
||||
importc: "godot_variant_as_vector3", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_vector3", header: "godot/variant.h".}
|
||||
proc asTransform2D*(self: Variant): Transform2D {.
|
||||
importc: "godot_variant_as_transform2d", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_transform2d", header: "godot/variant.h".}
|
||||
proc asPlane*(self: Variant): Plane {.
|
||||
importc: "godot_variant_as_plane", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_plane", header: "godot/variant.h".}
|
||||
proc asQuat*(self: Variant): Quat {.
|
||||
importc: "godot_variant_as_quat", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_quat", header: "godot/variant.h".}
|
||||
proc asRect3*(self: Variant): Rect3 {.
|
||||
importc: "godot_variant_as_rect3", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_rect3", header: "godot/variant.h".}
|
||||
proc asBasis*(self: Variant): Basis {.
|
||||
importc: "godot_variant_as_basis", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_basis", header: "godot/variant.h".}
|
||||
proc asTransform*(self: Variant): Transform {.
|
||||
importc: "godot_variant_as_transform", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_transform", header: "godot/variant.h".}
|
||||
proc asColor*(self: Variant): Color {.
|
||||
importc: "godot_variant_as_color", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_color", header: "godot/variant.h".}
|
||||
proc asNodePath*(self: Variant): NodePath {.
|
||||
importc: "godot_variant_as_node_path", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_node_path", header: "godot/variant.h".}
|
||||
proc asRid*(self: Variant): RID {.
|
||||
importc: "godot_variant_as_rid", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_rid", header: "godot/variant.h".}
|
||||
proc asObject*(self: Variant): ptr GodotObject {.
|
||||
importc: "godot_variant_as_object", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_object", header: "godot/variant.h".}
|
||||
proc asArray*(self: Variant): Array {.
|
||||
importc: "godot_variant_as_array", header: "godot_variant.h".}
|
||||
importc: "godot_variant_as_array", header: "godot/variant.h".}
|
||||
proc asPoolByteArray*(self: Variant): PoolByteArray {.
|
||||
importc: "godot_variant_as_pool_byte_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolIntArray*(self: Variant): PoolIntArray {.
|
||||
importc: "godot_variant_as_pool_int_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolRealArray*(self: Variant): PoolRealArray {.
|
||||
importc: "godot_variant_as_pool_real_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolStringArray*(self: Variant): PoolStringArray {.
|
||||
importc: "godot_variant_as_pool_string_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolVector2Array*(self: Variant): PoolVector2Array {.
|
||||
importc: "godot_variant_as_pool_vector2_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolVector3Array*(self: Variant): PoolVector3Array {.
|
||||
importc: "godot_variant_as_pool_vector3_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
proc asPoolColorArray*(self: Variant): PoolColorArray {.
|
||||
importc: "godot_variant_as_pool_color_array",
|
||||
header: "godot_variant.h".}
|
||||
header: "godot/variant.h".}
|
||||
|
||||
proc call*(self: Variant; meth: GodotString;
|
||||
args: var array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
||||
error: var VariantCallError): Variant {.
|
||||
importc: "godot_variant_call", header: "godot_variant.h".}
|
||||
importc: "godot_variant_call", header: "godot/variant.h".}
|
||||
|
||||
proc hasMethod*(self: Variant; meth: GodotString): bool {.
|
||||
importc: "godot_variant_has_method", header: "godot_variant.h".}
|
||||
importc: "godot_variant_has_method", header: "godot/variant.h".}
|
||||
proc `==`*(self, other: Variant): bool {.
|
||||
importc: "godot_variant_operator_equal", header: "godot_variant.h".}
|
||||
importc: "godot_variant_operator_equal", header: "godot/variant.h".}
|
||||
proc `<`*(self, other: Variant): bool {.
|
||||
importc: "godot_variant_operator_less", header: "godot_variant.h".}
|
||||
importc: "godot_variant_operator_less", header: "godot/variant.h".}
|
||||
proc hashCompare*(self, other: Variant): bool {.
|
||||
importc: "godot_variant_hash_compare", header: "godot_variant.h".}
|
||||
importc: "godot_variant_hash_compare", header: "godot/variant.h".}
|
||||
proc booleanize*(self: Variant; isValid: var bool): bool {.
|
||||
importc: "godot_variant_booleanize", header: "godot_variant.h".}
|
||||
importc: "godot_variant_booleanize", header: "godot/variant.h".}
|
||||
|
|
|
|||
|
|
@ -1,117 +1,117 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Vector2* {.importc: "godot_vector2", header: "godot_vector2.h",
|
||||
Vector2* {.importc: "godot_vector2", header: "godot/vector2.h",
|
||||
byref.} = object
|
||||
|
||||
import godotbase, strings
|
||||
|
||||
proc initVector2(dest: var Vector2; x, y: float32) {.
|
||||
importc: "godot_vector2_new", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_new", header: "godot/vector2.h".}
|
||||
|
||||
proc vec2*(x, y: float32): Vector2 {.inline.} =
|
||||
initVector2(result, x, y)
|
||||
|
||||
proc toGodotString*(self: Vector2): GodotString {.
|
||||
importc: "godot_vector2_as_string", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_as_string", header: "godot/vector2.h".}
|
||||
proc `$`*(self: Vector2): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc normalized*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_normalized", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_normalized", header: "godot/vector2.h".}
|
||||
proc length*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_length", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_length", header: "godot/vector2.h".}
|
||||
proc angle*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_angle", header: "godot/vector2.h".}
|
||||
proc lengthSquared*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_length_squared", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_length_squared", header: "godot/vector2.h".}
|
||||
proc isNormalized*(self: Vector2): bool {.
|
||||
importc: "godot_vector2_is_normalized", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_is_normalized", header: "godot/vector2.h".}
|
||||
proc distanceTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_distance_to",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc distanceSquaredTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_distance_squared_to",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc angleTo*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle_to", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_angle_to", header: "godot/vector2.h".}
|
||||
proc angleToPoint*(self, to: Vector2): float32 {.
|
||||
importc: "godot_vector2_angle_to_point",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc lerp*(self, b: Vector2; t: float32): Vector2 {.
|
||||
importc: "godot_vector2_linear_interpolate",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc cubicInterpolate*(self, b, pre_a, post_b: Vector2; t: float32): Vector2 {.
|
||||
importc: "godot_vector2_cubic_interpolate",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc rotated*(self: Vector2; phi: float32): Vector2 {.
|
||||
importc: "godot_vector2_rotated", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_rotated", header: "godot/vector2.h".}
|
||||
proc tangent*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_tangent", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_tangent", header: "godot/vector2.h".}
|
||||
proc floor*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_floor", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_floor", header: "godot/vector2.h".}
|
||||
proc snapped*(self: Vector2; by: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_snapped", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_snapped", header: "godot/vector2.h".}
|
||||
proc aspect*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_aspect", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_aspect", header: "godot/vector2.h".}
|
||||
proc dot*(a, b: Vector2): float32 {.
|
||||
importc: "godot_vector2_dot", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_dot", header: "godot/vector2.h".}
|
||||
proc slide*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_slide", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_slide", header: "godot/vector2.h".}
|
||||
proc bounce*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_bounce", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_bounce", header: "godot/vector2.h".}
|
||||
proc reflect*(self, n: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_reflect", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_reflect", header: "godot/vector2.h".}
|
||||
proc abs*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_abs", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_abs", header: "godot/vector2.h".}
|
||||
proc clamped*(self: Vector2; length: float32): Vector2 {.
|
||||
importc: "godot_vector2_clamped", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_clamped", header: "godot/vector2.h".}
|
||||
|
||||
proc `+`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_add", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_add", header: "godot/vector2.h".}
|
||||
proc `+=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a += b
|
||||
|
||||
proc `-`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_substract", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_substract", header: "godot/vector2.h".}
|
||||
proc `-=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a - b
|
||||
|
||||
proc `*`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_multiply_vector",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
|
||||
proc `*=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a * b
|
||||
|
||||
proc `*`*(self: Vector2, scalar: float32): Vector2 {.
|
||||
importc: "godot_vector2_operator_multiply_scalar",
|
||||
header: "godot_vector2.h".}
|
||||
header: "godot/vector2.h".}
|
||||
proc `*=`*(self: var Vector2, scalar: float32) {.inline.} =
|
||||
self = self * scalar
|
||||
|
||||
proc `/`*(a, b: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_divide_vector", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_divide_vector", header: "godot/vector2.h".}
|
||||
proc `/=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||
a = a / b
|
||||
|
||||
proc `/`*(self: Vector2; scalar: float32): Vector2 {.
|
||||
importc: "godot_vector2_operator_divide_scalar", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_divide_scalar", header: "godot/vector2.h".}
|
||||
proc `/=`*(self: var Vector2; scalar: float32) {.inline.} =
|
||||
self = self / scalar
|
||||
|
||||
proc `==`*(a, b: Vector2): bool {.
|
||||
importc: "godot_vector2_operator_equal", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_equal", header: "godot/vector2.h".}
|
||||
proc `<`*(a, b: Vector2): bool {.
|
||||
importc: "godot_vector2_operator_less", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_less", header: "godot/vector2.h".}
|
||||
proc `-`*(self: Vector2): Vector2 {.
|
||||
importc: "godot_vector2_operator_neg", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_operator_neg", header: "godot/vector2.h".}
|
||||
|
||||
proc `x=`*(self: var Vector2; x: float32) {.
|
||||
importc: "godot_vector2_set_x", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_set_x", header: "godot/vector2.h".}
|
||||
proc `y=`*(self: var Vector2; y: float32) {.
|
||||
importc: "godot_vector2_set_y", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_set_y", header: "godot/vector2.h".}
|
||||
proc x*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_get_x", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_get_x", header: "godot/vector2.h".}
|
||||
proc y*(self: Vector2): float32 {.
|
||||
importc: "godot_vector2_get_y", header: "godot_vector2.h".}
|
||||
importc: "godot_vector2_get_y", header: "godot/vector2.h".}
|
||||
|
|
|
|||
|
|
@ -1,126 +1,126 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
type
|
||||
Vector3* {.importc: "godot_vector3", header: "godot_vector3.h",
|
||||
Vector3* {.importc: "godot_vector3", header: "godot/vector3.h",
|
||||
byref.} = object
|
||||
|
||||
import godotbase, basis, strings
|
||||
|
||||
type
|
||||
Vector3Axis {.importc: "godot_vector3_axis", header: "godot_vector3.h",
|
||||
Vector3Axis {.importc: "godot_vector3_axis", header: "godot/vector3.h",
|
||||
size: sizeof(cint), pure.} = enum
|
||||
X,
|
||||
Y,
|
||||
Z
|
||||
|
||||
proc initVector3*(dest: var Vector3; x, y, z: float32) {.
|
||||
importc: "godot_vector3_new", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_new", header: "godot/vector3.h".}
|
||||
|
||||
proc vec3*(x, y, z: float32): Vector3 {.inline.} =
|
||||
initVector3(result, x, y, z)
|
||||
|
||||
proc toGodotString*(self: Vector3): GodotString {.
|
||||
importc: "godot_vector3_as_string", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_as_string", header: "godot/vector3.h".}
|
||||
proc `$`*(self: Vector3): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
|
||||
proc minAxis*(self: Vector3): cint {.
|
||||
importc: "godot_vector3_min_axis", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_min_axis", header: "godot/vector3.h".}
|
||||
proc maxAxis*(self: Vector3): cint {.
|
||||
importc: "godot_vector3_max_axis", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_max_axis", header: "godot/vector3.h".}
|
||||
proc length*(self: Vector3): float32 {.
|
||||
importc: "godot_vector3_length", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_length", header: "godot/vector3.h".}
|
||||
proc lengthSquared*(self: Vector3): float32 {.
|
||||
importc: "godot_vector3_length_squared", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_length_squared", header: "godot/vector3.h".}
|
||||
proc isNormalized*(self: Vector3): bool {.
|
||||
importc: "godot_vector3_is_normalized", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_is_normalized", header: "godot/vector3.h".}
|
||||
proc normalized*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_normalized", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_normalized", header: "godot/vector3.h".}
|
||||
proc inverse*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_inverse", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_inverse", header: "godot/vector3.h".}
|
||||
proc snapped*(self: Vector3; by: float32): Vector3 {.
|
||||
importc: "godot_vector3_snapped", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_snapped", header: "godot/vector3.h".}
|
||||
proc rotated*(self: Vector3; axis: Vector3;
|
||||
phi: float32): Vector3 {.
|
||||
importc: "godot_vector3_rotated", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_rotated", header: "godot/vector3.h".}
|
||||
proc lerp*(self: Vector3; b: Vector3; t: float32): Vector3 {.
|
||||
importc: "godot_vector3_linear_interpolate", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_linear_interpolate", header: "godot/vector3.h".}
|
||||
proc cubicInterpolate*(self, b, preA, postB: Vector3;
|
||||
t: float32): Vector3 {.
|
||||
importc: "godot_vector3_cubic_interpolate", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_cubic_interpolate", header: "godot/vector3.h".}
|
||||
proc dot*(a, b: Vector3): float32 {.
|
||||
importc: "godot_vector3_dot", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_dot", header: "godot/vector3.h".}
|
||||
proc cross*(a, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_cross", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_cross", header: "godot/vector3.h".}
|
||||
proc outer*(a, b: Vector3): Basis {.
|
||||
importc: "godot_vector3_outer", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_outer", header: "godot/vector3.h".}
|
||||
proc toDiagonalMatrix*(self: Vector3): Basis {.
|
||||
importc: "godot_vector3_to_diagonal_matrix", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_to_diagonal_matrix", header: "godot/vector3.h".}
|
||||
proc abs*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_abs", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_abs", header: "godot/vector3.h".}
|
||||
proc floor*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_floor", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_floor", header: "godot/vector3.h".}
|
||||
proc ceil*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_ceil", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_ceil", header: "godot/vector3.h".}
|
||||
proc distanceTo*(a, b: Vector3): float32 {.
|
||||
importc: "godot_vector3_distance_to", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_distance_to", header: "godot/vector3.h".}
|
||||
proc distanceSquaredTo*(a, b: Vector3): float32 {.
|
||||
importc: "godot_vector3_distance_squared_to", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_distance_squared_to", header: "godot/vector3.h".}
|
||||
proc angleTo*(self, to: Vector3): float32 {.
|
||||
importc: "godot_vector3_angle_to", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_angle_to", header: "godot/vector3.h".}
|
||||
proc slide*(self, n: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_slide", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_slide", header: "godot/vector3.h".}
|
||||
proc bounce*(self, n: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_bounce", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_bounce", header: "godot/vector3.h".}
|
||||
proc reflect*(self, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_reflect", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_reflect", header: "godot/vector3.h".}
|
||||
|
||||
proc `+`*(a, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_operator_add", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_operator_add", header: "godot/vector3.h".}
|
||||
proc `+=`*(a: var Vector3, b: Vector3) {.inline.} =
|
||||
a = a + b
|
||||
|
||||
proc `-`*(a, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_operator_substract", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_operator_substract", header: "godot/vector3.h".}
|
||||
proc `-=`*(a: var Vector3, b: Vector3) {.inline.} =
|
||||
a = a - b
|
||||
|
||||
proc `*`*(a, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_operator_multiply_vector",
|
||||
header: "godot_vector3.h".}
|
||||
header: "godot/vector3.h".}
|
||||
proc `*=`*(a: var Vector3, b: Vector3) {.inline.}=
|
||||
a = a * b
|
||||
|
||||
proc `*`*(self: Vector3; b: float32): Vector3 {.
|
||||
importc: "godot_vector3_operator_multiply_scalar",
|
||||
header: "godot_vector3.h".}
|
||||
header: "godot/vector3.h".}
|
||||
proc `*=`*(a: var Vector3; b: float32) {.inline.} =
|
||||
a = a * b
|
||||
|
||||
proc `/`*(a, b: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_operator_divide_vector",
|
||||
header: "godot_vector3.h".}
|
||||
header: "godot/vector3.h".}
|
||||
proc `/=`*(a: var Vector3; b: Vector3) {.inline.} =
|
||||
a = a / b
|
||||
|
||||
proc `/`*(self: Vector3; b: float32): Vector3 {.
|
||||
importc: "godot_vector3_operator_divide_scalar",
|
||||
header: "godot_vector3.h".}
|
||||
header: "godot/vector3.h".}
|
||||
proc `/=`*(a: var Vector3; b: float32) {.inline.} =
|
||||
a = a / b
|
||||
|
||||
proc `==`*(a, b: Vector3): bool {.
|
||||
importc: "godot_vector3_operator_equal", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_operator_equal", header: "godot/vector3.h".}
|
||||
proc `<`*(a, b: Vector3): bool {.
|
||||
importc: "godot_vector3_operator_less", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_operator_less", header: "godot/vector3.h".}
|
||||
proc `-`*(self: Vector3): Vector3 {.
|
||||
importc: "godot_vector3_operator_neg", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_operator_neg", header: "godot/vector3.h".}
|
||||
|
||||
proc setAxis(self: var Vector3; axis: Vector3Axis;
|
||||
val: float32) {.
|
||||
importc: "godot_vector3_set_axis", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_set_axis", header: "godot/vector3.h".}
|
||||
proc getAxis(self: Vector3; axis: Vector3Axis): float32 {.
|
||||
importc: "godot_vector3_get_axis", header: "godot_vector3.h".}
|
||||
importc: "godot_vector3_get_axis", header: "godot/vector3.h".}
|
||||
|
||||
proc `[]`(self: Vector3, idx: range[0..2]): float32 {.inline.} =
|
||||
self.getAxis(Vector3Axis(idx))
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ template registerGodotClass(classNameIdent, classNameLit,
|
|||
destroyFunc: nimDestroyFunc
|
||||
)
|
||||
registerClass(classNameIdent, classNameLit, false)
|
||||
godotScriptRegisterClass(classNameLit, baseNameLit,
|
||||
godotScriptRegisterClass(getNativeLibHandle(), classNameLit, baseNameLit,
|
||||
createFuncObj, destroyFuncObj)
|
||||
|
||||
template registerGodotField(classNameLit, classNameIdent, propNameLit,
|
||||
|
|
@ -325,7 +325,7 @@ template registerGodotField(classNameLit, classNameIdent, propNameLit,
|
|||
)
|
||||
when hasDefaultValue:
|
||||
attr.defaultValue = (defaultValueNode).toGodot()
|
||||
godotScriptRegisterProperty(classNameLit, propNameLit,
|
||||
godotScriptRegisterProperty(getNativeLibHandle(), classNameLit, propNameLit,
|
||||
attr, setFunc, getFunc)
|
||||
static:
|
||||
import strutils
|
||||
|
|
@ -440,7 +440,7 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} =
|
|||
let meth = GodotInstanceMethod(
|
||||
meth: methFuncIdent
|
||||
)
|
||||
godotScriptRegisterMethod(classNameLit, methodNameLit,
|
||||
godotScriptRegisterMethod(getNativeLibHandle(), classNameLit, methodNameLit,
|
||||
GodotMethodAttributes(), meth)
|
||||
|
||||
for meth in obj.methods:
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ proc `as`*[T: NimGodotObject](obj: NimGodotObject, t: typedesc[T]): T =
|
|||
result = T(obj)
|
||||
|
||||
proc getSingletonGodot*(name: cstring): ptr GodotObject {.
|
||||
importc: "godot_global_get_singleton", header: "../godot.h".}
|
||||
importc: "godot_global_get_singleton", header: "godot/gdnative.h".}
|
||||
|
||||
proc newRStrLit(s: string): NimNode {.compileTime.} =
|
||||
result = newNimNode(nnkRStrLit)
|
||||
|
|
@ -175,25 +175,6 @@ proc gdnew*[T: NimGodotObject](): T =
|
|||
if obj.isNil:
|
||||
printError("godot_new returned nil for type " & $godotName)
|
||||
result = asNimGodotObject[T](obj)
|
||||
# const godotName = toGodotName(T)
|
||||
# let objInfo = classRegistry.getOrDefault(godotName)
|
||||
# if objInfo.constructor.isNil:
|
||||
# printError("gdnew invoked on unregistered class: " & $godotName)
|
||||
# return
|
||||
# let godotConstructor = getClassConstructor(
|
||||
# if objInfo.isNative: godotName else: objInfo.baseNativeClass)
|
||||
# printError("Base native class for " & T.name & ": " & $objInfo.baseNativeClass)
|
||||
# when not defined(release):
|
||||
# if godotConstructor.isNil:
|
||||
# printError("Failed to obtain Godot constrcutor for type: " & $godotName)
|
||||
# return
|
||||
# let godotObject = godotConstructor()
|
||||
# when not defined(release):
|
||||
# if godotObject.isNil:
|
||||
# printError("Godot constructor returned nil - must never happen")
|
||||
# return
|
||||
# new(result, godotFinalizer[T])
|
||||
# result.setGodotObject(godotObject)
|
||||
|
||||
proc newCallError*(err: VariantCallError): ref CallError =
|
||||
let msg = case err.error:
|
||||
|
|
@ -511,9 +492,14 @@ void NimMain(void);
|
|||
N_NOINLINE(void, setStackBottom)(void* thestackbottom);
|
||||
""".}
|
||||
|
||||
const stackIncreases = defined(emscripten)
|
||||
var nativeLibHandle: pointer
|
||||
proc getNativeLibHandle*(): pointer =
|
||||
return nativeLibHandle
|
||||
|
||||
proc godot_nativescript_init(handle: pointer) {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
nativeLibHandle = handle
|
||||
|
||||
proc godot_native_init() {.cdecl, exportc, dynlib.} =
|
||||
let stackBottom = godotStackBottom()
|
||||
{.emit: """
|
||||
NimMain();
|
||||
|
|
@ -522,5 +508,10 @@ proc godot_native_init() {.cdecl, exportc, dynlib.} =
|
|||
GC_fullCollect()
|
||||
GC_disable()
|
||||
|
||||
proc godot_native_terminate() {.cdecl, exportc, dynlib.} =
|
||||
proc godot_gdnative_init(options: ptr GodotNativeInitOptions) {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
discard
|
||||
|
||||
proc godot_gdnative_terminate(options: ptr GodotNativeTerminateOptions) {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
deallocHeap()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue