Commit f5daf20b authored by Oscar Campos's avatar Oscar Campos Committed by Oscar Campos
Browse files

chore: add SimpleDemoManual example

parent ca47a26b
...@@ -23,16 +23,16 @@ func nativeScriptInit() { ...@@ -23,16 +23,16 @@ func nativeScriptInit() {
// Define an instance creation function. This will be called when Godot // Define an instance creation function. This will be called when Godot
// creates a new instance of our class. // creates a new instance of our class.
createFunc := gdnative.InstanceCreateFunc{ createFunc := gdnative.InstanceCreateFunc{
CreateFunc: simpleConstructor, // reference to the constructor function CreateFunc: simpleConstructor, // reference to the constructor function
MethodData: "SIMPLE", // name of the class the constructor is attached to MethodData: "SIMPLE", // name of the class the constructor is attached to
FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty) FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty)
} }
// Define an instance destroy function. This will be called when Godot // Define an instance destroy function. This will be called when Godot
// asks our library to destroy our class instance. // asks our library to destroy our class instance.
destroyFunc := gdnative.InstanceDestroyFunc{ destroyFunc := gdnative.InstanceDestroyFunc{
DestroyFunc: simpleDestructor, // reference to the destructor function DestroyFunc: simpleDestructor, // reference to the destructor function
MethodData: "SIMPLE", // name of the class the destructor is attached to MethodData: "SIMPLE", // name of the class the destructor is attached to
FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty) FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty)
} }
...@@ -54,8 +54,8 @@ func nativeScriptInit() { ...@@ -54,8 +54,8 @@ func nativeScriptInit() {
RPCType: gdnative.MethodRpcModeDisabled, RPCType: gdnative.MethodRpcModeDisabled,
}, },
&gdnative.InstanceMethod{ // method wrapper &gdnative.InstanceMethod{ // method wrapper
Method: simpleMethod, // the simpleMethod function reference that implements our logic Method: simpleMethod, // the simpleMethod function reference that implements our logic
MethodData: "get_data", // method name as will be used with in Godot MethodData: "SIMPLE", // method name as will be used with in Godot
FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty) FreeFunc: func(methodData string) {}, // function for freeing resources (usually empty)
}, },
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment