Creación del primer test
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
parent
cfd3252e90
commit
27b1f755f0
48
gdextension/src/register_types.cpp
Normal file
48
gdextension/src/register_types.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* godot-cpp integration testing project.
|
||||||
|
*
|
||||||
|
* This is free and unencumbered software released into the public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "register_types.h"
|
||||||
|
|
||||||
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
#include <godot_cpp/core/defs.hpp>
|
||||||
|
#include <godot_cpp/godot.hpp>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void initialize_test_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassDB::register_class<Test>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitialize_test_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
// Initialization.
|
||||||
|
GDExtensionBool GDE_EXPORT
|
||||||
|
test_library_init(const GDExtensionInterface *p_interface,
|
||||||
|
GDExtensionClassLibraryPtr p_library,
|
||||||
|
GDExtensionInitialization *r_initialization) {
|
||||||
|
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library,
|
||||||
|
r_initialization);
|
||||||
|
|
||||||
|
init_obj.register_initializer(initialize_test_module);
|
||||||
|
init_obj.register_terminator(uninitialize_test_module);
|
||||||
|
init_obj.set_minimum_library_initialization_level(
|
||||||
|
MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||||
|
|
||||||
|
return init_obj.init();
|
||||||
|
}
|
||||||
|
}
|
16
gdextension/src/register_types.h
Normal file
16
gdextension/src/register_types.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/* godot-cpp integration testing project.
|
||||||
|
*
|
||||||
|
* This is free and unencumbered software released into the public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXAMPLE_REGISTER_TYPES_H
|
||||||
|
#define EXAMPLE_REGISTER_TYPES_H
|
||||||
|
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void initialize_test_module(ModuleInitializationLevel p_level);
|
||||||
|
void uninitialize_test_module(ModuleInitializationLevel p_level);
|
||||||
|
|
||||||
|
#endif // EXAMPLE_REGISTER_TYPES_H
|
@ -1 +1 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef TEST_H
|
||||||
|
#define TEST_H
|
||||||
|
|
||||||
|
#include <godot_cpp/classes/node3d.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
class Test : public Node3D {
|
||||||
|
GDCLASS(Test, Node3D);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user