From cba3d8ff51d50d9ba2cd203de02083db9efa3bcb Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Thu, 5 Oct 2017 20:55:44 +0700 Subject: [PATCH] Update to latest Godot and godot-nim --- .gitignore | 1 + README.md | 3 +-- default_env.tres | 2 +- icon.png.import | 1 + main.tscn | 14 ++++++++++---- nimlib.tres | 5 +++-- project.godot | 13 +++++++++++++ src/config.nims | 17 +++++++++++------ src/stub.nimble | 4 ++-- 9 files changed, 43 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index f449553..e85dd84 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ /_dlls /nakefile /_godotapi +/logs nimcache .nimcache diff --git a/README.md b/README.md index cd1a033..2b1d726 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ Prerequisites: 1. Install [nake](https://github.com/fowlmouth/nake): `nimble install nake -n`. 2. Ensure `~/.nimble/bin` is in your PATH (On Windows: `C:\Users\\.nimble\bin`). -3. Set `GODOT_BIN` environment varible to point to Godot executable (requires Godot 3.0 changeset [d28e9c3](https://github.com/godotengine/godot/commit/d28e9c3c0813e729195357dbb9ccd337494bc6d7) or newer). +3. Set `GODOT_BIN` environment varible to point to Godot executable (requires Godot 3.0 changeset [b759d14](https://github.com/godotengine/godot/commit/b759d1416f574e5b642413edd623b04f2a1d20ad) or newer). 4. Install godot-nim: `nimble install godot` -5. (Windows only) Set `GODOT_LIB` environment variable to point to Godot's .lib file. It should be in the `bin` folder after you build Godot. Run `nake build` in any directory within the project to compile for the current platform. diff --git a/default_env.tres b/default_env.tres index a22ed59..6bf8f87 100644 --- a/default_env.tres +++ b/default_env.tres @@ -24,7 +24,7 @@ texture_size = 2 background_mode = 2 background_sky = SubResource( 1 ) -background_sky_scale = 1.0 +background_sky_custom_fov = 0.0 background_color = Color( 0, 0, 0, 1 ) background_energy = 1.0 background_canvas_max_layer = 0 diff --git a/icon.png.import b/icon.png.import index 627820b..42e94a3 100644 --- a/icon.png.import +++ b/icon.png.import @@ -21,3 +21,4 @@ process/HDR_as_SRGB=false stream=false size_limit=0 detect_3d=true +svg/scale=1.0 diff --git a/main.tscn b/main.tscn index 7e4e390..2626311 100644 --- a/main.tscn +++ b/main.tscn @@ -14,8 +14,10 @@ _sections_unfolded = [ "Font", "Settings" ] [node name="Panel" type="Panel"] -anchor_right = 1 -anchor_bottom = 1 +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -26,8 +28,10 @@ _sections_unfolded = [ "Anchor", "Margin" ] [node name="Label" type="Label" parent="."] -anchor_right = 1 -anchor_bottom = 1 +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 2 @@ -44,6 +48,8 @@ _sections_unfolded = [ "Anchor", "Margin", "custom_fonts" ] [node name="FPS" parent="." instance=ExtResource( 3 )] +anchor_top = 0.0 +anchor_bottom = 0.0 margin_left = 189.0 margin_bottom = 58.0 diff --git a/nimlib.tres b/nimlib.tres index f95a4f3..df70bfc 100644 --- a/nimlib.tres +++ b/nimlib.tres @@ -7,6 +7,7 @@ platform/X11_64bit = "res://_dlls/nim_linux_64.so" platform/Windows_32bit = "res://_dlls/nim_32.dll" platform/Windows_64bit = "res://_dlls/nim_64.dll" platform/OSX = "res://_dlls/nim_mac.dylib" -platform/Android = "res://_dlls/nim_android.so" -platform/iOS = "res://_dlls/nim_ios.dylib" +platform/Android = "res://nim_android.so" +platform/iOS_32bit = "res://_dlls/nim_ios_32.dylib" +platform/iOS_64bit = "res://_dlls/nim_ios_64.dylib" platform/WebAssembly = "" diff --git a/project.godot b/project.godot index a04b5b6..d6ec3e0 100644 --- a/project.godot +++ b/project.godot @@ -1,10 +1,23 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + config_version=3 + [application] config/name="Godot-Nim Stub" run/main_scene="res://main.tscn" config/icon="res://icon.png" +[gdnative] + +singletons=[ ] + [rendering] environment/default_environment="res://default_env.tres" diff --git a/src/config.nims b/src/config.nims index 0e164e3..2db222b 100644 --- a/src/config.nims +++ b/src/config.nims @@ -3,7 +3,17 @@ import ospaths switch("nimcache", ".nimcache"/hostOS/hostCPU) when defined(macosx): - switch("passL", "-framework Cocoa -Wl,-undefined,dynamic_lookup") + when defined(ios): + if hostCPU == "arm64": + switch("passC", "-arch arm64") + switch("passL", "-arch arm64") + elif hostCPU == "arm": + switch("passC", "-arch armv7") + switch("passL", "-arch armv7") + switch("passC", "-mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk") + switch("passL", "-mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk") + else: + switch("passL", "-framework Cocoa") elif defined(android): let ndk = getEnv("ANDROID_NDK_ROOT") let toolchain = getEnv("ANDROID_TOOLCHAIN") @@ -29,11 +39,6 @@ elif defined(android): elif defined(windows): assert(sizeof(int) == 8) switch("cc", "vcc") - let godotLib = getEnv("GODOT_LIB") - if godotLib.len == 0: - raise newException(OSError, - "GODOT_LIB must be specified and point to the .lib file") - switch("clib", godotLib.changeFileExt("")) elif defined(linux): switch("passC", "-fPIC") else: diff --git a/src/stub.nimble b/src/stub.nimble index 16bd33b..8118595 100644 --- a/src/stub.nimble +++ b/src/stub.nimble @@ -4,7 +4,7 @@ description = "Godot-Nim Project Stub" license = "MIT" bin = @["stub"] -requires "godot >= 0.5.0 & < 0.6.0" +requires "godot >= 0.6.0 & < 0.7.0" task make, "build": const bitsPostfix = when sizeof(int) == 8: "_64" else: "_32" @@ -12,7 +12,7 @@ task make, "build": when defined(windows): "nim" & bitsPostfix & ".dll" elif defined(ios): - "nim_ios.dylib" + "nim_ios" & bitsPostfix & ".dylib" elif defined(macosx): "nim_mac.dylib" elif defined(android):