Scaffold GDExtension template
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
demo/bin
|
||||||
|
|
||||||
|
.idea
|
||||||
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[submodule "redot-cpp"]
|
||||||
|
path = redot-cpp
|
||||||
|
url = https://github.com/speratus/redot-cpp
|
||||||
|
branch = 26.1
|
||||||
43
SConstruct
Normal file
43
SConstruct
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
env = SConscript("godot-cpp/SConstruct")
|
||||||
|
|
||||||
|
# For reference:
|
||||||
|
# - CCFLAGS are compilation flags shared between C and C++
|
||||||
|
# - CFLAGS are for C-specific compilation flags
|
||||||
|
# - CXXFLAGS are for C++-specific compilation flags
|
||||||
|
# - CPPFLAGS are for pre-processor flags
|
||||||
|
# - CPPDEFINES are for pre-processor defines
|
||||||
|
# - LINKFLAGS are for linking flags
|
||||||
|
|
||||||
|
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||||
|
env.Append(CPPPATH=["src/"])
|
||||||
|
sources = Glob("src/*.cpp")
|
||||||
|
|
||||||
|
if env["platform"] == "macos":
|
||||||
|
library = env.SharedLibrary(
|
||||||
|
"demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
|
||||||
|
env["platform"], env["target"], env["platform"], env["target"]
|
||||||
|
),
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
elif env["platform"] == "ios":
|
||||||
|
if env["ios_simulator"]:
|
||||||
|
library = env.StaticLibrary(
|
||||||
|
"demo/bin/libgdexample.{}.{}.simulator.a".format(env["platform"], env["target"]),
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
library = env.StaticLibrary(
|
||||||
|
"demo/bin/libgdexample.{}.{}.a".format(env["platform"], env["target"]),
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
library = env.SharedLibrary(
|
||||||
|
"demo/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
|
||||||
|
source=sources,
|
||||||
|
)
|
||||||
|
|
||||||
|
Default(library)
|
||||||
4
demo/.editorconfig
Normal file
4
demo/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
2
demo/.gitattributes
vendored
Normal file
2
demo/.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
3
demo/.gitignore
vendored
Normal file
3
demo/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Redot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
||||||
1
demo/icon.svg
Normal file
1
demo/icon.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><linearGradient id="a" x1="30.182" x2="101.98" y1="23.927" y2="97.824" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ff1300"/><stop offset="1" stop-color="#ff6e01"/></linearGradient><rect width="124" height="124" x="2" y="2" fill="#382c2c" stroke="#1a1616" stroke-width="4" rx="14"/><path fill="url(#a)" d="m51.385 16.054-2.414 7.558-7.767 3.359-8.293-1.575L21.47 43.241l1.994 3.463 40.727 14.171 40.413-14.17 2.1-3.57-11.652-17.739-8.188 1.575-7.977-3.36-2.414-7.557zM25.04 63.919l2.624 10.812 18.474 8.397 17.845-6.613 18.054 6.718 18.58-8.502 2.518-10.707-1.68-11.966-37.263 12.806-37.683-12.806zm10.18-2.939 17.635 6.403-.42 1.89a9.564 9.564 0 0 1-17.95-6.613zm57.523 0 .84 1.68a9.564 9.564 0 0 1-17.95 6.612l-.42-1.889zM21.68 68.223l-4.41 4.407 6.613 23.618 21.308 8.712-1.154-18.369-20.154-9.342zm84.708 0-2.204 9.027-20.154 9.342-1.154 18.264 21.203-8.712 6.718-23.513zM64.086 80.294l-15.955 6.403.945 19.734 15.115 6.088 14.8-6.088 1.05-19.734z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
43
demo/icon.svg.import
Normal file
43
demo/icon.svg.import
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d11l530q5178u"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
19
demo/project.godot
Normal file
19
demo/project.godot
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="demo"
|
||||||
|
config/features=PackedStringArray("26.1", "Forward Plus", "Redot")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[dotnet]
|
||||||
|
|
||||||
|
project/assembly_name="demo"
|
||||||
1
redot-cpp
Submodule
1
redot-cpp
Submodule
Submodule redot-cpp added at f81d6cadd8
40
src/register_types.cpp
Normal file
40
src/register_types.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// Created by andrew on 3/13/26.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "register_types.h"
|
||||||
|
|
||||||
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void register_gdextension_types(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Implement type registration
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregister_gdextension_types(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Implement plugin unregistration
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
GDExtensionBool GDE_EXPORT init_gdextension(
|
||||||
|
GDExtensionInterfaceGetProcAddress p_get_proc_address,
|
||||||
|
const GDExtensionClassLibraryPtr p_library,
|
||||||
|
GDExtensionInitialization *r_initialization
|
||||||
|
) {
|
||||||
|
godot::GDExtensionBinding::InitObject init_object(p_get_proc_address, p_library, r_initialization);
|
||||||
|
|
||||||
|
init_object.register_initializer(register_gdextension_types);
|
||||||
|
init_object.register_terminator(unregister_gdextension_types);
|
||||||
|
init_object.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_LATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
13
src/register_types.h
Normal file
13
src/register_types.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by andrew on 3/13/26.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GDEXTENSION_TEMPLATE_REGISTER_TYPES_H
|
||||||
|
#define GDEXTENSION_TEMPLATE_REGISTER_TYPES_H
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void register_gdextension_types();
|
||||||
|
void unregister_gdextension_types();
|
||||||
|
|
||||||
|
#endif //GDEXTENSION_TEMPLATE_REGISTER_TYPES_H
|
||||||
Reference in New Issue
Block a user