From 337202bfba7c2764197bd5064d91f98d66bb30cf Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 31 Aug 2020 01:07:37 -0400 Subject: [PATCH] Finish refactoring Instance Binding demo and update to Godot 3.2.2 Untested on macOS and Windows. --- c/glfw/project/project.godot | 4 +- c/instance_binding/project/default_env.tres | 99 ------------------- .../project/gdnative/instance_binding.gdnlib | 4 +- .../project/gdnative/instance_binding.gdns | 7 +- c/instance_binding/project/icon.png.import | 34 +++++++ c/instance_binding/project/main.gd | 6 +- c/instance_binding/project/main.tscn | 65 ++++-------- c/instance_binding/project/project.godot | 15 +-- c/instance_binding/src/instance_binding.c | 2 +- 9 files changed, 71 insertions(+), 165 deletions(-) delete mode 100644 c/instance_binding/project/default_env.tres create mode 100644 c/instance_binding/project/icon.png.import diff --git a/c/glfw/project/project.godot b/c/glfw/project/project.godot index 3c097be..5424e31 100644 --- a/c/glfw/project/project.godot +++ b/c/glfw/project/project.godot @@ -18,9 +18,7 @@ _global_script_class_icons={ config/name="GLFW GDNative C Demo" config/description="GLFW GDNative C Demo" run/main_scene="res://main.tscn" -name="GLFWDemo" -main_scene="res://Main.tscn" -icon="res://icon.png" +config/icon="res://icon.png" [memory] diff --git a/c/instance_binding/project/default_env.tres b/c/instance_binding/project/default_env.tres deleted file mode 100644 index 1b9440d..0000000 --- a/c/instance_binding/project/default_env.tres +++ /dev/null @@ -1,99 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="ProceduralSky" id=1] - -radiance_size = 1 -sky_top_color = Color( 0.301961, 0.403922, 0.909804, 1 ) -sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) -sky_curve = 0.25 -sky_energy = 1.0 -ground_bottom_color = Color( 0.196078, 0.152941, 0.0980392, 1 ) -ground_horizon_color = Color( 0.329412, 0.211765, 0.0627451, 1 ) -ground_curve = 0.25 -ground_energy = 1.0 -sun_color = Color( 1, 1, 1, 1 ) -sun_latitude = 35.0 -sun_longitude = 0.0 -sun_angle_min = 1.0 -sun_angle_max = 100.0 -sun_curve = 0.05 -sun_energy = 16.0 -texture_size = 0 - -[resource] - -background_mode = 2 -background_sky = SubResource( 1 ) -background_sky_scale = 1.0 -background_color = Color( 0, 0, 0, 1 ) -background_energy = 1.0 -background_canvas_max_layer = 0 -ambient_light_color = Color( 0, 0, 0, 1 ) -ambient_light_energy = 1.0 -ambient_light_sky_contribution = 0.0 -fog_enabled = false -fog_color = Color( 0.5, 0.6, 0.7, 1 ) -fog_sun_color = Color( 1, 0.9, 0.7, 1 ) -fog_sun_amount = 0.0 -fog_depth_enabled = true -fog_depth_begin = 10.0 -fog_depth_curve = 1.0 -fog_transmit_enabled = false -fog_transmit_curve = 1.0 -fog_height_enabled = false -fog_height_min = 0.0 -fog_height_max = 100.0 -fog_height_curve = 1.0 -tonemap_mode = 0 -tonemap_exposure = 1.0 -tonemap_white = 1.0 -auto_exposure_enabled = false -auto_exposure_scale = 0.4 -auto_exposure_min_luma = 0.05 -auto_exposure_max_luma = 8.0 -auto_exposure_speed = 0.5 -ss_reflections_enabled = false -ss_reflections_max_steps = 64 -ss_reflections_fade_in = 0.15 -ss_reflections_fade_out = 2.0 -ss_reflections_depth_tolerance = 0.2 -ss_reflections_roughness = true -ssao_enabled = false -ssao_radius = 1.0 -ssao_intensity = 1.0 -ssao_radius2 = 0.0 -ssao_intensity2 = 1.0 -ssao_bias = 0.01 -ssao_light_affect = 0.0 -ssao_color = Color( 0, 0, 0, 1 ) -ssao_blur = true -dof_blur_far_enabled = false -dof_blur_far_distance = 10.0 -dof_blur_far_transition = 5.0 -dof_blur_far_amount = 0.1 -dof_blur_far_quality = 1 -dof_blur_near_enabled = false -dof_blur_near_distance = 2.0 -dof_blur_near_transition = 1.0 -dof_blur_near_amount = 0.1 -dof_blur_near_quality = 1 -glow_enabled = false -glow_levels/1 = false -glow_levels/2 = false -glow_levels/3 = true -glow_levels/4 = false -glow_levels/5 = true -glow_levels/6 = false -glow_levels/7 = false -glow_intensity = 0.8 -glow_strength = 1.0 -glow_bloom = 0.0 -glow_blend_mode = 2 -glow_hdr_treshold = 1.0 -glow_hdr_scale = 2.0 -glow_bicubic_upscale = false -adjustment_enabled = false -adjustment_brightness = 1.0 -adjustment_contrast = 1.0 -adjustment_saturation = 1.0 - diff --git a/c/instance_binding/project/gdnative/instance_binding.gdnlib b/c/instance_binding/project/gdnative/instance_binding.gdnlib index 32e031b..555dd24 100644 --- a/c/instance_binding/project/gdnative/instance_binding.gdnlib +++ b/c/instance_binding/project/gdnative/instance_binding.gdnlib @@ -7,7 +7,9 @@ reloadable=true [entry] -X11.64="res://bin/libinstance_binding_demo.so" +X11.64="res://gdnative/linuxbsd/libinstance_binding.so" +Windows.64="res://gdnative/windows/libinstance_binding.dll" +OSX.64="res://gdnative/macos/libinstance_binding.dylib" [dependencies] diff --git a/c/instance_binding/project/gdnative/instance_binding.gdns b/c/instance_binding/project/gdnative/instance_binding.gdns index 31ec7c9..b236f68 100644 --- a/c/instance_binding/project/gdnative/instance_binding.gdns +++ b/c/instance_binding/project/gdnative/instance_binding.gdns @@ -1,11 +1,10 @@ [gd_resource type="NativeScript" load_steps=2 format=2] -[ext_resource path="res://bin/instance_binding_demo.gdnlib" type="GDNativeLibrary" id=1] +[ext_resource path="res://gdnative/instance_binding.gdnlib" type="GDNativeLibrary" id=1] [resource] -resource_name = "InstanceBindingDemo" -class_name = "InstanceBindingDemo" +resource_name = "InstanceBinding" +class_name = "InstanceBinding" library = ExtResource( 1 ) _sections_unfolded = [ "Resource" ] - diff --git a/c/instance_binding/project/icon.png.import b/c/instance_binding/project/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/c/instance_binding/project/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/c/instance_binding/project/main.gd b/c/instance_binding/project/main.gd index 6f84ddb..c35ccdd 100644 --- a/c/instance_binding/project/main.gd +++ b/c/instance_binding/project/main.gd @@ -1,10 +1,8 @@ extends Control -# load the SIMPLE library -const InstanceBindingDemo = preload("res://bin/instance_binding_demo.gdns") -onready var data = InstanceBindingDemo.new() +const InstanceBinding = preload("res://gdnative/instance_binding.gdns") +onready var data = InstanceBinding.new() func _on_Button_pressed(): # do the test here - pass diff --git a/c/instance_binding/project/main.tscn b/c/instance_binding/project/main.tscn index baf6621..e963a69 100644 --- a/c/instance_binding/project/main.tscn +++ b/c/instance_binding/project/main.tscn @@ -2,62 +2,33 @@ [ext_resource path="res://main.gd" type="Script" id=1] -[node name="main" type="Control" index="0"] - -anchor_left = 0.0 -anchor_top = 0.0 +[node name="Main" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 -rect_pivot_offset = Vector2( 0, 0 ) -mouse_filter = 0 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} -[node name="Button" type="Button" parent="." index="0"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 384.0 +[node name="Button" type="Button" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -150.0 margin_top = 233.0 -margin_right = 630.0 +margin_right = 150.0 margin_bottom = 289.0 -rect_pivot_offset = Vector2( 0, 0 ) -focus_mode = 2 -mouse_filter = 0 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null -group = null text = "Hello" -flat = false -align = 1 +__meta__ = { +"_edit_use_anchors_": false +} -[node name="Label" type="Label" parent="." index="1"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 392.0 +[node name="Label" type="Label" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -200.0 margin_top = 311.0 -margin_right = 629.0 +margin_right = 200.0 margin_bottom = 368.0 -rect_pivot_offset = Vector2( 0, 0 ) -mouse_filter = 2 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 size_flags_vertical = 0 -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 - +align = 1 [connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] - - diff --git a/c/instance_binding/project/project.godot b/c/instance_binding/project/project.godot index 8ec2d7f..70f2993 100644 --- a/c/instance_binding/project/project.godot +++ b/c/instance_binding/project/project.godot @@ -6,16 +6,19 @@ ; [section] ; section goes between [] ; param=value ; assign values to parameters -config_version=3 +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} [application] -config/name="InstanceBindingDemo" +config/name="Instance Binding GDNative C Demo" +config/description="Instance Binding GDNative Demo" run/main_scene="res://main.tscn" config/icon="res://icon.png" -name="InstanceBindingDemo" -main_scene="res://main.tscn" -icon="res://icon.png" [gdnative] @@ -27,4 +30,4 @@ multithread/thread_rid_pool_prealloc=60 [rendering] -viewport/default_environment="res://default_env.tres" +quality/driver/driver_name="GLES2" diff --git a/c/instance_binding/src/instance_binding.c b/c/instance_binding/src/instance_binding.c index 18d3286..30780b9 100644 --- a/c/instance_binding/src/instance_binding.c +++ b/c/instance_binding/src/instance_binding.c @@ -93,7 +93,7 @@ void GDN_EXPORT godot_nativescript_init(void *handle) { godot_instance_destroy_func destructor = {}; destructor.destroy_func = &ibd_destructor; - nativescript_api->godot_nativescript_register_class(handle, "InstanceBindingDemo", "Reference", constructor, destructor); + nativescript_api->godot_nativescript_register_class(handle, "InstanceBinding", "Reference", constructor, destructor); } }