init
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
[configuration]
|
||||||
|
|
||||||
|
entry_symbol = "example_library_init"
|
||||||
|
compatibility_minimum = "4.5"
|
||||||
|
reloadable = true
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
|
||||||
|
macos.debug = "./libgdexample.macos.template_debug.dylib"
|
||||||
|
macos.release = "./libgdexample.macos.template_release.dylib"
|
||||||
|
windows.debug.x86_32 = "./gdexample.windows.template_debug.x86_32.dll"
|
||||||
|
windows.release.x86_32 = "./gdexample.windows.template_release.x86_32.dll"
|
||||||
|
windows.debug.x86_64 = "./gdexample.windows.template_debug.x86_64.dll"
|
||||||
|
windows.release.x86_64 = "./gdexample.windows.template_release.x86_64.dll"
|
||||||
|
linux.debug.x86_64 = "./libgdexample.linux.template_debug.x86_64.so"
|
||||||
|
linux.release.x86_64 = "./libgdexample.linux.template_release.x86_64.so"
|
||||||
|
linux.debug.arm64 = "./libgdexample.linux.template_debug.arm64.so"
|
||||||
|
linux.release.arm64 = "./libgdexample.linux.template_release.arm64.so"
|
||||||
|
linux.debug.rv64 = "./libgdexample.linux.template_debug.rv64.so"
|
||||||
|
linux.release.rv64 = "./libgdexample.linux.template_release.rv64.so"
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
#include "gdexample.h"
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void GDExample::_bind_methods() {
|
||||||
|
}
|
||||||
|
|
||||||
|
GDExample::GDExample() {
|
||||||
|
// Initialize any variables here.
|
||||||
|
time_passed = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GDExample::~GDExample() {
|
||||||
|
// Add your cleanup here.
|
||||||
|
}
|
||||||
|
|
||||||
|
void GDExample::_process(double delta) {
|
||||||
|
time_passed += delta;
|
||||||
|
|
||||||
|
Vector2 new_position = Vector2(10.0 + (10.0 * sin(time_passed * 2.0)), 10.0 + (10.0 * cos(time_passed * 1.5)));
|
||||||
|
|
||||||
|
set_position(new_position);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <godot_cpp/classes/sprite2d.hpp>
|
||||||
|
|
||||||
|
namespace godot {
|
||||||
|
|
||||||
|
class GDExample : public Sprite2D {
|
||||||
|
GDCLASS(GDExample, Sprite2D)
|
||||||
|
|
||||||
|
private:
|
||||||
|
double time_passed;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
public:
|
||||||
|
GDExample();
|
||||||
|
~GDExample();
|
||||||
|
|
||||||
|
void _process(double delta) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace godot
|
||||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
|||||||
|
#include "register_types.h"
|
||||||
|
|
||||||
|
#include "gdexample.h"
|
||||||
|
|
||||||
|
#include <gdextension_interface.h>
|
||||||
|
#include <godot_cpp/core/defs.hpp>
|
||||||
|
#include <godot_cpp/godot.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void initialize_example_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GDREGISTER_RUNTIME_CLASS(GDExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitialize_example_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
// Initialization.
|
||||||
|
GDExtensionBool GDE_EXPORT example_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||||
|
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||||
|
|
||||||
|
init_obj.register_initializer(initialize_example_module);
|
||||||
|
init_obj.register_terminator(uninitialize_example_module);
|
||||||
|
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||||
|
|
||||||
|
return init_obj.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void initialize_example_module(ModuleInitializationLevel p_level);
|
||||||
|
void uninitialize_example_module(ModuleInitializationLevel p_level);
|
||||||
Binary file not shown.
Reference in New Issue
Block a user