From dc6ebaf5757b82436d714a779855207c6009afe4 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Sat, 31 Mar 2018 17:43:46 +0700 Subject: [PATCH] Fix GDNative API version check Fixes #18. --- godot.nimble | 2 +- godot/gdnativeapi.nim | 44 +++++++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/godot.nimble b/godot.nimble index b60be93..772875c 100644 --- a/godot.nimble +++ b/godot.nimble @@ -1,4 +1,4 @@ -version = "0.7.7" +version = "0.7.8" author = "Xored Software, Inc." description = "Godot Engine bindings" license = "MIT" diff --git a/godot/gdnativeapi.nim b/godot/gdnativeapi.nim index 5090813..3ece69b 100644 --- a/godot/gdnativeapi.nim +++ b/godot/gdnativeapi.nim @@ -2907,7 +2907,8 @@ var gdNativeAPI: GDNativeAPI proc getGDNativeAPI*(): ptr GDNativeAPI {.inline.} = 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) 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: of GDNativeCore: let coreApi = cast[ptr GDNativeCoreAPI1](apiStruct) - if coreApi[].version.major == 1: + if coreApi[].version.major == 1 and coreApi[].version.minor == 0: assign(gdNativeApi, coreApi[]): # Color API colorNewRGBA @@ -3505,15 +3506,14 @@ proc setGDNativeAPI*(apiStruct: pointer, initOptions: ptr GDNativeInitOptions) = printWarning print + foundCoreApi = true for i in 0.cuint..