parent
be6f01e3b7
commit
dc6ebaf575
2 changed files with 31 additions and 15 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
version = "0.7.7"
|
version = "0.7.8"
|
||||||
author = "Xored Software, Inc."
|
author = "Xored Software, Inc."
|
||||||
description = "Godot Engine bindings"
|
description = "Godot Engine bindings"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
|
|
@ -2907,7 +2907,8 @@ var gdNativeAPI: GDNativeAPI
|
||||||
proc getGDNativeAPI*(): ptr GDNativeAPI {.inline.} =
|
proc getGDNativeAPI*(): ptr GDNativeAPI {.inline.} =
|
||||||
addr gdNativeAPI
|
addr gdNativeAPI
|
||||||
|
|
||||||
proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) =
|
proc setGDNativeAPIInternal(apiStruct: pointer, initOptions: ptr GDNativeInitOptions,
|
||||||
|
foundCoreApi: var bool, foundNativeScriptApi: var bool) =
|
||||||
let header = cast[ptr GDNativeAPIHeader](apiStruct)
|
let header = cast[ptr GDNativeAPIHeader](apiStruct)
|
||||||
|
|
||||||
if header.typ >= ord(low(GDNativeAPIType)).cuint and header.typ <= ord(high(GDNativeAPIType)).cuint:
|
if header.typ >= ord(low(GDNativeAPIType)).cuint and header.typ <= ord(high(GDNativeAPIType)).cuint:
|
||||||
|
|
@ -2915,7 +2916,7 @@ proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) =
|
||||||
case typ:
|
case typ:
|
||||||
of GDNativeCore:
|
of GDNativeCore:
|
||||||
let coreApi = cast[ptr GDNativeCoreAPI1](apiStruct)
|
let coreApi = cast[ptr GDNativeCoreAPI1](apiStruct)
|
||||||
if coreApi[].version.major == 1:
|
if coreApi[].version.major == 1 and coreApi[].version.minor == 0:
|
||||||
assign(gdNativeApi, coreApi[]):
|
assign(gdNativeApi, coreApi[]):
|
||||||
# Color API
|
# Color API
|
||||||
colorNewRGBA
|
colorNewRGBA
|
||||||
|
|
@ -3505,15 +3506,14 @@ proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) =
|
||||||
printWarning
|
printWarning
|
||||||
print
|
print
|
||||||
|
|
||||||
|
foundCoreApi = true
|
||||||
for i in 0.cuint..<coreApi.numExtensions:
|
for i in 0.cuint..<coreApi.numExtensions:
|
||||||
setGDNativeAPI(coreApi.extensions[][i.int], initOptions)
|
setGDNativeAPIInternal(coreApi.extensions[][i.int], initOptions,
|
||||||
else:
|
foundCoreApi, foundNativeScriptApi)
|
||||||
let want = GDNativeAPIVersion(major: 1, minor: 0)
|
|
||||||
initOptions[].reportVersionMismatch(
|
|
||||||
initOptions[].gdNativeLibrary, cstring"Core", want, coreApi[].version)
|
|
||||||
of GDNativeExtNativeScript:
|
of GDNativeExtNativeScript:
|
||||||
let nativeScriptApi = cast[ptr GDNativeNativeScriptAPI1](apiStruct)
|
let nativeScriptApi = cast[ptr GDNativeNativeScriptAPI1](apiStruct)
|
||||||
if nativeScriptApi[].version.major == 1:
|
if nativeScriptApi[].version.major == 1 and
|
||||||
|
nativeScriptApi[].version.minor == 0:
|
||||||
assign(gdNativeApi, nativeScriptApi[]):
|
assign(gdNativeApi, nativeScriptApi[]):
|
||||||
nativeScriptRegisterClass
|
nativeScriptRegisterClass
|
||||||
nativeScriptRegisterToolClass
|
nativeScriptRegisterToolClass
|
||||||
|
|
@ -3521,15 +3521,31 @@ proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) =
|
||||||
nativeScriptRegisterProperty
|
nativeScriptRegisterProperty
|
||||||
nativeScriptRegisterSignal
|
nativeScriptRegisterSignal
|
||||||
nativeScriptGetUserdata
|
nativeScriptGetUserdata
|
||||||
else:
|
foundNativeScriptApi = true
|
||||||
let want = GDNativeAPIVersion(major: 1, minor: 0)
|
|
||||||
initOptions[].reportVersionMismatch(
|
|
||||||
initOptions[].gdNativeLibrary, cstring"NativeScript",
|
|
||||||
want, nativeScriptApi[].version)
|
|
||||||
|
|
||||||
of GDNativeExtPluginScript, GDNativeExtNativeARVR:
|
of GDNativeExtPluginScript, GDNativeExtNativeARVR:
|
||||||
# Not used
|
# Not used
|
||||||
discard
|
discard
|
||||||
|
|
||||||
if not header.next.isNil:
|
if not header.next.isNil:
|
||||||
setGDNativeAPI(header.next, initOptions)
|
setGDNativeAPIInternal(header.next, initOptions,
|
||||||
|
foundCoreApi, foundNativeScriptApi)
|
||||||
|
|
||||||
|
proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) =
|
||||||
|
var foundCoreApi: bool
|
||||||
|
var foundNativeScriptApi: bool
|
||||||
|
|
||||||
|
setGDNativeAPIInternal(apiStruct, initOptions,
|
||||||
|
foundCoreApi, foundNativeScriptApi)
|
||||||
|
|
||||||
|
if not foundCoreApi:
|
||||||
|
let want = GDNativeAPIVersion(major: 1, minor: 0)
|
||||||
|
initOptions[].reportVersionMismatch(
|
||||||
|
initOptions[].gdNativeLibrary, cstring"Core", want,
|
||||||
|
GDNativeAPIVersion(major: 0, minor: 0))
|
||||||
|
|
||||||
|
if not foundNativeScriptApi:
|
||||||
|
let want = GDNativeAPIVersion(major: 1, minor: 0)
|
||||||
|
initOptions[].reportVersionMismatch(
|
||||||
|
initOptions[].gdNativeLibrary, cstring"NativeScript",
|
||||||
|
want, GDNativeAPIVersion(major: 0, minor: 0))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue