Use GDNative API struct
This commit is contained in:
parent
cf75723fa1
commit
b62db02d8f
32 changed files with 2846 additions and 1535 deletions
|
|
@ -1,13 +1,7 @@
|
|||
# Copyright (c) 2017 Xored Software, Inc.
|
||||
|
||||
import vector2
|
||||
|
||||
import internal.godotstrings
|
||||
|
||||
type
|
||||
Rect2* {.byref.} = object
|
||||
position*: Vector2
|
||||
size*: Vector2
|
||||
import godotcoretypes, internal.godotinternaltypes, gdnativeapi
|
||||
|
||||
proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
||||
Rect2(position: pos, size: size)
|
||||
|
|
@ -15,40 +9,35 @@ proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
|||
proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} =
|
||||
Rect2(position: vec2(x, y), size: vec2(sizeX, sizeY))
|
||||
|
||||
proc toGodotString(self: Rect2): GodotString {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_as_string".}
|
||||
|
||||
proc `$`*(self: Rect2): string {.inline.} =
|
||||
$self.toGodotString()
|
||||
$getGDNativeAPI().rect2AsString(self)
|
||||
|
||||
proc area*(self: Rect2): float32 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_get_area".}
|
||||
proc intersects*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_intersects".}
|
||||
proc encloses*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_encloses".}
|
||||
proc hasNoArea*(self: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_no_area".}
|
||||
proc clip*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_clip".}
|
||||
proc merge*(a, b: Rect2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_merge".}
|
||||
proc contains*(self: Rect2; point: Vector2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_has_point".}
|
||||
proc grow*(self: Rect2; by: float32): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_grow".}
|
||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_expand".}
|
||||
proc `==`*(a, b: Rect2): bool {.
|
||||
noSideEffect,
|
||||
importc: "godot_rect2_operator_equal".}
|
||||
proc area*(self: Rect2): float32 {.inline.} =
|
||||
getGDNativeAPI().rect2GetArea(self)
|
||||
|
||||
proc intersects*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2Intersects(a, b)
|
||||
|
||||
proc encloses*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2Encloses(a, b)
|
||||
|
||||
proc hasNoArea*(self: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2HasNoArea(self)
|
||||
|
||||
proc clip*(self, b: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Clip(self, b)
|
||||
|
||||
proc merge*(self, b: Rect2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Merge(self, b)
|
||||
|
||||
proc contains*(self: Rect2; point: Vector2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2HasPoint(self, point)
|
||||
|
||||
proc grow*(self: Rect2; by: float32): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Grow(self, by)
|
||||
|
||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.inline.} =
|
||||
getGDNativeAPI().rect2Expand(self, to)
|
||||
|
||||
proc `==`*(a, b: Rect2): bool {.inline.} =
|
||||
getGDNativeAPI().rect2OperatorEqual(a, b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue