Compare commits
No commits in common. "a4d062ea043754d15655a10f7b9773cdb23962fc" and "cdcc23c50a9ae3604235cc773fc31d717d1b62c2" have entirely different histories.
a4d062ea04
...
cdcc23c50a
|
|
@ -1,4 +0,0 @@
|
|||
[submodule "evolve-die-repeat/thirdparty/godot-cpp"]
|
||||
path = evolve-die-repeat/thirdparty/godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
branch = 4.5
|
||||
25
README.md
25
README.md
|
|
@ -1,25 +1,2 @@
|
|||
# Evolve Die Repeat TODO: The name is a work in progress
|
||||
|
||||
This is currently quite empty.
|
||||
|
||||
## C++ setup
|
||||
From anywhere in proejct:
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
In `thirdparty`:
|
||||
```bash
|
||||
godot --headless --dump-extension-api
|
||||
```
|
||||
|
||||
To compile the cpp extension, run this from `thirdparty/godot-cpp`:
|
||||
```bash
|
||||
scons platform=linux target=template_debug generate_bindings=yes custom_api_file=../extension_api.json -j8
|
||||
```
|
||||
|
||||
Finally, to compile and extern local `.cpp` files, run this from `thirdparty`:
|
||||
```bash
|
||||
scons platform=linux target=template_debug -j8
|
||||
```
|
||||
# notSpore
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
extends Label
|
||||
|
||||
var counter := Test.new() # C++ class
|
||||
|
||||
func _ready() -> void:
|
||||
text += str(counter.get_counter())
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
#if Input.is_action_just_pressed("ui_accept"):
|
||||
counter.increment()
|
||||
var baseText := text
|
||||
baseText = baseText.left(baseText.length() - str(counter.get_counter()).length())
|
||||
text = baseText + str(counter.get_counter())
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://ceut2lrvkns75
|
||||
|
|
@ -1,12 +1,8 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://b55w56d4twno1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ceut2lrvkns75" path="res://debug_label.gd" id="1_quyes"]
|
||||
[gd_scene format=3 uid="uid://b55w56d4twno1"]
|
||||
|
||||
[node name="MolecularStag" type="Node2D"]
|
||||
|
||||
[node name="DebugLabel" type="Label" parent="."]
|
||||
[node name="Label" type="Label" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "Debug: You made it into the game!
|
||||
This is running from C++: "
|
||||
script = ExtResource("1_quyes")
|
||||
text = "Debug: You made it into the game!"
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
bin
|
||||
*.uid
|
||||
*sconsign.dblite
|
||||
**.os
|
||||
|
||||
godot-cpp/bin/
|
||||
*.o
|
||||
*.so
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import os
|
||||
from SCons.Script import DefaultEnvironment, ARGUMENTS, Glob, Dir
|
||||
|
||||
env = DefaultEnvironment()
|
||||
platform = ARGUMENTS.get("platform", "linux")
|
||||
target = ARGUMENTS.get("target", "template_debug") # or template_release
|
||||
arch = ARGUMENTS.get("arch", "x86_64")
|
||||
|
||||
HERE = Dir(".").abspath
|
||||
GODOTCPP = os.path.join(HERE, "godot-cpp")
|
||||
|
||||
inc_paths = [
|
||||
os.path.join(GODOTCPP, "include"),
|
||||
os.path.join(GODOTCPP, "gen", "include"),
|
||||
]
|
||||
for extra in ("godot-headers", "gdextension"):
|
||||
p = os.path.join(GODOTCPP, extra)
|
||||
if os.path.isdir(p):
|
||||
inc_paths.append(p)
|
||||
|
||||
env.Append(CPPPATH=inc_paths)
|
||||
env.Append(LIBPATH=[os.path.join(GODOTCPP, "bin")])
|
||||
env.Append(CXXFLAGS=["-std=c++17", "-fPIC"])
|
||||
|
||||
env.Append(LIBS=[f"godot-cpp.{platform}.{target}.{arch}"])
|
||||
|
||||
outdir = os.path.join(HERE, "bin")
|
||||
os.makedirs(outdir, exist_ok=True)
|
||||
soname = f"gol.{platform}.{'debug' if target == 'template_debug' else 'release'}.{arch}"
|
||||
|
||||
env.SharedLibrary(target=os.path.join(outdir, soname), source=Glob("src/*.cpp"))
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
[configuration]
|
||||
entry_symbol = "gol_library_init"
|
||||
compatibility_minimum = "4.5" ; required in 4.5+
|
||||
reloadable = true
|
||||
|
||||
[libraries]
|
||||
linux.debug.x86_64 = "res://thirdparty/bin/libgol.linux.debug.x86_64"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +0,0 @@
|
|||
Subproject commit e83fd0904c13356ed1d4c3d09f8bb9132bdc6b77
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
|
||||
#include <gdextension_interface.h>
|
||||
#include <godot_cpp/classes/ref_counted.hpp>
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
class Test : public RefCounted {
|
||||
GDCLASS(Test, RefCounted);
|
||||
|
||||
int counter = 0;
|
||||
|
||||
static void _bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("increment"), &Test::increment);
|
||||
ClassDB::bind_method(D_METHOD("get_counter"), &Test::get_counter);
|
||||
ClassDB::bind_method(D_METHOD("set_counter", "value"), &Test::set_counter);
|
||||
ClassDB::add_property("Test", PropertyInfo(Variant::INT, "counter"),
|
||||
"set_counter", "get_counter");
|
||||
}
|
||||
|
||||
public:
|
||||
int increment() {
|
||||
counter += 1;
|
||||
return counter;
|
||||
}
|
||||
|
||||
int get_counter() const { return counter; }
|
||||
|
||||
void set_counter(int p_value) { counter = p_value; }
|
||||
};
|
||||
|
||||
extern "C" GDExtensionBool GDE_EXPORT
|
||||
gol_library_init(GDExtensionInterfaceGetProcAddress get_proc_address,
|
||||
GDExtensionClassLibraryPtr library,
|
||||
GDExtensionInitialization *r_initialization) {
|
||||
|
||||
static GDExtensionBinding::InitObject init(get_proc_address, library,
|
||||
r_initialization);
|
||||
|
||||
init.register_initializer([](ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
ClassDB::register_class<Test>();
|
||||
});
|
||||
|
||||
init.register_terminator([](ModuleInitializationLevel /*p_level*/) {
|
||||
// no-op
|
||||
});
|
||||
|
||||
init.set_minimum_library_initialization_level(
|
||||
MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||
return init.init();
|
||||
}
|
||||
Loading…
Reference in New Issue