add code
parent
11c8276539
commit
0f08efac2d
@ -0,0 +1,13 @@
|
||||
# Binaries.
|
||||
bin/
|
||||
|
||||
# Objects.
|
||||
*.os
|
||||
|
||||
# SConstruct
|
||||
.sconf_temp
|
||||
.sconsign.dblite
|
||||
*.pyc
|
||||
|
||||
# MacOS
|
||||
.DS_Store/
|
||||
@ -0,0 +1,3 @@
|
||||
[submodule "godot-cpp"]
|
||||
path = godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp.git
|
||||
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
env = SConscript("godot-cpp/SConstruct")
|
||||
|
||||
env.Append(CPPPATH=["src/"])
|
||||
sources = Glob("src/*.cpp")
|
||||
|
||||
if env["platform"] == "osx":
|
||||
library = env.SharedLibrary(
|
||||
"bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
|
||||
env["platform"], env["target"], env["platform"], env["target"]
|
||||
),
|
||||
source=sources,
|
||||
)
|
||||
else:
|
||||
library = env.SharedLibrary(
|
||||
"bin/libgdexample.{}.{}.{}{}".format(
|
||||
env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"]
|
||||
),
|
||||
source=sources,
|
||||
)
|
||||
|
||||
Default(library)
|
||||
@ -0,0 +1 @@
|
||||
Subproject commit 8dbaf5a7ff0b75222948d9e53633f584499f12bf
|
||||
@ -0,0 +1,27 @@
|
||||
#include "example.hpp"
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
|
||||
#include <godot_cpp/classes/global_constants.hpp>
|
||||
#include <godot_cpp/classes/label.hpp>
|
||||
#include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
void Example::_bind_methods()
|
||||
{
|
||||
ClassDB::bind_method(D_METHOD("hello_extension"), &Example::hello_extension);
|
||||
}
|
||||
|
||||
Example::Example()
|
||||
{
|
||||
}
|
||||
|
||||
Example::~Example()
|
||||
{
|
||||
}
|
||||
|
||||
void Example::hello_extension()
|
||||
{
|
||||
UtilityFunctions::print("Hello GDExtension!");
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <godot_cpp/classes/node.hpp>
|
||||
#include <godot_cpp/classes/global_constants.hpp>
|
||||
#include <godot_cpp/classes/viewport.hpp>
|
||||
|
||||
#include <godot_cpp/core/binder_common.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
class Example : public Node
|
||||
{
|
||||
GDCLASS(Example, Node);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
Example();
|
||||
~Example();
|
||||
|
||||
void hello_extension();
|
||||
};
|
||||
@ -0,0 +1,29 @@
|
||||
#include "register_types.h"
|
||||
|
||||
#include <godot/gdnative_interface.h>
|
||||
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
#include "example.hpp"
|
||||
|
||||
using namespace godot;
|
||||
|
||||
void initialize_example_module(ModuleInitializationLevel p_level)
|
||||
{
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClassDB::register_class<Example>();
|
||||
}
|
||||
|
||||
void uninitialize_example_module(ModuleInitializationLevel p_level)
|
||||
{
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
#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);
|
||||
Loading…
Reference in New Issue