diff --git a/.gitignore b/.gitignore index db0c40a..6fa7625 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ mono_crash.*.json - # VSCode .vscode/* @@ -43,3 +42,13 @@ mono_crash.*.json # Fork Source/.sconsign.dblite .vs + + + + +# Compiled Object files + +*.slo +*.lo +*.o +*.obj \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 8c36aad..e4c2c66 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "Engine/gdnative_cpp"] path = Engine/gdnative_cpp url = https://github.com/godotengine/godot-cpp +[submodule "Engine/gd_nim"] + path = Engine/gd_nim + url = https://github.com/pragmagic/godot-nim diff --git a/Bootstrap.Windows.bat b/Bootstrap.Windows.bat new file mode 100644 index 0000000..706109e --- /dev/null +++ b/Bootstrap.Windows.bat @@ -0,0 +1,46 @@ +where "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" >nul 2>nul +if not ERRORLEVEL 0 ( + echo Visual Studio 2019 not found... Remove this error message if you do have it. + pause + exit +) + +where python >nul 2>nul +if not ERRORLEVEL 0 ( + echo Need python not found... Remove this error message if you have it. + pause + exit +) + +where scons >nul 2>nul +if not ERRORLEVEL 0 ( + python pip install scons +) + +git clone --recurse-submodules https:// + +cd LangStudies + +start build_engine.bat + +:tools_wait +timeout 1 +if not exist Engine\gd\bin\godot.windows.opt.tools.64.exe ( + goto :tools_wait +) +timeout 10 + +start Engine\gd\bin\godot.windows.opt.tools.64.exe -e App/project.godot +timeout 30 + +taskkill /f /im godot.windows.opt.tools.64.exe + +:opt_wait +timeout 1 +if not exist Engine\gd\bin\godot.windows.opt.64.exe ( + goto :opt_wait +) + +timeout 2 + +start /w build_project.bat diff --git a/Editor/SENative.gdextension b/Editor/SENative.gdextension new file mode 100644 index 0000000..b464d5d --- /dev/null +++ b/Editor/SENative.gdextension @@ -0,0 +1,12 @@ +[configuration] + +entry_symbol = "SENative_Init" + +[libraries] + +linux.64.debug = "bin/SENative.linux.debug.64.so" +linux.64.release = "bin/SENative.linux.release.64.so" +windows.64.debug = "bin/SENative.windows.debug.64.dll" +windows.64.release = "bin/SENative.windows.release.64.dll" +macos.debug = "bin/SENative.debug.framework" +macos.release = "bin/SENative.release.framework" \ No newline at end of file diff --git a/Editor/bin/libgdexample.windows.debug.64.dll b/Editor/bin/SENative.windows.debug.64.dll similarity index 82% rename from Editor/bin/libgdexample.windows.debug.64.dll rename to Editor/bin/SENative.windows.debug.64.dll index 4719347..d79d8fa 100644 Binary files a/Editor/bin/libgdexample.windows.debug.64.dll and b/Editor/bin/SENative.windows.debug.64.dll differ diff --git a/Editor/bin/SENative.windows.debug.64.exp b/Editor/bin/SENative.windows.debug.64.exp new file mode 100644 index 0000000..1726e22 Binary files /dev/null and b/Editor/bin/SENative.windows.debug.64.exp differ diff --git a/Editor/bin/SENative.windows.debug.64.lib b/Editor/bin/SENative.windows.debug.64.lib new file mode 100644 index 0000000..dcd2c6a Binary files /dev/null and b/Editor/bin/SENative.windows.debug.64.lib differ diff --git a/Editor/bin/libgdexample.windows.debug.64.exp b/Editor/bin/libgdexample.windows.debug.64.exp deleted file mode 100644 index 33847e5..0000000 Binary files a/Editor/bin/libgdexample.windows.debug.64.exp and /dev/null differ diff --git a/Editor/bin/libgdexample.windows.debug.64.lib b/Editor/bin/libgdexample.windows.debug.64.lib deleted file mode 100644 index a198591..0000000 Binary files a/Editor/bin/libgdexample.windows.debug.64.lib and /dev/null differ diff --git a/Editor/gdexample.gdextension b/Editor/gdexample.gdextension deleted file mode 100644 index 2ab4bbb..0000000 --- a/Editor/gdexample.gdextension +++ /dev/null @@ -1,12 +0,0 @@ -[configuration] - -entry_symbol = "example_library_init" - -[libraries] - -linux.64.debug = "bin/libgdexample.linux.debug.64.so" -linux.64.release = "bin/libgdexample.linux.release.64.so" -windows.64.debug = "bin/libgdexample.windows.debug.64.dll" -windows.64.release = "bin/libgdexample.windows.release.64.dll" -macos.debug = "bin/libgdexample.debug.framework" -macos.release = "bin/libgdexample.release.framework" \ No newline at end of file diff --git a/Editor/main.tscn b/Editor/main.tscn index 7e0a0a6..0a7a661 100644 --- a/Editor/main.tscn +++ b/Editor/main.tscn @@ -1,14 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://bqqewt05ne1ad"] +[gd_scene format=3 uid="uid://d3u3lj2du4mgd"] -[ext_resource type="Texture2D" uid="uid://cnv7sgufjc3fk" path="res://icon.png" id="1_tqon5"] - -[node name="main" type="Node"] - -[node name="GDExample" type="GDExample" parent="."] -position = Vector2(7.83596, 18.1283) -texture = ExtResource( "1_tqon5" ) - -[node name="Sprite2D" type="Sprite2D" parent="."] -modulate = Color(1, 0.309804, 0.580392, 1) -position = Vector2(214, 2) -texture = ExtResource( "1_tqon5" ) +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = -1024.0 +offset_bottom = -600.0 diff --git a/Editor/project.godot b/Editor/project.godot index a63a06a..1d98669 100644 --- a/Editor/project.godot +++ b/Editor/project.godot @@ -17,4 +17,4 @@ config/features=PackedStringArray("4.0", "Vulkan Clustered") [native_extensions] -paths=["res://../Source/gdexample.gdextension"] +paths=["res://SENative.gdextension"] diff --git a/Engine/gd_nim b/Engine/gd_nim new file mode 160000 index 0000000..107f30a --- /dev/null +++ b/Engine/gd_nim @@ -0,0 +1 @@ +Subproject commit 107f30ac38cf2bfb2557e47b64d3f58bd8ad9169 diff --git a/Source/Library.hpp b/Source/Library.hpp new file mode 100644 index 0000000..906e1c2 --- /dev/null +++ b/Source/Library.hpp @@ -0,0 +1,8 @@ +#pragma once + + +namespace SE { + + + +} \ No newline at end of file diff --git a/Source/SConstruct b/Source/SConstruct index bf6fcf1..40d91ae 100644 --- a/Source/SConstruct +++ b/Source/SConstruct @@ -21,14 +21,14 @@ sources = Glob("./*.cpp") if env["platform"] == "osx": library = env.SharedLibrary( - EditorDir + "/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format( + EditorDir + "/bin/SENative.{}.{}.framework/SENative.{}.{}".format( env["platform"], env["target"], env["platform"], env["target"] ), source=sources, ) else: library = env.SharedLibrary( - EditorDir + "/bin/libgdexample.{}.{}.{}{}".format( + EditorDir + "/bin/SENative.{}.{}.{}{}".format( env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"] ), source=sources, diff --git a/Source/gdexample.cpp b/Source/gdexample.cpp index bac8a2b..6540b0a 100644 --- a/Source/gdexample.cpp +++ b/Source/gdexample.cpp @@ -1,7 +1,7 @@ #include "gdexample.h" -namespace godot { +namespace SE { #pragma region GodotRT @@ -37,4 +37,4 @@ GDExample::~GDExample() {} -} // godot \ No newline at end of file +} // SE \ No newline at end of file diff --git a/Source/gdexample.h b/Source/gdexample.h index d9a2cbc..d314f64 100644 --- a/Source/gdexample.h +++ b/Source/gdexample.h @@ -3,7 +3,10 @@ #include <godot_cpp/godot.hpp> #include <godot_cpp/classes/sprite2d.hpp> -namespace godot { +namespace SE { + +using namespace godot; + class GDExample : public Sprite2D { @@ -26,4 +29,5 @@ public: ~GDExample(); }; -} \ No newline at end of file + +} // SE \ No newline at end of file diff --git a/Source/register_types.cpp b/Source/register_types.cpp index a3f7c75..5082f86 100644 --- a/Source/register_types.cpp +++ b/Source/register_types.cpp @@ -3,18 +3,20 @@ #include "gdexample.h" -namespace godot { - -void register_types(ModuleInitializationLevel p_level) +void register_types(godot::ModuleInitializationLevel p_level) { + using namespace godot; + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) return; - ClassDB::register_class<GDExample>(); + ClassDB::register_class<SE::GDExample>(); } -void unregister_types(ModuleInitializationLevel p_level) +void unregister_types(godot::ModuleInitializationLevel p_level) { + using namespace godot; + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) return; @@ -24,12 +26,14 @@ void unregister_types(ModuleInitializationLevel p_level) extern "C" { GDNativeBool GDN_EXPORT - example_library_init( + SENative_Init( GDNativeInterface const* p_interface, GDNativeExtensionClassLibraryPtr const p_library, GDNativeInitialization* r_initialization) { - godot::GDExtensionBinding::InitObject + using namespace godot; + + GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); init_obj.register_initializer(register_types); init_obj.register_terminator(unregister_types); @@ -39,5 +43,3 @@ extern "C" } } -} // godot - diff --git a/Source/register_types.h b/Source/register_types.h index 59644c9..847144a 100644 --- a/Source/register_types.h +++ b/Source/register_types.h @@ -1,4 +1,9 @@ #pragma once -void register_types(); -void unregister_types(); +namespace godot +{ + enum ModuleInitializationLevel : int; +} + +void register_types(godot::ModuleInitializationLevel p_level); +void unregister_types(godot::ModuleInitializationLevel p_level); diff --git a/build_engine.bat b/build_engine.bat new file mode 100644 index 0000000..05365e4 --- /dev/null +++ b/build_engine.bat @@ -0,0 +1,6 @@ +start /w build_engine.debug.bat +start /w build_engine.release_debug.bat +start /w build_engine.release.bat + +exit + diff --git a/build_engine.debug.bat b/build_engine.debug.bat new file mode 100644 index 0000000..2872469 --- /dev/null +++ b/build_engine.debug.bat @@ -0,0 +1,5 @@ +cd Engine\gd\ + +scons -j%NUMBER_OF_PROCESSORS% platform=windows + +exit \ No newline at end of file diff --git a/build_engine.release.bat b/build_engine.release.bat new file mode 100644 index 0000000..a31c2f9 --- /dev/null +++ b/build_engine.release.bat @@ -0,0 +1,5 @@ +cd Engine\gd\ + +scons -j%NUMBER_OF_PROCESSORS% platform=windows tools=no target=release bits=64 + +exit \ No newline at end of file diff --git a/build_engine.release_debug.bat b/build_engine.release_debug.bat new file mode 100644 index 0000000..2f07817 --- /dev/null +++ b/build_engine.release_debug.bat @@ -0,0 +1,5 @@ +cd Engine\gd\ + +scons -j%NUMBER_OF_PROCESSORS% platform=windows tools=yes target=release_debug bits=64 + +exit \ No newline at end of file diff --git a/build_project.bat b/build_project.bat new file mode 100644 index 0000000..6ca98c3 --- /dev/null +++ b/build_project.bat @@ -0,0 +1,15 @@ +set YYYY=%date:~10,4% +set MM=%date:~4,2% +set DD=%date:~7,2% +set HH=%time:~0,2% +if %HH% lss 10 (set CUR_HH=0%time:~1,1%) +set NN=%time:~3,2% +set SS=%time:~6,2% +set MS=%time:~9,2% +set SUBFILENAME=%YYYY%%MM%%DD%_%HH%%NN%%SS% + +cd Builds +mkdir %SUBFILENAME% + +cd ..\Engine\gd\bin +godot.windows.opt.64.exe --export "Windows Desktop" "..\Builds\%SUBFILENAME%\LangStudies.exe" --path "..\..\..\App" \ No newline at end of file diff --git a/editor.bat b/editor.bat index 31f91cd..61a3a4f 100644 --- a/editor.bat +++ b/editor.bat @@ -1,5 +1,3 @@ -cd Engine\gd\bin\ +start Engine\gd\bin\godot.windows.opt.tools.64.exe -e App/project.godot -start godot.windows.opt.tools.64.exe -exit \ No newline at end of file diff --git a/game.debug.bat b/game.debug.bat new file mode 100644 index 0000000..12d1817 --- /dev/null +++ b/game.debug.bat @@ -0,0 +1,3 @@ +start Engine\gd\bin\godot.windows.tools.64.exe --path App/ + + diff --git a/game.release.bat b/game.release.bat new file mode 100644 index 0000000..62ba422 --- /dev/null +++ b/game.release.bat @@ -0,0 +1,3 @@ +start Engine\gd\bin\godot.windows.opt.64.exe --path App/ + + diff --git a/game.release_debug.bat b/game.release_debug.bat new file mode 100644 index 0000000..aceb4cb --- /dev/null +++ b/game.release_debug.bat @@ -0,0 +1,3 @@ +start Engine\gd\bin\godot.windows.opt.tools.64.exe --path App/ + +