diff --git a/.gitignore b/.gitignore index ea2a390..d796508 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,148 @@ -*.o +# Godot-specific ignores +.import/ +export.cfg +export_presets.cfg +.fscache +logs/ + +# Mono-specific ignores +.mono/ + +# System/tool-specific ignores +.directory +*.dblite +*~ +logs *.os +*.exp + +# Vim temp files +*.swo +*.swp + +# QT project files +*.config +*.creator +*.creator.* +*.files +*.includes + +# Eclipse CDT files +.cproject +.settings/ + +# Geany/geany-plugins files +*.geany +.geanyprj + +# User-specific files +*.suo +*.user +*.sln.docstates +*.sln +*.vcxproj* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.opendb +*.VC.VC.opendb +enc_temp_folder/ + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +#Kdevelop project files +*.kdev4 + +# CodeLite project files +*.project +*.workspace +.codelite/ + +# TFS 2012 Local Workspace +$tf/ + +# Microsoft Fakes +FakesAssemblies/ + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ +logo.h +*.autosave + +# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore +# Ignore tags created by etags, ctags, gtags (GNU global) and cscope +TAGS +!TAGS/ +tags +*.tags +!tags/ +gtags.files +GTAGS +GRTAGS +GPATH +cscope.files +cscope.out +cscope.in.out +cscope.po.out +godot.creator.* + +projects/ +platform/windows/godot_res.res + +# Visual Studio 2017 and Visual Studio Code workspace folder +/.vs +/.vscode + +# Scons progress indicator +.scons_node_count + +# GDNative ignores +cpp_bindings/ +godot_headers/ +godot-cpp/ + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries *.so *.dylib -.import -*.import -*.dblite *.dll -*.exp + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a *.lib -*.obj -logs + +# Executables +*.exe +*.out +*.app diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..d9cbcaa --- /dev/null +++ b/Readme.md @@ -0,0 +1,44 @@ +## C++ + +### Initial setup + +You need to clone the GDNative C++ bindings in the root of this project: + +``` +git clone --recursive https://github.com/GodotNativeTools/godot-cpp +``` + + +### 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. diff --git a/cpp/SimpleDemo/Makefile b/cpp/SimpleDemo/Makefile new file mode 100644 index 0000000..d4f144c --- /dev/null +++ b/cpp/SimpleDemo/Makefile @@ -0,0 +1,2 @@ +all: + scons cpp_bindings="../../godot-cpp/" headers="../../godot-cpp/godot_headers/" diff --git a/cpp/SimpleDemo/SConstruct b/cpp/SimpleDemo/SConstruct index 677e5d6..4aaa8e1 100644 --- a/cpp/SimpleDemo/SConstruct +++ b/cpp/SimpleDemo/SConstruct @@ -11,8 +11,8 @@ env = Environment() if platform == "windows": env = Environment(ENV = os.environ) -godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot_headers")) -godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "cpp_bindings")) +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") @@ -43,7 +43,11 @@ def add_sources(sources, dir): env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include', godot_bindings_path + '/include/gen/', godot_bindings_path + '/include/core/']) -env.Append(LIBS=['godot-cpp.linux.64']) +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 = [] diff --git a/cpp/SimpleDemo/default_env.tres b/cpp/SimpleDemo/default_env.tres index ad86b72..8edf1e3 100644 --- a/cpp/SimpleDemo/default_env.tres +++ b/cpp/SimpleDemo/default_env.tres @@ -65,6 +65,7 @@ ssao_radius2 = 0.0 ssao_intensity2 = 1.0 ssao_bias = 0.01 ssao_light_affect = 0.0 +ssao_ao_channel_affect = 0.0 ssao_color = Color( 0, 0, 0, 1 ) ssao_quality = 0 ssao_blur = 3 diff --git a/cpp/SimpleDemo/icon.png.import b/cpp/SimpleDemo/icon.png.import new file mode 100644 index 0000000..45ee6af --- /dev/null +++ b/cpp/SimpleDemo/icon.png.import @@ -0,0 +1,31 @@ +[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/SimpleDemo/main.tscn b/cpp/SimpleDemo/main.tscn index 6bfc815..4e2a607 100644 --- a/cpp/SimpleDemo/main.tscn +++ b/cpp/SimpleDemo/main.tscn @@ -10,12 +10,10 @@ resource_name = "SimpleSprite" class_name = "SimpleSprite" library = ExtResource( 3 ) -[node name="Node" type="Node" index="0"] - +[node name="Node" type="Node"] script = ExtResource( 1 ) -[node name="Button" type="Button" parent="." index="0"] - +[node name="Button" type="Button" parent="."] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 @@ -25,6 +23,7 @@ margin_top = 208.0 margin_right = 682.0 margin_bottom = 325.0 rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 @@ -38,8 +37,7 @@ text = "Press me" flat = false align = 1 -[node name="Label" type="Label" parent="." index="1"] - +[node name="Label" type="Label" parent="."] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 @@ -49,6 +47,7 @@ margin_top = 360.0 margin_right = 662.0 margin_bottom = 374.0 rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 @@ -58,11 +57,8 @@ percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -[node name="Sprite" type="Sprite" parent="." index="2"] - +[node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 2 ) script = SubResource( 1 ) [connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] - - diff --git a/cpp/SimpleDemo/project.godot b/cpp/SimpleDemo/project.godot index 5ecfcee..6701a8c 100644 --- a/cpp/SimpleDemo/project.godot +++ b/cpp/SimpleDemo/project.godot @@ -6,7 +6,12 @@ ; [section] ; section goes between [] ; param=value ; assign values to parameters -config_version=3 +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} [application] diff --git a/cpp/cpp_constructors/Main.gd b/cpp/cpp_constructors/Main.gd index d49326b..c6fd2cd 100644 --- a/cpp/cpp_constructors/Main.gd +++ b/cpp/cpp_constructors/Main.gd @@ -1,8 +1,7 @@ extends Control -onready var TestClass = preload("res://TestClass.gdn") +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 index 999cc5c..c1fd8c8 100644 --- a/cpp/cpp_constructors/Main.tscn +++ b/cpp/cpp_constructors/Main.tscn @@ -3,11 +3,7 @@ [ext_resource path="res://Main.gd" type="Script" id=1] [node name="Main" type="Control"] - margin_right = 40.0 margin_bottom = 40.0 -rect_clip_content = false -mouse_filter = 0 script = ExtResource( 1 ) - diff --git a/cpp/cpp_constructors/Makefile b/cpp/cpp_constructors/Makefile new file mode 100644 index 0000000..d4f144c --- /dev/null +++ b/cpp/cpp_constructors/Makefile @@ -0,0 +1,2 @@ +all: + scons cpp_bindings="../../godot-cpp/" headers="../../godot-cpp/godot_headers/" diff --git a/cpp/cpp_constructors/SConstruct b/cpp/cpp_constructors/SConstruct new file mode 100644 index 0000000..274bbdf --- /dev/null +++ b/cpp/cpp_constructors/SConstruct @@ -0,0 +1,57 @@ +#!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/TestClass.gdn b/cpp/cpp_constructors/TestClass.gdn deleted file mode 100644 index 04e629a..0000000 --- a/cpp/cpp_constructors/TestClass.gdn +++ /dev/null @@ -1,21 +0,0 @@ -[gd_resource type="GDNativeScript" load_steps=2 format=2] - -[sub_resource type="GDNativeLibrary" id=1] - -platform/unix = "" -platform/x11 = "res://lib/libtest.so" -platform/server = "" -platform/android = "" -platform/haiku = "" -platform/mac = "" -platform/ios = "" -platform/osx = "" -platform/html5 = "" -platform/windows = "" -platform/uwp = "" - -[resource] - -library = SubResource( 1 ) -script_name = "TestClass" - diff --git a/cpp/cpp_constructors/bin/constructor.gdnlib b/cpp/cpp_constructors/bin/constructor.gdnlib new file mode 100644 index 0000000..f06d909 --- /dev/null +++ b/cpp/cpp_constructors/bin/constructor.gdnlib @@ -0,0 +1,16 @@ +[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 new file mode 100644 index 0000000..453c531 --- /dev/null +++ b/cpp/cpp_constructors/bin/testclass.gdns @@ -0,0 +1,9 @@ +[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/icon.png.import b/cpp/cpp_constructors/icon.png.import new file mode 100644 index 0000000..45ee6af --- /dev/null +++ b/cpp/cpp_constructors/icon.png.import @@ -0,0 +1,31 @@ +[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 index a5d7cda..3fcac90 100644 --- a/cpp/cpp_constructors/project.godot +++ b/cpp/cpp_constructors/project.godot @@ -1,16 +1,23 @@ ; Engine configuration file. ; It's best edited using the editor UI and not directly, ; since the parameters that go here are not all obvious. -; -; Format: +; +; 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/SConstruct b/cpp/cpp_constructors/src/SConstruct deleted file mode 100644 index dc53e02..0000000 --- a/cpp/cpp_constructors/src/SConstruct +++ /dev/null @@ -1,36 +0,0 @@ -#!python -import os - -env = Environment() - -if ARGUMENTS.get("use_llvm", "no") == "yes": - env["CXX"] = "clang++" - - -platform = ARGUMENTS.get("p", "linux") - - -def add_sources(sources, dir): - for f in os.listdir(dir): - if f.endswith(".cpp"): - sources.append(dir + "/" + f) - -if platform == "linux": - env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-Wno-writable-strings']) - env.Append(LINKFLAGS = ['-Wl,-R,\'$$ORIGIN\'']) - -env.Append(CPPPATH=['/usr/include/godot/', '/usr/include/godot/godot_cpp/', '/usr/include/godot/godot_cpp/core']) - -env.Append(LIBS=['godot_cpp_core', 'godot_cpp_bindings']) -env.Append(LIBPATH=["../lib"]) - -if platform == "windows": - env.Append(LIBS=['godot.windows.tools.64']) - -sources = ["init.cpp"] - - - -library = env.SharedLibrary(target='../lib/test', source=sources) -Default(library) - diff --git a/cpp/cpp_constructors/src/TestClass.hpp b/cpp/cpp_constructors/src/TestClass.hpp new file mode 100644 index 0000000..f717055 --- /dev/null +++ b/cpp/cpp_constructors/src/TestClass.hpp @@ -0,0 +1,52 @@ +#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 index 6aa4d55..3c0c622 100644 --- a/cpp/cpp_constructors/src/init.cpp +++ b/cpp/cpp_constructors/src/init.cpp @@ -1,60 +1,20 @@ #include -#include -#include -#include +#include "TestClass.hpp" -#include - - -#include - -using namespace godot; - -class TestClass : public GodotScript { - GODOT_CLASS(TestClass) - - int count; - -public: - - int test_method(const String s) - { - Godot::print(s); - count++; - - Timer *t = new Timer; - - t->set_wait_time(13.36 * count); - - // sorry, no String::num() yet - char str[128]; - snprintf(str, 128, "wait time: %f", t->get_wait_time()); - - Godot::print(String(str)); - - delete t; - - // test Ref - Ref file = new File; - - 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); - } -}; - -GODOT_NATIVE_INIT(godot_native_init_options *options) +extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) { - register_class(); + 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 new file mode 100644 index 0000000..e69de29 diff --git a/cpp/kinematic_character/Player Red/playerRed_fall.png.import b/cpp/kinematic_character/Player Red/playerRed_fall.png.import new file mode 100644 index 0000000..212c407 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_fall.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_stand.png.import new file mode 100644 index 0000000..1de5ed0 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_stand.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_up1.png.import new file mode 100644 index 0000000..3c95f67 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_up1.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_up2.png.import new file mode 100644 index 0000000..0110ee0 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_up2.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_up3.png.import new file mode 100644 index 0000000..725d1b8 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_up3.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_walk1.png.import new file mode 100644 index 0000000..a93aec8 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_walk1.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_walk2.png.import new file mode 100644 index 0000000..50273c4 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_walk2.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_walk3.png.import new file mode 100644 index 0000000..7af09cc --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_walk3.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_walk4.png.import new file mode 100644 index 0000000..44a0d8a --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_walk4.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/Player Red/playerRed_walk5.png.import new file mode 100644 index 0000000..91ab745 --- /dev/null +++ b/cpp/kinematic_character/Player Red/playerRed_walk5.png.import @@ -0,0 +1,31 @@ +[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/Script/.sconsign.dblite b/cpp/kinematic_character/Script/.sconsign.dblite index a5f5ad6..657328f 100644 Binary files a/cpp/kinematic_character/Script/.sconsign.dblite and b/cpp/kinematic_character/Script/.sconsign.dblite differ diff --git a/cpp/kinematic_character/Script/Makefile b/cpp/kinematic_character/Script/Makefile index ca67c32..1c0ddb9 100644 --- a/cpp/kinematic_character/Script/Makefile +++ b/cpp/kinematic_character/Script/Makefile @@ -1,3 +1,2 @@ - all: - scons cpp_bindings=../../../../godot-cpp/ headers=../../../../godot_headers/ + scons cpp_bindings="../../../godot-cpp/" headers="../../../godot-cpp/godot_headers/" diff --git a/cpp/kinematic_character/Script/SConstruct b/cpp/kinematic_character/Script/SConstruct index 2aa7749..ea0e06f 100644 --- a/cpp/kinematic_character/Script/SConstruct +++ b/cpp/kinematic_character/Script/SConstruct @@ -11,8 +11,8 @@ env = Environment() if platform == "windows": env = Environment(ENV = os.environ) -godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "godot_headers")) -godot_bindings_path = ARGUMENTS.get("cpp_bindings", os.getenv("CPP_BINDINGS", "cpp_bindings")) +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") @@ -41,9 +41,12 @@ def add_sources(sources, dir): if f.endswith(".cpp"): sources.append(dir + "/" + f) -env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include/', godot_bindings_path + '/include/core/', 'src' ]) +env.Append(CPPPATH=[godot_headers_path, godot_bindings_path + '/include/gen/', godot_bindings_path + '/include/core/', godot_bindings_path + '/include/']) -env.Append(LIBS=['godot_cpp_bindings']) +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 = [] diff --git a/cpp/kinematic_character/Script/src/colworld.cpp b/cpp/kinematic_character/Script/src/colworld.cpp index b79addb..a36d375 100644 --- a/cpp/kinematic_character/Script/src/colworld.cpp +++ b/cpp/kinematic_character/Script/src/colworld.cpp @@ -14,7 +14,7 @@ * limitations under the License. **/ -#include +#include "colworld.h" #include using namespace godot; @@ -29,18 +29,18 @@ void ColWorld::_init() { } void ColWorld::_ready() { - owner->get_node("princess")->connect("body_entered", owner, "_on_princess_body_enter"); + 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 *)owner->get_node("youwin"))->show(); + ((Label *)get_node("youwin"))->show(); } } void ColWorld::_register_methods() { - register_method((char *)"_init", &ColWorld::_init); - register_method((char *)"_ready", &ColWorld::_ready); + register_method("_init", &ColWorld::_init); + register_method("_ready", &ColWorld::_ready); - register_method((char *)"_on_princess_body_enter", &ColWorld::_on_princess_body_enter); + 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 index 88ecca1..fba6636 100644 --- a/cpp/kinematic_character/Script/src/colworld.h +++ b/cpp/kinematic_character/Script/src/colworld.h @@ -23,8 +23,8 @@ namespace godot { -class ColWorld : public GodotScript { - GODOT_CLASS(ColWorld) +class ColWorld : public Node2D { + GODOT_CLASS(ColWorld, Node2D) public: ColWorld(); diff --git a/cpp/kinematic_character/Script/src/common.cpp b/cpp/kinematic_character/Script/src/common.cpp index ace9d97..6db039a 100644 --- a/cpp/kinematic_character/Script/src/common.cpp +++ b/cpp/kinematic_character/Script/src/common.cpp @@ -16,8 +16,8 @@ #include -#include -#include +#include "colworld.h" +#include "player.h" using namespace godot; diff --git a/cpp/kinematic_character/Script/src/player.cpp b/cpp/kinematic_character/Script/src/player.cpp index e13df32..69e599e 100644 --- a/cpp/kinematic_character/Script/src/player.cpp +++ b/cpp/kinematic_character/Script/src/player.cpp @@ -14,13 +14,13 @@ * limitations under the License. **/ -#include +#include "player.h" +#include "colworld.h" #include #include #include -#include #include using namespace godot; @@ -58,13 +58,13 @@ void GDPlayer::_init() { } void GDPlayer::_ready() { - ray0 = ((RayCast2D *)owner->get_node("Ray0")); - ray1 = ((RayCast2D *)owner->get_node("Ray1")); + ray0 = ((RayCast2D *)get_node("Ray0")); + ray1 = ((RayCast2D *)get_node("Ray1")); - ray0->add_exception(owner); - ray1->add_exception(owner); + ray0->add_exception(this); + ray1->add_exception(this); - owner->connect("move", owner, "_move"); + connect("move", this, "_move"); } void GDPlayer::moving() { @@ -74,9 +74,9 @@ void GDPlayer::moving() { void GDPlayer::_physics_process(const float delta) { Vector2 _force = Vector2(0, _gravity); - bool left = Input::is_action_pressed("ui_left"); - bool right = Input::is_action_pressed("ui_right"); - bool jump = Input::is_action_pressed("ui_up"); + 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; @@ -108,18 +108,18 @@ void GDPlayer::_physics_process(const float delta) { // Integrate forces to velocity _velocity += _force * delta; // Integrate velocity into motion and move - _velocity = owner->move_and_slide(_velocity, Vector2(0, -1)); + _velocity = move_and_slide(_velocity, Vector2(0, -1)); bool floor_colliding = (ray0->is_colliding() || ray1->is_colliding()); - if (owner->is_on_floor() || floor_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; - owner->emit_signal("move"); + emit_signal("move"); } _on_air_time += delta; @@ -134,14 +134,14 @@ void GDPlayer::_physics_process(const float delta) { bool animating = false; if (left) { - ((AnimatedSprite *)owner->get_node("AnimatedSprite"))->set_flip_h(true); + ((AnimatedSprite *)get_node("AnimatedSprite"))->set_flip_h(true); if (floor_colliding) { _current_anim = "Run"; } animating = true; } if (right) { - ((AnimatedSprite *)owner->get_node("AnimatedSprite"))->set_flip_h(false); + ((AnimatedSprite *)get_node("AnimatedSprite"))->set_flip_h(false); if (floor_colliding) { _current_anim = "Run"; } @@ -159,7 +159,7 @@ void GDPlayer::_physics_process(const float delta) { _current_anim = "Default"; } - ((AnimatedSprite *)owner->get_node("AnimatedSprite"))->play(_current_anim); + ((AnimatedSprite *)get_node("AnimatedSprite"))->play(_current_anim); } void GDPlayer::_register_methods() { diff --git a/cpp/kinematic_character/Script/src/player.h b/cpp/kinematic_character/Script/src/player.h index 89b5f10..fd26fd1 100644 --- a/cpp/kinematic_character/Script/src/player.h +++ b/cpp/kinematic_character/Script/src/player.h @@ -25,8 +25,8 @@ using namespace godot; -class GDPlayer : public GodotScript { - GODOT_CLASS(GDPlayer) +class GDPlayer : public KinematicBody2D { + GODOT_CLASS(GDPlayer, KinematicBody2D) public: GDPlayer(); diff --git a/cpp/kinematic_character/circle.png.import b/cpp/kinematic_character/circle.png.import new file mode 100644 index 0000000..65dc5fc --- /dev/null +++ b/cpp/kinematic_character/circle.png.import @@ -0,0 +1,31 @@ +[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 index d3daba9..68162e4 100644 --- a/cpp/kinematic_character/colworld.tscn +++ b/cpp/kinematic_character/colworld.tscn @@ -25,7 +25,7 @@ extents = Vector2( 8, 8 ) 0/tex_offset = Vector2( 0, 0 ) 0/modulate = Color( 1, 1, 1, 1 ) 0/region = Rect2( 0, 0, 0, 0 ) -0/is_autotile = false +0/tile_mode = 0 0/occluder_offset = Vector2( 0, 0 ) 0/navigation_offset = Vector2( 0, 0 ) 0/shapes = [ { @@ -34,6 +34,7 @@ extents = Vector2( 8, 8 ) "shape": SubResource( 2 ), "shape_transform": Transform2D( 1, 0, 0, 1, 8, 8 ) } ] +0/z_index = 0 [sub_resource type="RectangleShape2D" id=4] @@ -137,13 +138,11 @@ extents = Vector2( 8, 8 ) custom_solver_bias = 0.0 extents = Vector2( 32, 8 ) -[node name="colworld" type="Node2D" index="0"] - +[node name="colworld" type="Node2D"] editor/display_folded = true script = SubResource( 1 ) -[node name="TileMap" type="TileMap" parent="." index="0"] - +[node name="TileMap" type="TileMap" parent="."] mode = 0 tile_set = SubResource( 3 ) cell_size = Vector2( 16, 16 ) @@ -162,8 +161,7 @@ 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="." index="1"] - +[node name="princess" type="Area2D" parent="."] editor/display_folded = true position = Vector2( 97, 72 ) input_pickable = true @@ -174,77 +172,66 @@ angular_damp = 1.0 audio_bus_override = false audio_bus_name = "Master" -[node name="collision" type="CollisionShape2D" parent="princess" index="0"] - +[node name="collision" type="CollisionShape2D" parent="princess"] shape = SubResource( 4 ) -[node name="Sprite" type="Sprite" parent="princess" index="1"] - +[node name="Sprite" type="Sprite" parent="princess"] texture = ExtResource( 3 ) -[node name="Character" parent="." index="2" instance=ExtResource( 4 )] - +[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="." index="3"] - +[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" index="0"] - +[node name="collision" type="CollisionShape2D" parent="moving_platform1"] shape = SubResource( 5 ) -[node name="sprite" type="Sprite" parent="moving_platform1" index="1"] - +[node name="sprite" type="Sprite" parent="moving_platform1"] texture = ExtResource( 2 ) -[node name="anim" type="AnimationPlayer" parent="moving_platform1" index="2"] - +[node name="anim" type="AnimationPlayer" parent="moving_platform1"] +root_node = NodePath("..") +autoplay = "leftright" playback_process_mode = 0 playback_default_blend_time = 0.0 -root_node = NodePath("..") +playback_speed = 1.0 anims/leftright = SubResource( 6 ) -playback/active = true -playback/speed = 1.0 blend_times = [ ] -autoplay = "leftright" - -[node name="moving_platform2" type="KinematicBody2D" parent="." index="4"] +[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" index="0"] - +[node name="collision" type="CollisionShape2D" parent="moving_platform2"] shape = SubResource( 5 ) -[node name="sprite" type="Sprite" parent="moving_platform2" index="1"] - +[node name="sprite" type="Sprite" parent="moving_platform2"] texture = ExtResource( 2 ) -[node name="anim" type="AnimationPlayer" parent="moving_platform2" index="2"] - +[node name="anim" type="AnimationPlayer" parent="moving_platform2"] +root_node = NodePath("..") +autoplay = "updown" playback_process_mode = 0 playback_default_blend_time = 0.0 -root_node = NodePath("..") +playback_speed = 1.0 anims/leftright = SubResource( 7 ) anims/updown = SubResource( 8 ) -playback/active = true -playback/speed = 1.0 blend_times = [ ] -autoplay = "updown" - -[node name="youwin" type="Label" parent="." index="5"] +[node name="youwin" type="Label" parent="."] visible = false anchor_left = 0.0 anchor_top = 0.0 @@ -255,7 +242,9 @@ 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 @@ -265,122 +254,107 @@ percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -[node name="oneway1" type="KinematicBody2D" parent="." index="6"] - +[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" index="0"] - +[node name="sprite" type="Sprite" parent="oneway1"] scale = Vector2( 1, 0.3 ) texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway1" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway1"] shape = SubResource( 9 ) one_way_collision = true -[node name="oneway2" type="KinematicBody2D" parent="." index="7"] - +[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" index="0"] - +[node name="sprite" type="Sprite" parent="oneway2"] scale = Vector2( 1, 0.3 ) texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway2" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway2"] shape = SubResource( 9 ) one_way_collision = true -[node name="oneway3" type="KinematicBody2D" parent="." index="8"] - +[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" index="0"] - +[node name="sprite" type="Sprite" parent="oneway3"] scale = Vector2( 1, 0.3 ) texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway3" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway3"] shape = SubResource( 9 ) one_way_collision = true -[node name="oneway4" type="KinematicBody2D" parent="." index="9"] - +[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" index="0"] - +[node name="sprite" type="Sprite" parent="oneway4"] scale = Vector2( 1, 0.3 ) texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway4" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="oneway4"] shape = SubResource( 9 ) one_way_collision = true -[node name="circle" type="KinematicBody2D" parent="." index="10"] - +[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" index="0"] - +[node name="sprite" type="Sprite" parent="circle"] texture = ExtResource( 5 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="circle" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="circle"] shape = SubResource( 10 ) -[node name="anim" type="AnimationPlayer" parent="circle" index="2"] - +[node name="anim" type="AnimationPlayer" parent="circle"] +root_node = NodePath("..") +autoplay = "turn" playback_process_mode = 1 playback_default_blend_time = 0.0 -root_node = NodePath("..") +playback_speed = 1.0 anims/turn = SubResource( 11 ) -playback/active = true -playback/speed = 1.0 blend_times = [ ] -autoplay = "turn" - -[node name="box" type="CollisionShape2D" parent="circle" index="3"] +[node name="box" type="CollisionShape2D" parent="circle"] position = Vector2( -0.440125, -37.0904 ) shape = SubResource( 12 ) -[node name="boxsprite" type="Sprite" parent="circle" index="4"] - +[node name="boxsprite" type="Sprite" parent="circle"] position = Vector2( 0, -37.4108 ) texture = ExtResource( 2 ) -[node name="platform" type="StaticBody2D" parent="." index="11"] - +[node name="platform" type="StaticBody2D" parent="."] editor/display_folded = true position = Vector2( 251.44, 396.557 ) rotation = -0.428054 @@ -389,19 +363,14 @@ collision_layer = 1 collision_mask = 1 constant_linear_velocity = Vector2( 0, 0 ) constant_angular_velocity = 0.0 -friction = 1.0 -bounce = 0.0 - -[node name="sprite" type="Sprite" parent="platform" index="0"] +[node name="sprite" type="Sprite" parent="platform"] texture = ExtResource( 6 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="platform" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform"] shape = SubResource( 13 ) -[node name="platform1" type="StaticBody2D" parent="." index="12"] - +[node name="platform1" type="StaticBody2D" parent="."] editor/display_folded = true position = Vector2( 369.116, 394.016 ) rotation = 0.465931 @@ -410,15 +379,10 @@ collision_layer = 1 collision_mask = 1 constant_linear_velocity = Vector2( 0, 0 ) constant_angular_velocity = 0.0 -friction = 1.0 -bounce = 0.0 - -[node name="sprite" type="Sprite" parent="platform1" index="0"] +[node name="sprite" type="Sprite" parent="platform1"] texture = ExtResource( 6 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="platform1" index="1"] - +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform1"] shape = SubResource( 13 ) - diff --git a/cpp/kinematic_character/icon.png.import b/cpp/kinematic_character/icon.png.import new file mode 100644 index 0000000..45ee6af --- /dev/null +++ b/cpp/kinematic_character/icon.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/long_obstacle.png.import new file mode 100644 index 0000000..f136761 --- /dev/null +++ b/cpp/kinematic_character/long_obstacle.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/obstacle.png.import new file mode 100644 index 0000000..90cd6e5 --- /dev/null +++ b/cpp/kinematic_character/obstacle.png.import @@ -0,0 +1,31 @@ +[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.import b/cpp/kinematic_character/princess.png.import new file mode 100644 index 0000000..91a78e5 --- /dev/null +++ b/cpp/kinematic_character/princess.png.import @@ -0,0 +1,31 @@ +[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 index ae47600..d37377b 100644 --- a/cpp/kinematic_character/project.godot +++ b/cpp/kinematic_character/project.godot @@ -6,7 +6,12 @@ ; [section] ; section goes between [] ; param=value ; assign values to parameters -config_version=3 +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} [application] @@ -32,16 +37,31 @@ singletons=[ ] [input] -jump=[ 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) +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=[ 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_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=[ 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_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=[ 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_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=[ 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) +} +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]