-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2158378
commit abba1ac
Showing
12 changed files
with
147 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[gd_resource type="NativeScript" load_steps=2 format=2] | ||
|
||
[ext_resource path="res://addons/godot-wasm/godot-wasm.gdnlib" type="GDNativeLibrary" id=1] | ||
|
||
[resource] | ||
class_name = "Wasm" | ||
library = ExtResource( 1 ) | ||
script_class_name = "Wasm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[gd_resource type="NativeScript" load_steps=2 format=2] | ||
|
||
[ext_resource path="res://addons/godot-wasm/godot-wasm.gdnlib" type="GDNativeLibrary" id=1] | ||
|
||
[resource] | ||
class_name = "WasmMemory" | ||
library = ExtResource( 1 ) | ||
script_class_name = "WasmMemory" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[general] | ||
|
||
singleton=false | ||
load_once=true | ||
symbol_prefix="wasm_" | ||
reloadable=true | ||
|
||
[entry] | ||
|
||
OSX.64="res://addons/godot-wasm/bin/osx/libgodot-wasm.dylib" | ||
Windows.64="res://addons/godot-wasm/bin/windows/godot-wasm.dll" | ||
X11.64="res://addons/godot-wasm/bin/linux/libgodot-wasm.so" | ||
Server.64="res://addons/godot-wasm/bin/linux/libgodot-wasm.so" | ||
|
||
[dependencies] | ||
|
||
OSX.64=[ ] | ||
Windows.64=[ ] | ||
X11.64=[ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,15 @@ | ||
#ifdef GODOT_MODULE | ||
|
||
#include "register_types.h" | ||
#include "core/class_db.h" | ||
#include "src/godot-wasm.h" | ||
#include "src/wasm-memory.h" | ||
|
||
using namespace godot; | ||
|
||
void initialize_wasm_module(ModuleInitializationLevel p_level) { | ||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { | ||
return; | ||
} | ||
|
||
ClassDB::register_class<Wasm>(); | ||
ClassDB::register_class<WasmMemory>(); | ||
} | ||
|
||
void uninitialize_wasm_module(ModuleInitializationLevel p_level) { | ||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { | ||
return; | ||
} | ||
void register_wasm_types() { | ||
ClassDB::register_class<godot::Wasm>(); | ||
ClassDB::register_class<godot::WasmMemory>(); | ||
} | ||
|
||
#ifndef GODOT_MODULE | ||
|
||
extern "C" { | ||
GDExtensionBool GDE_EXPORT wasm_library_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { | ||
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); | ||
|
||
init_obj.register_initializer(initialize_wasm_module); | ||
init_obj.register_terminator(uninitialize_wasm_module); | ||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); | ||
|
||
return init_obj.init(); | ||
} | ||
} | ||
void unregister_wasm_types() { } | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,7 @@ | ||
#ifndef GODOT_WASM_REGISTER_TYPES_H | ||
#define GODOT_WASM_REGISTER_TYPES_H | ||
|
||
// This define is only needed because the GODOT_MODULE define isn't detected here | ||
// May be related to https://github.com/godotengine/godot/issues/75914 | ||
#ifdef GDEXTENSION | ||
#define NS godot | ||
#include <godot_cpp/core/class_db.hpp> | ||
#else | ||
#define NS | ||
#include "modules/register_module_types.h" | ||
#include "core/object/class_db.h" | ||
#endif | ||
|
||
void initialize_wasm_module(NS::ModuleInitializationLevel p_level); | ||
void uninitialize_wasm_module(NS::ModuleInitializationLevel p_level); | ||
void register_wasm_types(); | ||
void unregister_wasm_types(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef GODOT_MODULE | ||
|
||
#include "godot-wasm.h" | ||
#include "wasm-memory.h" | ||
|
||
extern "C" void GDN_EXPORT wasm_gdnative_init(godot_gdnative_init_options *o) { | ||
godot::Godot::gdnative_init(o); | ||
} | ||
|
||
extern "C" void GDN_EXPORT wasm_gdnative_terminate(godot_gdnative_terminate_options *o) { | ||
godot::Godot::gdnative_terminate(o); | ||
} | ||
|
||
extern "C" void GDN_EXPORT wasm_nativescript_init(void *handle) { | ||
godot::Godot::nativescript_init(handle); | ||
|
||
godot::register_class<godot::Wasm>(); | ||
godot::register_class<godot::WasmMemory>(); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters