diff --git a/README.md b/README.md index 5ca2635..ad17cb5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ For non-GDNative demos (GDScript, VisualScript, and C#), please see the ## Godot versions The [`master`](https://github.com/godotengine/gdnative-demos) branch -is compatible with the latest stable Godot version (currently 3.2). +is compatible with the latest stable Godot version (currently 3.3). Older Godot versions are not supported by this repo. ## Useful links diff --git a/c/README.md b/c/README.md new file mode 100644 index 0000000..010485a --- /dev/null +++ b/c/README.md @@ -0,0 +1,21 @@ +# C demos + +These demos show how to use the GDNative C bindings. + +Dependencies: + * You need [Godot headers](https://github.com/godotengine/godot-headers), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C compiler that's C11 compatible. + +## Compiling + +For each of the C demos, you can use SCons to compile the library: + +``` +scons platform=PLATFORM +``` + +Where PLATFORM is: `windows`, `linuxbsd`, or `macos`. + +This creates the file `libsimple` in the respective +subfolders in the `project/gdnative` directory. diff --git a/c/glfw/README.md b/c/glfw/README.md index ad55c8d..14be455 100644 --- a/c/glfw/README.md +++ b/c/glfw/README.md @@ -4,9 +4,9 @@ This is a small example using C to create a GDNative script that exposes a very small part of the GLFW API. Dependencies: - * You need [Godot headers](https://github.com/godotengine/godot_headers), - this is now a submodule of this repo. - * `clang`, `gcc`, or any decent C compiler that's C11 or C99 compatible. + * You need [Godot headers](https://github.com/godotengine/godot-headers), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C compiler that's C11 compatible. * You need to have GLFW and its headers installed. ## Compile with SCons (cross platform) @@ -16,7 +16,7 @@ You can use SCons to compile the library if you have it installed: scons platform=PLATFORM ``` -Where platform is: windows, linuxbsd, or macos +Where PLATFORM is: `windows`, `linuxbsd`, or `macos`. ## Manually compiling diff --git a/c/instance_binding/README.md b/c/instance_binding/README.md index c5f3be5..d43581a 100644 --- a/c/instance_binding/README.md +++ b/c/instance_binding/README.md @@ -1,9 +1,9 @@ # Instance binding demo using C Dependencies: - * You need [Godot headers](https://github.com/godotengine/godot_headers), - this is now a submodule of this repo. - * `clang`, `gcc`, or any decent C compiler that's C11 or C99 compatible. + * You need [Godot headers](https://github.com/godotengine/godot-headers), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C compiler that's C11 compatible. ## Compile with SCons (cross platform) You can use SCons to compile the library if you have it installed: @@ -12,7 +12,7 @@ You can use SCons to compile the library if you have it installed: scons platform=PLATFORM ``` -Where platform is: windows, linuxbsd, or macos +Where PLATFORM is: `windows`, `linuxbsd`, or `macos`. ## Manually compiling diff --git a/c/simple/README.md b/c/simple/README.md index 24f0e80..5d2120b 100644 --- a/c/simple/README.md +++ b/c/simple/README.md @@ -4,9 +4,9 @@ This is a small example using C to create a GDNative script that just showcases some very simple bare bones calls. Dependencies: - * You need [Godot headers](https://github.com/godotengine/godot_headers), - this is now a submodule of this repo. - * `clang`, `gcc`, or any decent C compiler that's C11 or C99 compatible. + * You need [Godot headers](https://github.com/godotengine/godot-headers), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C compiler that's C11 compatible. ## Compile with SCons (cross platform) You can use SCons to compile the library if you have it installed: @@ -15,7 +15,7 @@ You can use SCons to compile the library if you have it installed: scons platform=PLATFORM ``` -Where platform is: windows, linuxbsd, or macos +Where PLATFORM is: `windows`, `linuxbsd`, or `macos`. ## Manually compiling diff --git a/cpp/README.md b/cpp/README.md index a7fab7d..ed23228 100644 --- a/cpp/README.md +++ b/cpp/README.md @@ -1,44 +1,21 @@ -## C++ +# C++ demos -### Initial setup +These demos show how to use the GDNative C++ bindings. -You need to clone the GDNative C++ bindings in the root of this project: +Dependencies: + * You need [godot-cpp](https://github.com/godotengine/godot-cpp), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C++ compiler that's C++14 compatible. + +## Compiling + +For each of the C++ demos, you can use SCons to compile the library: ``` -git clone --recursive https://github.com/GodotNativeTools/godot-cpp +scons platform=PLATFORM ``` +Where PLATFORM is: `windows`, `linux`, or `osx`. -### Updating the api.json -Our api.json file contains meta data of all the classes that are part of the Godot core and are needed to generate the C++ binding classes for use in GDNative modules. - -This file is supplied with our godot_headers repository for your convinience but if you are running a custom build of Godot and need access to classes that have recent changes a new api.json file must be generated. You do this by starting your Godot executable with the following parameters: - -``` -$ godot --gdnative-generate-json-api api.json -``` - -Now copy the api.json file into your folder structure so its easy to access. **Note** the remark below for the extra ```custom_api_file``` command line parameter needed to tell scons where to find your file. - -### Compiling the cpp bindings library -The final step is to compile our cpp bindings library: -``` -$ cd godot-cpp -$ scons platform= generate_bindings=yes -$ cd .. -``` - -> Replace `` with either `windows`, `linux` or `osx`. - -> Include `use_llvm=yes` for using clang++ - -> Include `target=runtime` to build a runtime build (windows only at the moment) - -> The resulting library will be created in `godot-cpp/bin/`, take note of its name as it will be different depending on platform. - -> If you want to use an alternative api.json file add `use_custom_api_file=yes custom_api_file=../api.json`, be sure to specify the correct location of where you placed your file. - - -### Compile the demos - -A `Makefile` is provided in each demo to make the process more convenient. +This creates the file `libsimple` in the respective +subfolders in the `project/gdnative` directory. diff --git a/cpp/cpp_constructors/Main.gd b/cpp/cpp_constructors/Main.gd deleted file mode 100644 index c6fd2cd..0000000 --- a/cpp/cpp_constructors/Main.gd +++ /dev/null @@ -1,7 +0,0 @@ -extends Control - -onready var TestClass = preload("res://bin/testclass.gdns") - -func _ready(): - var test_object = TestClass.new() - test_object.test_method("Hello World") diff --git a/cpp/cpp_constructors/Main.tscn b/cpp/cpp_constructors/Main.tscn deleted file mode 100644 index c1fd8c8..0000000 --- a/cpp/cpp_constructors/Main.tscn +++ /dev/null @@ -1,9 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://Main.gd" type="Script" id=1] - -[node name="Main" type="Control"] -margin_right = 40.0 -margin_bottom = 40.0 -script = ExtResource( 1 ) - diff --git a/cpp/cpp_constructors/Makefile b/cpp/cpp_constructors/Makefile deleted file mode 100644 index d4f144c..0000000 --- a/cpp/cpp_constructors/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - scons cpp_bindings="../../godot-cpp/" headers="../../godot-cpp/godot_headers/" diff --git a/cpp/cpp_constructors/SConstruct b/cpp/cpp_constructors/SConstruct deleted file mode 100644 index 75d5548..0000000 --- a/cpp/cpp_constructors/SConstruct +++ /dev/null @@ -1,65 +0,0 @@ -#!python -import os - -# platform= makes it in line with Godots scons file, keeping p for backwards compatibility -platform = ARGUMENTS.get("p", "linux") -platform = ARGUMENTS.get("platform", platform) - -# This makes sure to keep the session environment variables on windows, -# that way you can run scons in a vs 2017 prompt and it will find all the required tools -env = Environment() -if platform == "windows": - env = Environment(ENV=os.environ) - -godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot-cpp/godot_headers")) -godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "godot-cpp")) - -# default to debug build, must be same setting as used for cpp_bindings -target = ARGUMENTS.get("target", "debug") - - -if ARGUMENTS.get("use_llvm", "no") == "yes": - env["CXX"] = "clang++" - -# put stuff that is the same for all first, saves duplication -if platform == "osx": - env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-arch", "x86_64"]) - env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "Cocoa", "-Wl,-undefined,dynamic_lookup"]) -elif platform == "linux": - env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-Wno-writable-strings"]) - env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) -elif platform == "windows": - # need to add detection of msvc vs mingw, this is for msvc... - env.Append(LINKFLAGS=["/WX"]) - if target == "debug": - env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) - else: - env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) - - -def add_sources(sources, dir): - for f in os.listdir(dir): - if f.endswith(".cpp"): - sources.append(dir + "/" + f) - - -env.Append( - CPPPATH=[ - godot_headers_path, - godot_bindings_path + "/include", - godot_bindings_path + "/include/gen/", - godot_bindings_path + "/include/core/", - ] -) - -if target == "debug": - env.Append(LIBS=["libgodot-cpp.linux.debug.64"]) -else: - env.Append(LIBS=["libgodot-cpp.linux.release.64"]) -env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) - -sources = [] -add_sources(sources, "src") - -library = env.SharedLibrary(target="bin/libconstructor", source=sources) -Default(library) diff --git a/cpp/cpp_constructors/bin/constructor.gdnlib b/cpp/cpp_constructors/bin/constructor.gdnlib deleted file mode 100644 index f06d909..0000000 --- a/cpp/cpp_constructors/bin/constructor.gdnlib +++ /dev/null @@ -1,16 +0,0 @@ -[entry] - -X11.64="res://bin/libconstructor.so" -X11.32="res://bin/libconstructor.so" - -[dependencies] - -X11.64=[ ] -X11.32=[ ] - -[general] - -singleton=false -load_once=true -symbol_prefix="godot_" -reloadable=true diff --git a/cpp/cpp_constructors/bin/testclass.gdns b/cpp/cpp_constructors/bin/testclass.gdns deleted file mode 100644 index 453c531..0000000 --- a/cpp/cpp_constructors/bin/testclass.gdns +++ /dev/null @@ -1,9 +0,0 @@ -[gd_resource type="NativeScript" load_steps=2 format=2] - -[ext_resource path="res://bin/constructor.gdnlib" type="GDNativeLibrary" id=1] - -[resource] - -class_name = "TestClass" -library = ExtResource( 1 ) - diff --git a/cpp/cpp_constructors/default_env.tres b/cpp/cpp_constructors/default_env.tres deleted file mode 100644 index 1b9440d..0000000 --- a/cpp/cpp_constructors/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/cpp/cpp_constructors/icon.png b/cpp/cpp_constructors/icon.png deleted file mode 100644 index 65024fb..0000000 Binary files a/cpp/cpp_constructors/icon.png and /dev/null differ diff --git a/cpp/cpp_constructors/icon.png.import b/cpp/cpp_constructors/icon.png.import deleted file mode 100644 index 45ee6af..0000000 --- a/cpp/cpp_constructors/icon.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" - -[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/cpp/cpp_constructors/project.godot b/cpp/cpp_constructors/project.godot deleted file mode 100644 index 3fcac90..0000000 --- a/cpp/cpp_constructors/project.godot +++ /dev/null @@ -1,23 +0,0 @@ -; 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=4 - -_global_script_classes=[ ] -_global_script_class_icons={ - -} - -[application] - -name="cpp_constructors" -icon="res://icon.png" - -[rendering] - -viewport/default_environment="res://default_env.tres" diff --git a/cpp/cpp_constructors/src/TestClass.hpp b/cpp/cpp_constructors/src/TestClass.hpp deleted file mode 100644 index fc0c34c..0000000 --- a/cpp/cpp_constructors/src/TestClass.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -#include - -#include - -using namespace godot; - -class TestClass : public Reference { - GODOT_CLASS(TestClass, Reference) - - int count; - -public: - void _init() { - count = 34; - } - - int test_method(String s) { - Godot::print(s); - count++; - - Timer *t = new Timer; - - t->set_wait_time(13.36 * count); - - Godot::print(String::num_real(t->get_wait_time())); - - delete t; - - // test Ref - Ref file; - file.instance(); - - file->open("res://test.txt", File::WRITE); - - file->close(); - - // ref should free the memory automatically - - return count; - } - - static void _register_methods() { - register_method("test_method", &TestClass::test_method); - } -}; diff --git a/cpp/cpp_constructors/src/init.cpp b/cpp/cpp_constructors/src/init.cpp deleted file mode 100644 index 5d31ed8..0000000 --- a/cpp/cpp_constructors/src/init.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include "TestClass.hpp" - -extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) { - godot::Godot::gdnative_init(o); -} - -extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) { - godot::Godot::gdnative_terminate(o); -} - -extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) { - godot::Godot::nativescript_init(handle); - - godot::register_class(); -} diff --git a/cpp/cpp_constructors/test.txt b/cpp/cpp_constructors/test.txt deleted file mode 100644 index e69de29..0000000 diff --git a/cpp/kinematic_character/.clang-format b/cpp/kinematic_character/.clang-format deleted file mode 100644 index 0407a7a..0000000 --- a/cpp/kinematic_character/.clang-format +++ /dev/null @@ -1,98 +0,0 @@ ---- -BasedOnStyle: LLVM -# Commented out parameters are those with the same value as base LLVM style -# We can uncomment them if we want to change their value, or enforce the -# chosen value in case the base style changes (initial sync: Clang 3.9.1). -... -Language: Cpp -AccessModifierOffset: -4 -AlignAfterOpenBracket: DontAlign -# AlignConsecutiveAssignments: false -# AlignConsecutiveDeclarations: false -# AlignEscapedNewlinesLeft: false -# AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -# AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: true -# AllowShortLoopsOnASingleLine: false -# AlwaysBreakAfterDefinitionReturnType: None -# AlwaysBreakAfterReturnType: None -# AlwaysBreakBeforeMultilineStrings: false -# AlwaysBreakTemplateDeclarations: false -# BinPackArguments: true -# BinPackParameters: true -# BraceWrapping: -# AfterClass: false -# AfterControlStatement: false -# AfterEnum: false -# AfterFunction: false -# AfterNamespace: false -# AfterObjCDeclaration: false -# AfterStruct: false -# AfterUnion: false -# BeforeCatch: false -# BeforeElse: false -# IndentBraces: false -# BreakBeforeBinaryOperators: None -# BreakBeforeBraces: Attach -BreakBeforeTernaryOperators: false -# BreakConstructorInitializersBeforeComma: false -# BreakAfterJavaFieldAnnotations: false -# BreakStringLiterals: true -ColumnLimit: 0 -# CommentPragmas: '^ IWYU pragma:' -# ConstructorInitializerAllOnOneLineOrOnePerLine: false -# ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 8 -Cpp11BracedListStyle: false -# DerivePointerAlignment: false -# DisableFormat: false -# ExperimentalAutoDetectBinPacking: false -# ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeCategories: - - Regex: '".*"' - Priority: 1 - - Regex: '^<.*\.h>' - Priority: 2 - - Regex: '^<.*' - Priority: 3 -# IncludeIsMainRegex: '$' -IndentCaseLabels: true -IndentWidth: 4 -# IndentWrappedFunctionNames: false -# JavaScriptQuotes: Leave -# JavaScriptWrapImports: true -# KeepEmptyLinesAtTheStartOfBlocks: true -# MacroBlockBegin: '' -# MacroBlockEnd: '' -# MaxEmptyLinesToKeep: 1 -# NamespaceIndentation: None -ObjCBlockIndentWidth: 4 -# ObjCSpaceAfterProperty: false -# ObjCSpaceBeforeProtocolList: true -# PenaltyBreakBeforeFirstCallParameter: 19 -# PenaltyBreakComment: 300 -# PenaltyBreakFirstLessLess: 120 -# PenaltyBreakString: 1000 -# PenaltyExcessCharacter: 1000000 -# PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -# ReflowComments: true -SortIncludes: true -# SpaceAfterCStyleCast: false -# SpaceBeforeAssignmentOperators: true -# SpaceBeforeParens: ControlStatements -# SpaceInEmptyParentheses: false -# SpacesBeforeTrailingComments: 1 -# SpacesInAngles: false -# SpacesInContainerLiterals: true -# SpacesInCStyleCastParentheses: false -# SpacesInParentheses: false -# SpacesInSquareBrackets: false -Standard: Cpp03 -TabWidth: 4 -UseTab: Always -... diff --git a/cpp/kinematic_character/.gitignore b/cpp/kinematic_character/.gitignore deleted file mode 100644 index bee95f5..0000000 --- a/cpp/kinematic_character/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -GDNative-demo.* -*.a diff --git a/cpp/kinematic_character/Character.tscn b/cpp/kinematic_character/Character.tscn deleted file mode 100644 index 76823d9..0000000 --- a/cpp/kinematic_character/Character.tscn +++ /dev/null @@ -1,87 +0,0 @@ -[gd_scene load_steps=13 format=2] - -[ext_resource path="res://Player Red/playerRed_stand.png" type="Texture" id=1] -[ext_resource path="res://Player Red/playerRed_walk1.png" type="Texture" id=2] -[ext_resource path="res://Player Red/playerRed_walk2.png" type="Texture" id=3] -[ext_resource path="res://Player Red/playerRed_walk3.png" type="Texture" id=4] -[ext_resource path="res://Player Red/playerRed_fall.png" type="Texture" id=5] -[ext_resource path="res://Player Red/playerRed_up1.png" type="Texture" id=6] -[ext_resource path="res://Player Red/playerRed_up2.png" type="Texture" id=7] -[ext_resource path="res://Player Red/playerRed_up3.png" type="Texture" id=8] - -[ext_resource path="res://Script/bin/libkinematic_char.gdnlib" type="GDNativeLibrary" id=9] - -[sub_resource type="NativeScript" id=4] - -resource_name = "GDPlayer" -class_name = "GDPlayer" -library = ExtResource( 9 ) - -[sub_resource type="SpriteFrames" id=1] - -animations = [ { -"frames": [ ExtResource( 1 ) ], -"loop": false, -"name": "Default", -"speed": 5.0 -}, { -"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 3 ) ], -"loop": true, -"name": "Run", -"speed": 5.0 -}, { -"frames": [ ExtResource( 5 ) ], -"loop": false, -"name": "JumpDown", -"speed": 5.0 -}, { -"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ) ], -"loop": false, -"name": "JumpUp", -"speed": 8.0 -} ] - -[sub_resource type="CircleShape2D" id=2] - -custom_solver_bias = 0.0 -radius = 22.8354 - -[node name="Character" type="KinematicBody2D"] - -scale = Vector2( 0.5, 0.5 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -script = SubResource( 4 ) -_sections_unfolded = [ "Transform" ] - -[node name="AnimatedSprite" type="AnimatedSprite" parent="."] - -frames = SubResource( 1 ) -animation = "Default" -playing = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] - -shape = SubResource( 2 ) - -[node name="Ray0" type="RayCast2D" parent="."] - -position = Vector2( -18, 0 ) -enabled = true -exclude_parent = true -cast_to = Vector2( 0, 25 ) -collision_layer = 1 -type_mask = 15 - -[node name="Ray1" type="RayCast2D" parent="."] - -position = Vector2( 19, 0 ) -enabled = true -exclude_parent = true -cast_to = Vector2( 0, 25 ) -collision_layer = 1 -type_mask = 15 - - diff --git a/cpp/kinematic_character/Player Red/playerRed_fall.png b/cpp/kinematic_character/Player Red/playerRed_fall.png deleted file mode 100644 index 423cd1c..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_fall.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_fall.png.import b/cpp/kinematic_character/Player Red/playerRed_fall.png.import deleted file mode 100644 index 212c407..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_fall.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_fall.png-301bfd41d778b32114baf3c9c50ff2be.stex" - -[deps] - -source_file="res://Player Red/playerRed_fall.png" -dest_files=[ "res://.import/playerRed_fall.png-301bfd41d778b32114baf3c9c50ff2be.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/cpp/kinematic_character/Player Red/playerRed_stand.png b/cpp/kinematic_character/Player Red/playerRed_stand.png deleted file mode 100644 index 53848de..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_stand.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_stand.png.import b/cpp/kinematic_character/Player Red/playerRed_stand.png.import deleted file mode 100644 index 1de5ed0..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_stand.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_stand.png-af591b973e2c87f6a38b4a41e4833941.stex" - -[deps] - -source_file="res://Player Red/playerRed_stand.png" -dest_files=[ "res://.import/playerRed_stand.png-af591b973e2c87f6a38b4a41e4833941.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/cpp/kinematic_character/Player Red/playerRed_up1.png b/cpp/kinematic_character/Player Red/playerRed_up1.png deleted file mode 100644 index a3abaca..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_up1.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_up1.png.import b/cpp/kinematic_character/Player Red/playerRed_up1.png.import deleted file mode 100644 index 3c95f67..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_up1.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_up1.png-f260a896e5f77f9f0845c53613477c85.stex" - -[deps] - -source_file="res://Player Red/playerRed_up1.png" -dest_files=[ "res://.import/playerRed_up1.png-f260a896e5f77f9f0845c53613477c85.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/cpp/kinematic_character/Player Red/playerRed_up2.png b/cpp/kinematic_character/Player Red/playerRed_up2.png deleted file mode 100644 index b57f881..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_up2.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_up2.png.import b/cpp/kinematic_character/Player Red/playerRed_up2.png.import deleted file mode 100644 index 0110ee0..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_up2.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_up2.png-87399f0c9fe53fc55fe801604850254a.stex" - -[deps] - -source_file="res://Player Red/playerRed_up2.png" -dest_files=[ "res://.import/playerRed_up2.png-87399f0c9fe53fc55fe801604850254a.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/cpp/kinematic_character/Player Red/playerRed_up3.png b/cpp/kinematic_character/Player Red/playerRed_up3.png deleted file mode 100644 index 998009f..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_up3.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_up3.png.import b/cpp/kinematic_character/Player Red/playerRed_up3.png.import deleted file mode 100644 index 725d1b8..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_up3.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_up3.png-95b2956869d268a117ea111914f90220.stex" - -[deps] - -source_file="res://Player Red/playerRed_up3.png" -dest_files=[ "res://.import/playerRed_up3.png-95b2956869d268a117ea111914f90220.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/cpp/kinematic_character/Player Red/playerRed_walk1.png b/cpp/kinematic_character/Player Red/playerRed_walk1.png deleted file mode 100644 index 11ad7a2..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_walk1.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_walk1.png.import b/cpp/kinematic_character/Player Red/playerRed_walk1.png.import deleted file mode 100644 index a93aec8..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_walk1.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_walk1.png-ade6ae6ec480d525ec4bd65536c4f3dc.stex" - -[deps] - -source_file="res://Player Red/playerRed_walk1.png" -dest_files=[ "res://.import/playerRed_walk1.png-ade6ae6ec480d525ec4bd65536c4f3dc.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/cpp/kinematic_character/Player Red/playerRed_walk2.png b/cpp/kinematic_character/Player Red/playerRed_walk2.png deleted file mode 100644 index d503aef..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_walk2.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_walk2.png.import b/cpp/kinematic_character/Player Red/playerRed_walk2.png.import deleted file mode 100644 index 50273c4..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_walk2.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_walk2.png-dee2c8490b7429a8491012a77edabca6.stex" - -[deps] - -source_file="res://Player Red/playerRed_walk2.png" -dest_files=[ "res://.import/playerRed_walk2.png-dee2c8490b7429a8491012a77edabca6.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/cpp/kinematic_character/Player Red/playerRed_walk3.png b/cpp/kinematic_character/Player Red/playerRed_walk3.png deleted file mode 100644 index 60933a5..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_walk3.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_walk3.png.import b/cpp/kinematic_character/Player Red/playerRed_walk3.png.import deleted file mode 100644 index 7af09cc..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_walk3.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_walk3.png-1bd3d8c9ff5f381422a5ef2523fe18dc.stex" - -[deps] - -source_file="res://Player Red/playerRed_walk3.png" -dest_files=[ "res://.import/playerRed_walk3.png-1bd3d8c9ff5f381422a5ef2523fe18dc.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/cpp/kinematic_character/Player Red/playerRed_walk4.png b/cpp/kinematic_character/Player Red/playerRed_walk4.png deleted file mode 100644 index e22526a..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_walk4.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_walk4.png.import b/cpp/kinematic_character/Player Red/playerRed_walk4.png.import deleted file mode 100644 index 44a0d8a..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_walk4.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_walk4.png-6009a111ffdcb8be52e3e006cb9940b3.stex" - -[deps] - -source_file="res://Player Red/playerRed_walk4.png" -dest_files=[ "res://.import/playerRed_walk4.png-6009a111ffdcb8be52e3e006cb9940b3.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/cpp/kinematic_character/Player Red/playerRed_walk5.png b/cpp/kinematic_character/Player Red/playerRed_walk5.png deleted file mode 100644 index fe0e49d..0000000 Binary files a/cpp/kinematic_character/Player Red/playerRed_walk5.png and /dev/null differ diff --git a/cpp/kinematic_character/Player Red/playerRed_walk5.png.import b/cpp/kinematic_character/Player Red/playerRed_walk5.png.import deleted file mode 100644 index 91ab745..0000000 --- a/cpp/kinematic_character/Player Red/playerRed_walk5.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/playerRed_walk5.png-23e13d3afa791a065240513219f17404.stex" - -[deps] - -source_file="res://Player Red/playerRed_walk5.png" -dest_files=[ "res://.import/playerRed_walk5.png-23e13d3afa791a065240513219f17404.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/cpp/kinematic_character/README.md b/cpp/kinematic_character/README.md deleted file mode 100644 index f588d39..0000000 --- a/cpp/kinematic_character/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# GDNative example of a kinematic character - -This is a demo showing how to use GDNative together with the cpp_bindings layer to implement a couple of new nodes. -This demo was originally created by Ramesh Ravone. - -Before compiling this module you must clone https://github.com/GodotNativeTools/godot_headers and https://github.com/GodotNativeTools/godot-cpp -Note that both are git submodule in Scripts/src so you can initialise these with git submodule but at you'll likely use these for other projects as well I advise giving them their own location. - -After both repositories have been downloaded you need to compile the cpp bindings, for this follow the instructions in the godot-cpp repository. - -Note that if you are on the latest master of Godot it is possible godot_headers is outdated. Instead of using this repository you can also use /modules/gdnative/include -Make sure that you compile both godot-cpp and this repository using the same headers. - -Once you are then ready to compile this module simply cd into the Scripts subfolder and execute: -scons platform=xyz -where xyz is your platform (linux, window and osx are currently supported). - -If you have installed godot_headers and/or godot-cpp in a different location you can use the swiches headers and cpp_bindings respectively. You can also set these paths using the environmental variables GODOT_HEADERS and CPP_BINDINGS, that is particularly useful if you have multiple projects. - -Finally you can switch between release and debug builds by adding the switch target. This must line up with the setting you use for compiling godot-cpp. diff --git a/cpp/kinematic_character/Script/.clang-format b/cpp/kinematic_character/Script/.clang-format deleted file mode 100644 index 0407a7a..0000000 --- a/cpp/kinematic_character/Script/.clang-format +++ /dev/null @@ -1,98 +0,0 @@ ---- -BasedOnStyle: LLVM -# Commented out parameters are those with the same value as base LLVM style -# We can uncomment them if we want to change their value, or enforce the -# chosen value in case the base style changes (initial sync: Clang 3.9.1). -... -Language: Cpp -AccessModifierOffset: -4 -AlignAfterOpenBracket: DontAlign -# AlignConsecutiveAssignments: false -# AlignConsecutiveDeclarations: false -# AlignEscapedNewlinesLeft: false -# AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -# AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: true -# AllowShortLoopsOnASingleLine: false -# AlwaysBreakAfterDefinitionReturnType: None -# AlwaysBreakAfterReturnType: None -# AlwaysBreakBeforeMultilineStrings: false -# AlwaysBreakTemplateDeclarations: false -# BinPackArguments: true -# BinPackParameters: true -# BraceWrapping: -# AfterClass: false -# AfterControlStatement: false -# AfterEnum: false -# AfterFunction: false -# AfterNamespace: false -# AfterObjCDeclaration: false -# AfterStruct: false -# AfterUnion: false -# BeforeCatch: false -# BeforeElse: false -# IndentBraces: false -# BreakBeforeBinaryOperators: None -# BreakBeforeBraces: Attach -BreakBeforeTernaryOperators: false -# BreakConstructorInitializersBeforeComma: false -# BreakAfterJavaFieldAnnotations: false -# BreakStringLiterals: true -ColumnLimit: 0 -# CommentPragmas: '^ IWYU pragma:' -# ConstructorInitializerAllOnOneLineOrOnePerLine: false -# ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 8 -Cpp11BracedListStyle: false -# DerivePointerAlignment: false -# DisableFormat: false -# ExperimentalAutoDetectBinPacking: false -# ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeCategories: - - Regex: '".*"' - Priority: 1 - - Regex: '^<.*\.h>' - Priority: 2 - - Regex: '^<.*' - Priority: 3 -# IncludeIsMainRegex: '$' -IndentCaseLabels: true -IndentWidth: 4 -# IndentWrappedFunctionNames: false -# JavaScriptQuotes: Leave -# JavaScriptWrapImports: true -# KeepEmptyLinesAtTheStartOfBlocks: true -# MacroBlockBegin: '' -# MacroBlockEnd: '' -# MaxEmptyLinesToKeep: 1 -# NamespaceIndentation: None -ObjCBlockIndentWidth: 4 -# ObjCSpaceAfterProperty: false -# ObjCSpaceBeforeProtocolList: true -# PenaltyBreakBeforeFirstCallParameter: 19 -# PenaltyBreakComment: 300 -# PenaltyBreakFirstLessLess: 120 -# PenaltyBreakString: 1000 -# PenaltyExcessCharacter: 1000000 -# PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -# ReflowComments: true -SortIncludes: true -# SpaceAfterCStyleCast: false -# SpaceBeforeAssignmentOperators: true -# SpaceBeforeParens: ControlStatements -# SpaceInEmptyParentheses: false -# SpacesBeforeTrailingComments: 1 -# SpacesInAngles: false -# SpacesInContainerLiterals: true -# SpacesInCStyleCastParentheses: false -# SpacesInParentheses: false -# SpacesInSquareBrackets: false -Standard: Cpp03 -TabWidth: 4 -UseTab: Always -... diff --git a/cpp/kinematic_character/Script/.gitmodules b/cpp/kinematic_character/Script/.gitmodules deleted file mode 100644 index 93e89e3..0000000 --- a/cpp/kinematic_character/Script/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "cpp_bindings"] - path = cpp_bindings - url = http://github.com/GodotNativeTools/cpp_bindings/ -[submodule "godot_headers"] - path = godot_headers - url = http://github.com/GodotNativeTools/godot_headers diff --git a/cpp/kinematic_character/Script/.sconsign.dblite b/cpp/kinematic_character/Script/.sconsign.dblite deleted file mode 100644 index 657328f..0000000 Binary files a/cpp/kinematic_character/Script/.sconsign.dblite and /dev/null differ diff --git a/cpp/kinematic_character/Script/Makefile b/cpp/kinematic_character/Script/Makefile deleted file mode 100644 index 1c0ddb9..0000000 --- a/cpp/kinematic_character/Script/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - scons cpp_bindings="../../../godot-cpp/" headers="../../../godot-cpp/godot_headers/" diff --git a/cpp/kinematic_character/Script/SConstruct b/cpp/kinematic_character/Script/SConstruct deleted file mode 100644 index 364660c..0000000 --- a/cpp/kinematic_character/Script/SConstruct +++ /dev/null @@ -1,65 +0,0 @@ -#!python -import os - -# platform= makes it in line with Godots scons file, keeping p for backwards compatibility -platform = ARGUMENTS.get("p", "linux") -platform = ARGUMENTS.get("platform", platform) - -# This makes sure to keep the session environment variables on windows, -# that way you can run scons in a vs 2017 prompt and it will find all the required tools -env = Environment() -if platform == "windows": - env = Environment(ENV=os.environ) - -godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot-cpp/godot_headers")) -godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "godot-cpp")) - -# default to debug build, must be same setting as used for cpp_bindings -target = ARGUMENTS.get("target", "debug") - - -if ARGUMENTS.get("use_llvm", "no") == "yes": - env["CXX"] = "clang++" - -# put stuff that is the same for all first, saves duplication -if platform == "osx": - env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-arch", "x86_64"]) - env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "Cocoa", "-Wl,-undefined,dynamic_lookup"]) -elif platform == "linux": - env.Append(CCFLAGS=["-g", "-O3", "-std=c++14", "-Wno-writable-strings"]) - env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"]) -elif platform == "windows": - # need to add detection of msvc vs mingw, this is for msvc... - env.Append(LINKFLAGS=["/WX"]) - if target == "debug": - env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "/MDd"]) - else: - env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "/MD"]) - - -def add_sources(sources, dir): - for f in os.listdir(dir): - if f.endswith(".cpp"): - sources.append(dir + "/" + f) - - -env.Append( - CPPPATH=[ - godot_headers_path, - godot_bindings_path + "/include/gen/", - godot_bindings_path + "/include/core/", - godot_bindings_path + "/include/", - ] -) - -if target == "debug": - env.Append(LIBS=["libgodot-cpp.linux.debug.64"]) -else: - env.Append(LIBS=["libgodot-cpp.linux.release.64"]) -env.Append(LIBPATH=[godot_bindings_path + "/bin/"]) - -sources = [] -add_sources(sources, "src") - -library = env.SharedLibrary(target="bin/libkinematic_char", source=sources) -Default(library) diff --git a/cpp/kinematic_character/Script/bin/libkinematic_char.gdnlib b/cpp/kinematic_character/Script/bin/libkinematic_char.gdnlib deleted file mode 100644 index a9b1be2..0000000 --- a/cpp/kinematic_character/Script/bin/libkinematic_char.gdnlib +++ /dev/null @@ -1,17 +0,0 @@ -[general] - -singleton=false -load_once=false -symbol_prefix="godot_" - -[entry] - -X11.64="res://Script/bin/libkinematic_char.so" -Windows.64="res://Script/bin/libkinematic_char.dll" -OSX.64="res://Script/bin/libkinematic_char.dylib" - -[dependencies] - -X11.64=[] -Windows.64=[] -OSX.64=[] diff --git a/cpp/kinematic_character/Script/char_con.gdns b/cpp/kinematic_character/Script/char_con.gdns deleted file mode 100644 index 44bf4ff..0000000 --- a/cpp/kinematic_character/Script/char_con.gdns +++ /dev/null @@ -1,11 +0,0 @@ -[gd_resource type="NativeScript" load_steps=2 format=2] - -[ext_resource path="res://Script/bin/libkinematic_char.gdnlib" type="GDNativeLibrary" id=1] - -[resource] - -resource_name = "GDPlayer" -class_name = "GDPlayer" -library = ExtResource( 1 ) - - diff --git a/cpp/kinematic_character/Script/colworld.gdns b/cpp/kinematic_character/Script/colworld.gdns deleted file mode 100644 index 2d401b7..0000000 --- a/cpp/kinematic_character/Script/colworld.gdns +++ /dev/null @@ -1,11 +0,0 @@ -[gd_resource type="NativeScript" load_steps=2 format=2] - -[ext_resource path="res://Script/bin/libkinematic_char.gdnlib" type="GDNativeLibrary" id=1] - -[resource] - -resource_name = "GDPlayer" -class_name = "ColWorld" -library = ExtResource( 1 ) - - diff --git a/cpp/kinematic_character/Script/src/.gdignore b/cpp/kinematic_character/Script/src/.gdignore deleted file mode 100644 index e69de29..0000000 diff --git a/cpp/kinematic_character/Script/src/colworld.cpp b/cpp/kinematic_character/Script/src/colworld.cpp deleted file mode 100644 index a36d375..0000000 --- a/cpp/kinematic_character/Script/src/colworld.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2017 RameshRavone. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "colworld.h" -#include - -using namespace godot; - -ColWorld::ColWorld() { -} - -ColWorld::~ColWorld() { -} - -void ColWorld::_init() { -} - -void ColWorld::_ready() { - get_node("princess")->connect("body_entered", this, "_on_princess_body_enter"); -} - -void ColWorld::_on_princess_body_enter(KinematicBody2D *body) { - if (body->get_name() == "Character") { - ((Label *)get_node("youwin"))->show(); - } -} - -void ColWorld::_register_methods() { - register_method("_init", &ColWorld::_init); - register_method("_ready", &ColWorld::_ready); - - register_method("_on_princess_body_enter", &ColWorld::_on_princess_body_enter); -} diff --git a/cpp/kinematic_character/Script/src/colworld.h b/cpp/kinematic_character/Script/src/colworld.h deleted file mode 100644 index 3331fd3..0000000 --- a/cpp/kinematic_character/Script/src/colworld.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2017 RameshRavone. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#ifndef COLWORLD_H -#define COLWORLD_H - -#include -#include -#include - -namespace godot { - -class ColWorld : public Node2D { - GODOT_CLASS(ColWorld, Node2D) - -public: - ColWorld(); - ~ColWorld(); - - void _init(); - void _ready(); - void _on_princess_body_enter(KinematicBody2D *body); - - static void _register_methods(); -}; -} // namespace godot - -#endif // COLWORLD_H diff --git a/cpp/kinematic_character/Script/src/common.cpp b/cpp/kinematic_character/Script/src/common.cpp deleted file mode 100644 index 0b0135d..0000000 --- a/cpp/kinematic_character/Script/src/common.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2017 RameshRavone. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include - -#include "colworld.h" -#include "player.h" - -using namespace godot; - -extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *options) { - Godot::gdnative_init(options); -} - -extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *options) { - Godot::gdnative_terminate(options); -} - -extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) { - Godot::nativescript_init(handle); - - register_class(); - register_class(); -} diff --git a/cpp/kinematic_character/Script/src/player.cpp b/cpp/kinematic_character/Script/src/player.cpp deleted file mode 100644 index 69e599e..0000000 --- a/cpp/kinematic_character/Script/src/player.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright 2017 RameshRavone. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "player.h" -#include "colworld.h" - -#include -#include -#include - -#include - -using namespace godot; - -const static float _gravity = 400.0; - -const static float _floor_angle_tolerance = 40.0; -const static float _walk_force = 500.0; -const static float _walk_min_speed = 10.0; -const static float _walk_max_speed = 200.0; -const static float _stop_force = 1300.0; -const static float _jump_speed = 200.0; -const static float _max_airborn_time = 0.2; - -const static float _slide_stop_velocity = 1.0; -const static float _slide_stop_min_travel = 1.0; - -template -int sign(const T &val) { - return (val > 0) - (val < 0); -} - -GDPlayer::GDPlayer() { -} - -GDPlayer::~GDPlayer() { -} - -void GDPlayer::_init() { - Vector2 _force = Vector2(); - - _jumping = false; - _on_air_time = 0.0; - _current_anim = "Default"; -} - -void GDPlayer::_ready() { - ray0 = ((RayCast2D *)get_node("Ray0")); - ray1 = ((RayCast2D *)get_node("Ray1")); - - ray0->add_exception(this); - ray1->add_exception(this); - - connect("move", this, "_move"); -} - -void GDPlayer::moving() { - Godot::print("Player Jumping"); -} - -void GDPlayer::_physics_process(const float delta) { - Vector2 _force = Vector2(0, _gravity); - - bool left = Input::get_singleton()->is_action_pressed("ui_left"); - bool right = Input::get_singleton()->is_action_pressed("ui_right"); - bool jump = Input::get_singleton()->is_action_pressed("ui_up"); - - bool stop = true; - - if (left) { - if (_velocity.x <= _walk_min_speed && _velocity.x > -_walk_max_speed) { - _force.x -= _walk_force; - stop = false; - } - } else if (right) { - if (_velocity.x >= -_walk_min_speed && _velocity.x < _walk_max_speed) { - _force.x += _walk_force; - stop = false; - } - } - - if (stop) { - float vsign = sign(_velocity.x); - float vlen = std::abs(_velocity.x); - - vlen -= _stop_force * delta; - - if (vlen < 0) { - vlen = 0; - } - - _velocity.x = (vlen * vsign); - } - - // Integrate forces to velocity - _velocity += _force * delta; - // Integrate velocity into motion and move - _velocity = move_and_slide(_velocity, Vector2(0, -1)); - - bool floor_colliding = (ray0->is_colliding() || ray1->is_colliding()); - - if (is_on_floor() || floor_colliding) { - _on_air_time = 0; - } - - if (_on_air_time < _max_airborn_time && jump && !_prev_jump_pressed && !_jumping) { - _velocity.y = -_jump_speed; - _jumping = false; - emit_signal("move"); - } - - _on_air_time += delta; - _prev_jump_pressed = jump; - - /** - * @brief Animating - * - * The following show's how to get the child nodes and access there functions.. - */ - - bool animating = false; - - if (left) { - ((AnimatedSprite *)get_node("AnimatedSprite"))->set_flip_h(true); - if (floor_colliding) { - _current_anim = "Run"; - } - animating = true; - } - if (right) { - ((AnimatedSprite *)get_node("AnimatedSprite"))->set_flip_h(false); - if (floor_colliding) { - _current_anim = "Run"; - } - animating = true; - } - - if (!floor_colliding) { - if (_velocity.y > 0) { - _current_anim = "JumpDown"; - } - if (_velocity.y < 0) { - _current_anim = "JumpUp"; - } - } else if (!animating) { - _current_anim = "Default"; - } - - ((AnimatedSprite *)get_node("AnimatedSprite"))->play(_current_anim); -} - -void GDPlayer::_register_methods() { - register_method((char *)"_init", &GDPlayer::_init); - register_method((char *)"_ready", &GDPlayer::_ready); - register_method((char *)"_move", &GDPlayer::moving); - - register_method((char *)"_physics_process", &GDPlayer::_physics_process); - - register_signal("move"); -} diff --git a/cpp/kinematic_character/Script/src/player.h b/cpp/kinematic_character/Script/src/player.h deleted file mode 100644 index fd26fd1..0000000 --- a/cpp/kinematic_character/Script/src/player.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2017 RameshRavone. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#ifndef PLAYER_H -#define PLAYER_H - -#include -#include -#include - -#include - -using namespace godot; - -class GDPlayer : public KinematicBody2D { - GODOT_CLASS(GDPlayer, KinematicBody2D) - -public: - GDPlayer(); - ~GDPlayer(); - - void _init(); - void _ready(); - void moving(); - - void _physics_process(const float delta); - - static void _register_methods(); - -private: - bool _jumping; - bool _prev_jump_pressed; - - float _on_air_time; - - Vector2 _velocity; - String _current_anim; - - RayCast2D *ray0; - RayCast2D *ray1; -}; - -#endif // PLAYER_H_ diff --git a/cpp/kinematic_character/circle.png b/cpp/kinematic_character/circle.png deleted file mode 100644 index 6e20c19..0000000 Binary files a/cpp/kinematic_character/circle.png and /dev/null differ diff --git a/cpp/kinematic_character/circle.png.import b/cpp/kinematic_character/circle.png.import deleted file mode 100644 index 65dc5fc..0000000 --- a/cpp/kinematic_character/circle.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/circle.png-10953cad44a8947fbdd4128a631e9e52.stex" - -[deps] - -source_file="res://circle.png" -dest_files=[ "res://.import/circle.png-10953cad44a8947fbdd4128a631e9e52.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/cpp/kinematic_character/colworld.tscn b/cpp/kinematic_character/colworld.tscn deleted file mode 100644 index 68162e4..0000000 --- a/cpp/kinematic_character/colworld.tscn +++ /dev/null @@ -1,388 +0,0 @@ -[gd_scene load_steps=20 format=2] - -[ext_resource path="res://Script/bin/libkinematic_char.gdnlib" type="GDNativeLibrary" id=1] -[ext_resource path="res://obstacle.png" type="Texture" id=2] -[ext_resource path="res://princess.png" type="Texture" id=3] -[ext_resource path="res://Character.tscn" type="PackedScene" id=4] -[ext_resource path="res://circle.png" type="Texture" id=5] -[ext_resource path="res://long_obstacle.png" type="Texture" id=6] - -[sub_resource type="NativeScript" id=1] - -resource_name = "ColWorld" -class_name = "ColWorld" -library = ExtResource( 1 ) - -[sub_resource type="RectangleShape2D" id=2] - -custom_solver_bias = 0.0 -extents = Vector2( 8, 8 ) - -[sub_resource type="TileSet" id=3] - -0/name = "" -0/texture = ExtResource( 2 ) -0/tex_offset = Vector2( 0, 0 ) -0/modulate = Color( 1, 1, 1, 1 ) -0/region = Rect2( 0, 0, 0, 0 ) -0/tile_mode = 0 -0/occluder_offset = Vector2( 0, 0 ) -0/navigation_offset = Vector2( 0, 0 ) -0/shapes = [ { -"autotile_coord": Vector2( 0, 0 ), -"one_way": false, -"shape": SubResource( 2 ), -"shape_transform": Transform2D( 1, 0, 0, 1, 8, 8 ) -} ] -0/z_index = 0 - -[sub_resource type="RectangleShape2D" id=4] - -custom_solver_bias = 0.0 -extents = Vector2( 8, 8 ) - -[sub_resource type="RectangleShape2D" id=5] - -custom_solver_bias = 0.0 -extents = Vector2( 8, 8 ) - -[sub_resource type="Animation" id=6] - -length = 10.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath(".:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1, 5, 6 ), -"transitions": PoolRealArray( 1, 1, 1, 1 ), -"update": 0, -"values": [ Vector2( 184, 152 ), Vector2( 184, 152 ), Vector2( 328.086, 152 ), Vector2( 328.086, 152 ) ] -} - -[sub_resource type="Animation" id=7] - -length = 10.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath(".:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1, 5, 6 ), -"transitions": PoolRealArray( 1, 1, 1, 1 ), -"update": 0, -"values": [ Vector2( 184, 152 ), Vector2( 184, 152 ), Vector2( 328.086, 152 ), Vector2( 328.086, 152 ) ] -} - -[sub_resource type="Animation" id=8] - -length = 10.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath(".:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1, 5, 6 ), -"transitions": PoolRealArray( 1, 1, 1, 1 ), -"update": 0, -"values": [ Vector2( 88.3493, 296 ), Vector2( 88.3493, 296 ), Vector2( 88.3493, 152 ), Vector2( 88.3493, 152 ) ] -} - -[sub_resource type="RectangleShape2D" id=9] - -custom_solver_bias = 0.0 -extents = Vector2( 10, 4 ) - -[sub_resource type="CircleShape2D" id=10] - -custom_solver_bias = 0.0 -radius = 32.0 - -[sub_resource type="Animation" id=11] - -length = 20.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath(".:rotation_deg") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 5, 10, 15 ), -"transitions": PoolRealArray( -2, -2, -2, -2 ), -"update": 0, -"values": [ 0.0, 90.0, 0.0, -90.0 ] -} - -[sub_resource type="RectangleShape2D" id=12] - -custom_solver_bias = 0.0 -extents = Vector2( 8, 8 ) - -[sub_resource type="RectangleShape2D" id=13] - -custom_solver_bias = 0.0 -extents = Vector2( 32, 8 ) - -[node name="colworld" type="Node2D"] -editor/display_folded = true -script = SubResource( 1 ) - -[node name="TileMap" type="TileMap" parent="."] -mode = 0 -tile_set = SubResource( 3 ) -cell_size = Vector2( 16, 16 ) -cell_quadrant_size = 16 -cell_custom_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -cell_half_offset = 2 -cell_tile_origin = 0 -cell_y_sort = false -cell_clip_uv = false -collision_use_kinematic = false -collision_friction = 1.0 -collision_bounce = 0.0 -collision_layer = 1 -collision_mask = 1 -occluder_light_mask = 1 -format = 1 -tile_data = PoolIntArray( 0, 0, 2141323264, 1, 0, 2141323264, 2, 0, 2141323264, 3, 0, 2141323264, 4, 0, 2141323264, 5, 0, 2141323264, 6, 0, 2141323264, 7, 0, 2141323264, 8, 0, 2141323264, 9, 0, 2141323264, 10, 0, 2141323264, 11, 0, 2141323264, 12, 0, 2141323264, 13, 0, 2141323264, 14, 0, 2141323264, 15, 0, 2141323264, 16, 0, 2141323264, 17, 0, 2141323264, 18, 0, 2141323264, 19, 0, 2141323264, 20, 0, 2141323264, 21, 0, 2141323264, 22, 0, 2141323264, 23, 0, 2141323264, 24, 0, 2141323264, 25, 0, 2141323264, 26, 0, 2141323264, 27, 0, 2141323264, 28, 0, 2141323264, 29, 0, 2141323264, 30, 0, 2141323264, 31, 0, 2141323264, 32, 0, 2141323264, 65536, 0, 2141323264, 65537, 0, 2141323264, 65538, 0, 2141323264, 65539, 0, 2141323264, 65540, 0, 2141323264, 65541, 0, 2141323264, 65542, 0, 2141323264, 65543, 0, 2141323264, 65544, 0, 2141323264, 65545, 0, 2141323264, 65546, 0, 2141323264, 65547, 0, 2141323264, 65548, 0, 2141323264, 65549, 0, 2141323264, 65550, 0, 2141323264, 65551, 0, 2141323264, 65552, 0, 2141323264, 65553, 0, 2141323264, 65554, 0, 2141323264, 65555, 0, 2141323264, 65556, 0, 2141323264, 65557, 0, 2141323264, 65558, 0, 2141323264, 65559, 0, 2141323264, 65560, 0, 2141323264, 65561, 0, 2141323264, 65562, 0, 2141323264, 65563, 0, 2141323264, 65564, 0, 2141323264, 65565, 0, 2141323264, 65566, 0, 2141323264, 65567, 0, 2141323264, 65568, 0, 2141323264, 131072, 0, 2141323264, 131073, 0, 2141323264, 131103, 0, 2141323264, 131104, 0, 2141323264, 196608, 0, 2141323264, 196609, 0, 2141323264, 196639, 0, 2141323264, 196640, 0, 2141323264, 262144, 0, 2141323264, 262145, 0, 2141323264, 262175, 0, 2141323264, 262176, 0, 2141323264, 327680, 0, 2141323264, 327681, 0, 2141323264, 327685, 0, 2141323264, 327686, 0, 2141323264, 327687, 0, 2141323264, 327688, 0, 2141323264, 327689, 0, 2141323264, 327690, 0, 2141323264, 327691, 0, 2141323264, 327692, 0, 2141323264, 327693, 0, 2141323264, 327697, 0, 2141323264, 327698, 0, 2141323264, 327711, 0, 2141323264, 327712, 0, 2141323264, 393216, 0, 2141323264, 393217, 0, 2141323264, 393237, 0, 2141323264, 393238, 0, 2141323264, 393247, 0, 2141323264, 393248, 0, 2141323264, 458752, 0, 2141323264, 458753, 0, 2141323264, 458783, 0, 2141323264, 458784, 0, 2141323264, 524288, 0, 2141323264, 524289, 0, 2141323264, 524313, 0, 2141323264, 524314, 0, 2141323264, 524319, 0, 2141323264, 524320, 0, 2141323264, 589824, 0, 2141323264, 589825, 0, 2141323264, 589830, 0, 2141323264, 589831, 0, 2141323264, 589832, 0, 2141323264, 589833, 0, 2141323264, 589834, 0, 2141323264, 589845, 0, 2141323264, 589846, 0, 2141323264, 589847, 0, 2141323264, 589855, 0, 2141323264, 589856, 0, 2141323264, 655360, 0, 2141323264, 655361, 0, 2141323264, 655391, 0, 2141323264, 655392, 0, 2141323264, 720896, 0, 2141323264, 720897, 0, 2141323264, 720927, 0, 2141323264, 720928, 0, 2141323264, 786432, 0, 2141323264, 786433, 0, 2141323264, 786463, 0, 2141323264, 786464, 0, 2141323264, 851968, 0, 2141323264, 851969, 0, 2141323264, 851999, 0, 2141323264, 852000, 0, 2141323264, 917504, 0, 2141323264, 917505, 0, 2141323264, 917535, 0, 2141323264, 917536, 0, 2141323264, 983040, 0, 2141323264, 983041, 0, 2141323264, 983071, 0, 2141323264, 983072, 0, 2141323264, 1048576, 0, 2141323264, 1048577, 0, 2141323264, 1048607, 0, 2141323264, 1048608, 0, 2141323264, 1114112, 0, 2141323264, 1114113, 0, 2141323264, 1114143, 0, 2141323264, 1114144, 0, 2141323264, 1179648, 0, 2141323264, 1179649, 0, 2141323264, 1179654, 0, 2141323264, 1179655, 0, 2141323264, 1179656, 0, 2141323264, 1179679, 0, 2141323264, 1179680, 0, 2141323264, 1245184, 0, 2141323264, 1245185, 0, 2141323264, 1245204, 0, 2141323264, 1245205, 0, 2141323264, 1245206, 0, 2141323264, 1245207, 0, 2141323264, 1245215, 0, 2141323264, 1245216, 0, 2141323264, 1310720, 0, 2141323264, 1310721, 0, 2141323264, 1310751, 0, 2141323264, 1310752, 0, 2141323264, 1376256, 0, 2141323264, 1376257, 0, 2141323264, 1376285, 0, 2141323264, 1376286, 0, 2141323264, 1376287, 0, 2141323264, 1376288, 0, 2141323264, 1441792, 0, 2141323264, 1441793, 0, 2141323264, 1441823, 0, 2141323264, 1441824, 0, 2141323264, 1507328, 0, 2141323264, 1507329, 0, 2141323264, 1507359, 0, 2141323264, 1507360, 0, 2141323264, 1572864, 0, 2141323264, 1572865, 0, 2141323264, 1572890, 0, 2141323264, 1572891, 0, 2141323264, 1572895, 0, 2141323264, 1572896, 0, 2141323264, 1638400, 0, 2141323264, 1638401, 0, 2141323264, 1638413, 0, 2141323264, 1638425, 0, 2141323264, 1638426, 0, 2141323264, 1638431, 0, 2141323264, 1638432, 0, 2141323264, 1703936, 0, 2141323264, 1703937, 0, 2141323264, 1703946, 0, 2141323264, 1703947, 0, 2141323264, 1703948, 0, 2141323264, 1703949, 0, 2141323264, 1703965, 0, 2141323264, 1703966, 0, 2141323264, 1703967, 0, 2141323264, 1703968, 0, 2141323264, 1769472, 0, 2141323264, 1769473, 0, 2141323264, 1769482, 0, 2141323264, 1769483, 0, 2141323264, 1769501, 0, 2141323264, 1769502, 0, 2141323264, 1769503, 0, 2141323264, 1769504, 0, 2141323264, 1835008, 0, 2141323264, 1835009, 0, 2141323264, 1835012, 0, 2141323264, 1835018, 0, 2141323264, 1835019, 0, 2141323264, 1835034, 0, 2141323264, 1835035, 0, 2141323264, 1835036, 0, 2141323264, 1835037, 0, 2141323264, 1835038, 0, 2141323264, 1835039, 0, 2141323264, 1835040, 0, 2141323264, 1900544, 0, 2141323264, 1900545, 0, 2141323264, 1900546, 0, 2141323264, 1900547, 0, 2141323264, 1900548, 0, 2141323264, 1900549, 0, 2141323264, 1900550, 0, 2141323264, 1900551, 0, 2141323264, 1900552, 0, 2141323264, 1900553, 0, 2141323264, 1900554, 0, 2141323264, 1900555, 0, 2141323264, 1900556, 0, 2141323264, 1900557, 0, 2141323264, 1900558, 0, 2141323264, 1900559, 0, 2141323264, 1900560, 0, 2141323264, 1900561, 0, 2141323264, 1900562, 0, 2141323264, 1900563, 0, 2141323264, 1900564, 0, 2141323264, 1900565, 0, 2141323264, 1900566, 0, 2141323264, 1900567, 0, 2141323264, 1900568, 0, 2141323264, 1900569, 0, 2141323264, 1900570, 0, 2141323264, 1900571, 0, 2141323264, 1900572, 0, 2141323264, 1900573, 0, 2141323264, 1900574, 0, 2141323264, 1900575, 0, 2141323264, 1900576, 0, 2141323264, 1966080, 0, 2141323264, 1966081, 0, 2141323264, 1966082, 0, 2141323264, 1966083, 0, 2141323264, 1966084, 0, 2141323264, 1966085, 0, 2141323264, 1966086, 0, 2141323264, 1966087, 0, 2141323264, 1966088, 0, 2141323264, 1966089, 0, 2141323264, 1966090, 0, 2141323264, 1966091, 0, 2141323264, 1966092, 0, 2141323264, 1966093, 0, 2141323264, 1966094, 0, 2141323264, 1966095, 0, 2141323264, 1966096, 0, 2141323264, 1966097, 0, 2141323264, 1966098, 0, 2141323264, 1966099, 0, 2141323264, 1966100, 0, 2141323264, 1966101, 0, 2141323264, 1966102, 0, 2141323264, 1966103, 0, 2141323264, 1966104, 0, 2141323264, 1966105, 0, 2141323264, 1966106, 0, 2141323264, 1966107, 0, 2141323264, 1966108, 0, 2141323264, 1966109, 0, 2141323264, 1966110, 0, 2141323264, 1966111, 0, 2141323264, 1966112, 0, 2141323264, 2031616, 0, 2141323264, 2031617, 0, 2141323264, 2031618, 0, 2141323264, 2031619, 0, 2141323264, 2031620, 0, 2141323264, 2031621, 0, 2141323264, 2031622, 0, 2141323264, 2031623, 0, 2141323264, 2031624, 0, 2141323264, 2031625, 0, 2141323264, 2031626, 0, 2141323264, 2031627, 0, 2141323264, 2031628, 0, 2141323264, 2031629, 0, 2141323264, 2031630, 0, 2141323264, 2031631, 0, 2141323264, 2031632, 0, 2141323264, 2031633, 0, 2141323264, 2031634, 0, 2141323264, 2031635, 0, 2141323264, 2031636, 0, 2141323264, 2031637, 0, 2141323264, 2031638, 0, 2141323264, 2031639, 0, 2141323264, 2031640, 0, 2141323264, 2031641, 0, 2141323264, 2031642, 0, 2141323264, 2031643, 0, 2141323264, 2031644, 0, 2141323264, 2031645, 0, 2141323264, 2031646, 0, 2141323264, 2031647, 0, 2141323264, 2031648, 0, 2141323264 ) - -[node name="princess" type="Area2D" parent="."] -editor/display_folded = true -position = Vector2( 97, 72 ) -input_pickable = true -gravity_vec = Vector2( 0, 1 ) -gravity = 98.0 -linear_damp = 0.1 -angular_damp = 1.0 -audio_bus_override = false -audio_bus_name = "Master" - -[node name="collision" type="CollisionShape2D" parent="princess"] -shape = SubResource( 4 ) - -[node name="Sprite" type="Sprite" parent="princess"] -texture = ExtResource( 3 ) - -[node name="Character" parent="." instance=ExtResource( 4 )] -position = Vector2( 354.296, 254.923 ) -motion/sync_to_physics = false - -[node name="moving_platform1" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 274.142, 152 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="collision" type="CollisionShape2D" parent="moving_platform1"] -shape = SubResource( 5 ) - -[node name="sprite" type="Sprite" parent="moving_platform1"] -texture = ExtResource( 2 ) - -[node name="anim" type="AnimationPlayer" parent="moving_platform1"] -root_node = NodePath("..") -autoplay = "leftright" -playback_process_mode = 0 -playback_default_blend_time = 0.0 -playback_speed = 1.0 -anims/leftright = SubResource( 6 ) -blend_times = [ ] - -[node name="moving_platform2" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 88.3493, 284.689 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="collision" type="CollisionShape2D" parent="moving_platform2"] -shape = SubResource( 5 ) - -[node name="sprite" type="Sprite" parent="moving_platform2"] -texture = ExtResource( 2 ) - -[node name="anim" type="AnimationPlayer" parent="moving_platform2"] -root_node = NodePath("..") -autoplay = "updown" -playback_process_mode = 0 -playback_default_blend_time = 0.0 -playback_speed = 1.0 -anims/leftright = SubResource( 7 ) -anims/updown = SubResource( 8 ) -blend_times = [ ] - -[node name="youwin" type="Label" parent="."] -visible = false -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 196.0 -margin_top = 41.0 -margin_right = 344.0 -margin_bottom = 67.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 2 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 2 -size_flags_vertical = 0 -text = "Thank You Cubio -You Saved The Princess!" -align = 1 -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 - -[node name="oneway1" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 439, 308 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="sprite" type="Sprite" parent="oneway1"] -scale = Vector2( 1, 0.3 ) -texture = ExtResource( 2 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway1"] -shape = SubResource( 9 ) -one_way_collision = true - -[node name="oneway2" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 456, 308 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="sprite" type="Sprite" parent="oneway2"] -scale = Vector2( 1, 0.3 ) -texture = ExtResource( 2 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway2"] -shape = SubResource( 9 ) -one_way_collision = true - -[node name="oneway3" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 472, 308 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="sprite" type="Sprite" parent="oneway3"] -scale = Vector2( 1, 0.3 ) -texture = ExtResource( 2 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway3"] -shape = SubResource( 9 ) -one_way_collision = true - -[node name="oneway4" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 487, 308 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="sprite" type="Sprite" parent="oneway4"] -scale = Vector2( 1, 0.3 ) -texture = ExtResource( 2 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway4"] -shape = SubResource( 9 ) -one_way_collision = true - -[node name="circle" type="KinematicBody2D" parent="."] -editor/display_folded = true -position = Vector2( 241.169, 304.126 ) -input_pickable = false -collision_layer = 1 -collision_mask = 1 -collision/safe_margin = 0.08 -motion/sync_to_physics = false - -[node name="sprite" type="Sprite" parent="circle"] -texture = ExtResource( 5 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="circle"] -shape = SubResource( 10 ) - -[node name="anim" type="AnimationPlayer" parent="circle"] -root_node = NodePath("..") -autoplay = "turn" -playback_process_mode = 1 -playback_default_blend_time = 0.0 -playback_speed = 1.0 -anims/turn = SubResource( 11 ) -blend_times = [ ] - -[node name="box" type="CollisionShape2D" parent="circle"] -position = Vector2( -0.440125, -37.0904 ) -shape = SubResource( 12 ) - -[node name="boxsprite" type="Sprite" parent="circle"] -position = Vector2( 0, -37.4108 ) -texture = ExtResource( 2 ) - -[node name="platform" type="StaticBody2D" parent="."] -editor/display_folded = true -position = Vector2( 251.44, 396.557 ) -rotation = -0.428054 -input_pickable = false -collision_layer = 1 -collision_mask = 1 -constant_linear_velocity = Vector2( 0, 0 ) -constant_angular_velocity = 0.0 - -[node name="sprite" type="Sprite" parent="platform"] -texture = ExtResource( 6 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="platform"] -shape = SubResource( 13 ) - -[node name="platform1" type="StaticBody2D" parent="."] -editor/display_folded = true -position = Vector2( 369.116, 394.016 ) -rotation = 0.465931 -input_pickable = false -collision_layer = 1 -collision_mask = 1 -constant_linear_velocity = Vector2( 0, 0 ) -constant_angular_velocity = 0.0 - -[node name="sprite" type="Sprite" parent="platform1"] -texture = ExtResource( 6 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="platform1"] -shape = SubResource( 13 ) - diff --git a/cpp/kinematic_character/icon.png b/cpp/kinematic_character/icon.png deleted file mode 100644 index bdca104..0000000 Binary files a/cpp/kinematic_character/icon.png and /dev/null differ diff --git a/cpp/kinematic_character/icon.png.import b/cpp/kinematic_character/icon.png.import deleted file mode 100644 index 45ee6af..0000000 --- a/cpp/kinematic_character/icon.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" - -[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/cpp/kinematic_character/long_obstacle.png b/cpp/kinematic_character/long_obstacle.png deleted file mode 100644 index 88cb22d..0000000 Binary files a/cpp/kinematic_character/long_obstacle.png and /dev/null differ diff --git a/cpp/kinematic_character/long_obstacle.png.import b/cpp/kinematic_character/long_obstacle.png.import deleted file mode 100644 index f136761..0000000 --- a/cpp/kinematic_character/long_obstacle.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/long_obstacle.png-1b33440a15b4db156b2a9ec7e9a2a80e.stex" - -[deps] - -source_file="res://long_obstacle.png" -dest_files=[ "res://.import/long_obstacle.png-1b33440a15b4db156b2a9ec7e9a2a80e.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/cpp/kinematic_character/obstacle.png b/cpp/kinematic_character/obstacle.png deleted file mode 100644 index 3ade3c3..0000000 Binary files a/cpp/kinematic_character/obstacle.png and /dev/null differ diff --git a/cpp/kinematic_character/obstacle.png.import b/cpp/kinematic_character/obstacle.png.import deleted file mode 100644 index 90cd6e5..0000000 --- a/cpp/kinematic_character/obstacle.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/obstacle.png-dfb3e99d3af573251007cdf5e1c252b9.stex" - -[deps] - -source_file="res://obstacle.png" -dest_files=[ "res://.import/obstacle.png-dfb3e99d3af573251007cdf5e1c252b9.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/cpp/kinematic_character/princess.png b/cpp/kinematic_character/princess.png deleted file mode 100644 index 9605c9c..0000000 Binary files a/cpp/kinematic_character/princess.png and /dev/null differ diff --git a/cpp/kinematic_character/princess.png.import b/cpp/kinematic_character/princess.png.import deleted file mode 100644 index 91a78e5..0000000 --- a/cpp/kinematic_character/princess.png.import +++ /dev/null @@ -1,31 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/princess.png-9b4caf2cfe324ae3734249d5b559d39d.stex" - -[deps] - -source_file="res://princess.png" -dest_files=[ "res://.import/princess.png-9b4caf2cfe324ae3734249d5b559d39d.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/cpp/kinematic_character/project.godot b/cpp/kinematic_character/project.godot deleted file mode 100644 index d37377b..0000000 --- a/cpp/kinematic_character/project.godot +++ /dev/null @@ -1,68 +0,0 @@ -; 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=4 - -_global_script_classes=[ ] -_global_script_class_icons={ - -} - -[application] - -config/name="Kinematic Character" -run/main_scene="res://colworld.tscn" -config/icon="res://icon.png" -name="Kinematic Character" -main_scene="res://colworld.tscn" -icon="res://icon.png" - -[display] - -window/size/width=530 -window/size/height=495 -stretch/aspect="keep" -stretch/mode="2d" -window/height=495 -window/width=530 - -[gdnative] - -singletons=[ ] - -[input] - -jump={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) - ] -} -move_bottom={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null) - ] -} -move_left={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null) - ] -} -move_right={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null) - ] -} -move_up={ -"deadzone": 0.5, -"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) - ] -} - -[memory] - -multithread/thread_rid_pool_prealloc=60 diff --git a/cpp/simple/README.md b/cpp/simple/README.md new file mode 100644 index 0000000..b73c85c --- /dev/null +++ b/cpp/simple/README.md @@ -0,0 +1,30 @@ +# Simple GDNative C++ demo + +This is a small example using C++ to create a GDNative script +that just showcases some very simple bare bones calls. + +Language: C++ + +Renderer: GLES 2 + +Dependencies: + * You need [godot-cpp](https://github.com/godotengine/godot-cpp), + this is now a Git submodule of this repo. + * `clang`, `gcc`, or any decent C++ compiler that's C++14 compatible. + +## Compiling + +You can use SCons to compile the library: + +``` +scons platform=PLATFORM +``` + +Where PLATFORM is: `windows`, `linux`, or `osx`. + +This creates the file `libsimple` in the respective +subfolders in the `project/gdnative` directory. + +## Screenshots + +![Screenshot](screenshots/screenshot.png) diff --git a/cpp/simple/project/default_env.tres b/cpp/simple/project/default_env.tres deleted file mode 100644 index 0f8c712..0000000 --- a/cpp/simple/project/default_env.tres +++ /dev/null @@ -1,18 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="ProceduralSky" id=1] -radiance_size = 4 -sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) -sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) -sky_curve = 0.25 -ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) -ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) -ground_curve = 0.01 -sun_energy = 16.0 - -[resource] -background_mode = 2 -background_sky = SubResource( 1 ) -fog_height_min = 0.0 -fog_height_max = 100.0 -ssao_quality = 0 diff --git a/cpp/simple/project/main.tscn b/cpp/simple/project/main.tscn index 82de7fe..81d370d 100644 --- a/cpp/simple/project/main.tscn +++ b/cpp/simple/project/main.tscn @@ -24,7 +24,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Sprite" type="Sprite" parent="."] +[node name="SimpleSprite" type="Sprite" parent="."] position = Vector2( 100, 100 ) texture = ExtResource( 2 ) script = ExtResource( 3 ) diff --git a/cpp/simple/project/project.godot b/cpp/simple/project/project.godot index 579d639..e602154 100644 --- a/cpp/simple/project/project.godot +++ b/cpp/simple/project/project.godot @@ -14,11 +14,14 @@ _global_script_class_icons={ [application] -config/name="New Game Project" +config/name="Simple GDNative C++ demo" run/main_scene="res://main.tscn" config/icon="res://icon.png" [rendering] -quality/driver/fallback_to_gles2=true -environment/default_environment="res://default_env.tres" +quality/driver/driver_name="GLES2" +quality/intended_usage/framebuffer_allocation=0 +quality/intended_usage/framebuffer_allocation.mobile=0 +vram_compression/import_etc=true +vram_compression/import_etc2=false diff --git a/cpp/simple/screenshots/screenshot.png b/cpp/simple/screenshots/screenshot.png new file mode 100644 index 0000000..f53101a Binary files /dev/null and b/cpp/simple/screenshots/screenshot.png differ diff --git a/cpp/simple/src/Simple.cpp b/cpp/simple/src/Simple.cpp index a10108c..b99adbf 100644 --- a/cpp/simple/src/Simple.cpp +++ b/cpp/simple/src/Simple.cpp @@ -19,16 +19,17 @@ void SimpleSprite::_register_methods() { } // `_init` doesn't need to be registered in `_register_methods`. +// `_init` is always required, if you exclude it then Godot will crash. void SimpleSprite::_init() { godot::Godot::print("A SimpleSprite was initialized in GDNative!"); } -void SimpleSprite::_process(double delta) { +void SimpleSprite::_process(double p_delta) { godot::Input *input = godot::Input::get_singleton(); godot::Vector2 input_dir(0, 0); input_dir.x = input->get_action_strength("ui_right") - input->get_action_strength("ui_left"); input_dir.y = input->get_action_strength("ui_down") - input->get_action_strength("ui_up"); - set_position(get_position() + input_dir.normalized() * delta * 300); + set_position(get_position() + input_dir.normalized() * p_delta * 300); } diff --git a/cpp/simple/src/Simple.hpp b/cpp/simple/src/Simple.hpp index 5b07c54..baf86b9 100644 --- a/cpp/simple/src/Simple.hpp +++ b/cpp/simple/src/Simple.hpp @@ -1,3 +1,6 @@ +#ifndef SIMPLE_H +#define SIMPLE_H + #include #include @@ -24,5 +27,7 @@ public: void _init(); - void _process(double delta); + void _process(double p_delta); }; + +#endif // SIMPLE_H