diff --git a/.editorconfig b/.editorconfig index 78c3c87..3da2275 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ root = true [*] encoding = utf-8 -indent_style = tab +indent_style = space indent_size = 4 [*.md] diff --git a/blog/.gdignore b/blog/.gdignore deleted file mode 100644 index e69de29..0000000 diff --git a/blog/1-design-en.md b/blog/1-design-en.md deleted file mode 100644 index 96dd3c9..0000000 --- a/blog/1-design-en.md +++ /dev/null @@ -1,203 +0,0 @@ -# Designing a Godot PluginScript for Lua -2021-07-28 | `#Godot #Lua #GDNative #PluginScript #languageBindings` | [*Versão em Português*](1-design-pt.md) - -This is the first article in a series about how I'm approaching the development -of a plugin for using the [Lua](https://www.lua.org/) language in -[Godot game engine](https://godotengine.org/). - -Lua is a simple and small, yet powerful and flexible, scripting language. -Although it [isn't fit for every scenario](https://docs.godotengine.org/en/stable/about/faq.html#what-were-the-motivations-behind-creating-gdscript), -it is certainly a great tool for scripting. -Combining that with the power of [LuaJIT](https://luajit.org/), -one of the fastest dynamic language implementations out there, we can also -[call external C functions via the Foreign Function Interface (FFI)](https://luajit.org/ext_ffi.html)! - -With the dynamic nature of scripting in Godot, all supported languages -can seamlessly communicate with each other and thus we can choose to use the -language that best fits the task in hand for each script. -By the means of [signals](https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html) -and the methods [call](https://docs.godotengine.org/en/stable/classes/class_object.html#class-object-method-call), -[get](https://docs.godotengine.org/en/stable/classes/class_object.html#id1) -and [set](https://docs.godotengine.org/en/stable/classes/class_object.html#id4), -any object can communicate with another one, regardless of the -source language. - -To make Lua be recognized as one of the supported scripting languages for Godot -objects, we will create a PluginScript, which is one of the uses of -[GDNative](https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting.html#gdnative-c), -the native plugin C API provided by the engine to extend all sorts of -engine systems, such as the scripting one. -One pro of this approach is that only the plugin have to be compiled, -so anyone with a standard prebuilt version of Godot can use it! =D - - -## Goals -- Provide support for the Lua language in Godot in a way that does not require - compiling the engine from scratch -- Be able to seamlessly communicate with any other language supported by Godot, - like GDScript, Visual Script and C#, in an idiomatic way -- Simple script description interface that doesn't need `require`ing anything -- Support for Lua 5.1+ and LuaJIT -- Have a simple build process, where anyone with the cloned source code and - installed build system + toolchain can build the project in a single step - - -## Non-goals -- Provide calls to core Godot classes' methods via native method bindings -- Support multithreading on the Lua side - - -## Script example -This is an example of how a Lua script will look like. There are comments regarding -some design decisions, which may change during development. - -```lua --- Class definitions are regular Lua tables, to be returned from the script -local MyClass = {} - --- Optional: set class as tool, defaults to false -MyClass.tool = true - --- Optional: set base class by name, defaults to 'Reference' -MyClass.extends = 'Node' - --- Optional: give your class a name -MyClass.class_name = 'MyClass' - --- Declare signals -MyClass.something_happened = signal() -MyClass.something_happened_with_args = signal("arg1", "arg2") - --- Values defined in table are registered as properties of the class -MyClass.some_prop = 42 - --- The `property` function adds metadata to defined properties, --- like setter and getter functions -MyClass.some_prop_with_details = property { - -- [1] or ["default"] or ["default_value"] = property default value - 5, - -- [2] or ["type"] = variant type, optional, inferred from default value - -- All Godot variant type names are defined globally as written in - -- GDScript, like bool, int, float, String, Array, Vector2, etc... - -- Notice that Lua <= 5.2 does not differentiate integers from float - -- numbers, so we should always specify `int` where appropriate - type = int, - -- ["set"] or ["setter"] = setter function, optional - set = function(self, value) - self.some_prop_with_details = value - -- Indexing `self` with keys undefined in script will search base - -- class for methods and properties - self:emit_signal("something_happened_with_args", "some_prop_with_details", value) - end, - -- ["get"] or ["getter"] = getter function, optional - get = function(self) - return self.some_prop_with_details - end, - -- ["export"] = export flag, optional, defaults to false - -- Exported properties are editable in the Inspector - export = true, - -- TODO: usage, hint/hint_text, rset_mode -} --- `export` is an alias for `property` with `export = true` -MyClass.some_exported_prop = export { "hello world!" } - --- Functions defined in table are public methods -function MyClass:_init() -- `function t:f(...)` is an alias for `function t.f(self, ...)` - -- Singletons are available globally - local os_name = OS:get_name() - print("MyClass instance initialized! Running on a " .. os_name .. " system") -end - -function MyClass:some_prop_doubled() - return self.some_prop * 2 -end - --- In the end, table with class declaration must be returned from script -return MyClass -``` - - -## Implementation design details -PluginScripts have three important concepts: the Language Description, -Script Manifest and Instances. - -Let's check out what each layer is and how they will behave from a high -level perspective: - - -### Language description -The language description tells Godot how to initialize and finalize our -language runtime, as well as how to load script manifests from source -files. - -When initializing the runtime, a new [lua_State](https://www.lua.org/manual/5.4/manual.html#lua_State) -will be created and Godot functionality setup in it. -The Lua Virtual Machine (VM) will use engine memory management routines, so -that memory is tracked by the performance monitors in debug builds of the -game/application. -All scripts will share this same state. - -There will be a global table named `GD` with some Godot specific -functions, such as [load](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-load), -[print](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-print), -[push_error](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-push-error), -[push_warning](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-push-warning) -and [yield](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-yield). -Lua's global `print` function will be set to `GD.print` and -[Lua 5.4 warning function](https://www.lua.org/manual/5.4/manual.html#lua_WarnFunction) -will behave like a `push_warning` call. - -Functions that expect file names, like [loadfile](https://www.lua.org/manual/5.4/manual.html#pdf-loadfile) -and [io.open](https://www.lua.org/manual/5.4/manual.html#pdf-io.open), -will be patched to accept paths in the format [`res://*`](https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#resource-path) -and [`user://*`](https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#user-path-persistent-data). -Also, a [package searcher](https://www.lua.org/manual/5.4/manual.html#pdf-package.searchers) -will be added so that Lua can [require](https://www.lua.org/manual/5.4/manual.html#pdf-require) -modules from paths relative to `res://`. - -Language finalization will simply [lua_close](https://www.lua.org/manual/5.4/manual.html#lua_close) the state. - - -### Script manifest -Script manifests hold metadata about classes, such as defined signals, -properties and methods, whether class is [tool](https://docs.godotengine.org/en/stable/tutorials/misc/running_code_in_the_editor.html) -and its base class name. - -In Lua, this information will be stored in Lua tables indexed by the -scripts' path. - -When initializing a script, its source code will be loaded and executed. -Scripts must return a table, which defines the class metadata. -Functions declared in the table are registered as class methods and -other variables are declared as properties or signals. - -Script finalization will destroy the manifest table. - - -### Instances -When a script is attached to an object, the engine will call our -PluginScript to initialize the instance data and when the object gets -destroyed or gets the script removed, we get to finalize the data. - -In Lua, instance data will be stored in Lua tables indexed by the -instance owner object's memory address. - -When instances are indexed with a key that is not present, methods and -property default values will be searched in the script manifest and its -base class, in that order. -This table will be passed to methods as their first argument, as if -using Lua's method call notation: `instance:method(...)`. - -Instance finalization will destroy the data table. - - -## Wrapping up -With this high level design in place, we can now start implementing the -plugin! I have created a Git repository for it hosted at -[https://github.com/gilzoide/godot-lua-pluginscript](https://github.com/gilzoide/godot-lua-pluginscript). - -In the next post I'll discuss how to build the necessary infrastructure -for the PluginScript to work, with stubs to the necessary callbacks and -a build system that compiles the project in a single step. - -See you there ;D diff --git a/blog/1-design-pt.md b/blog/1-design-pt.md deleted file mode 100644 index 17890ac..0000000 --- a/blog/1-design-pt.md +++ /dev/null @@ -1,214 +0,0 @@ -# Projetando um PluginScript de Godot para Lua -2021-07-28 | `#Godot #Lua #GDNative #PluginScript #languageBindings` | [*English version*](1-design-en.md) - -Esse é o primeiro artigo de uma série sobre como estou lidando com o -desenvolvimento de um *plugin* para usar a linguagem de programação [Lua](https://www.lua.org/portugues.html) no [motor de jogos Godot](https://godotengine.org/). - -Lua é uma linguagem de *scripting* pequena e simples, mas poderosa e flexível. -Mesmo [não sendo ideal para todos os cenários](https://docs.godotengine.org/pt_BR/stable/about/faq.html#what-were-the-motivations-behind-creating-gdscript), -certamente é uma ótima ferramenta de *scripting*. -Combinando isso com o poder de [LuaJIT](https://luajit.org/), uma das -implementações de linguagens dinâmicas mais rápidas que se tem notícia, podemos -também [chamar funções externas de código C através da *Foreign Function Interface* (FFI)](https://luajit.org/ext_ffi.html)! - -Com a natureza dinâmica do sistema de *scripting* em Godot, -todas as linguagens suportadas podem facilmente comunicar entre si, de -modo que podemos escolher utilizar a linguagem melhor -adaptada à tarefa a ser cumprida para cada *script*. -Utilizando [sinais](https://docs.godotengine.org/pt_BR/stable/getting_started/step_by_step/signals.html) -e os métodos [call](https://docs.godotengine.org/pt_BR/stable/classes/class_object.html#class-object-method-call), -[get](https://docs.godotengine.org/pt_BR/stable/classes/class_object.html#id1) -e [set](https://docs.godotengine.org/pt_BR/stable/classes/class_object.html#id4), -qualquer objeto pode se comunicar com qualquer outro, não importando -a linguagem na qual o código-fonte foi escrito. - -Para fazer com que Lua seja reconhecida como uma linguagem de -*scripting* em Godot, vamos criar um *PluginScript*, que é um dos usos -do sistema [GDNative](https://docs.godotengine.org/pt_BR/stable/getting_started/step_by_step/scripting.html#gdnative-c), -a API em C para desenvolver *plugins* que estendem várias -funcionalidades do motor, incluindo o sistema de *scripting*. -Um dos benefícios desse método é que somente o *plugin* precisa ser -compilado, de modo que qualquer pessoa com uma versão padrão -precompilada de Godot possa utilizá-lo! =D - - -## Objetivos -- Adicionar suporte à linguagem Lua em Godot de um modo que o motor não - precise ser compilado do zero -- Possibilitar que *scripts* Lua se comuniquem transparentemente com - quaisquer outras linguagens suportadas, como GDScript, Visual Script e C# -- Ter uma interface descritiva simples para declarar *scripts* -- Suporte a Lua 5.1+ e LuaJIT -- Ter um processo de construção simples, onde qualquer um com o - código-fonte em mãos e o sistema de construção + *toolchain* - instalados possam compilar o projeto em um único passo - - -## Não objetivos -- Prover meios de chamar métodos nativamente nas classes padrão de Godot - via *method bindings* -- Suportar *multithreading* em Lua - - -## *Script* exemplo -Este é um exemplo de como um *script* Lua se parecerá. Há comentários -explicando algumas decisões de *design*, que podem mudar ao longo do -desenvolvimento do projeto. - -```lua --- Definições de classes são tabelas, que devem ser retornadas no fim do script -local MinhaClasse = {} - --- Opcional: marcar classe como tool -MinhaClasse.tool = true - --- Opcional: declarar o nome da classe base, padrão 'Reference' -MinhaClasse.extends = 'Node' - --- Opcional: dê um nome à sua classe -MinhaClasse.class_name = 'MinhaClasse' - --- Declaração de sinais -MinhaClasse.um_sinal = signal() -MinhaClasse.um_sinal_com_argumentos = signal("arg1", "arg2") - --- Valores definidos na tabela são registrados como propriedades da classe -MinhaClasse.uma_propriedade = 42 - --- A função `property` adiciona metadados às propriedades definidas, --- como métodos setter e getter -MinhaClasse.uma_propriedade_com_detalhes = property { - -- [1] ou ["default"] ou ["default_value"] = valor padrão da propriedade - 5, - -- [2] ou ["type"] = tipo da variante, opcional, inferido do valor padrão - -- Todos os nomes dos tipos de variantes serão definidos globalmente com - -- o mesmo nome em GDScript, como bool, int, float, String, Array, etc... - -- Note que Lua <= 5.2 não diferencia números inteiros de reais, - -- então devemos especificar `int` sempre que apropriado - type = int, - -- ["set"] ou ["setter"] = função setter, opcional - set = function(self, valor) - self.uma_propriedade_com_detalhes = valor - -- Indexar `self` com chaves não definidas no script buscará métodos - -- e propriedades na classe base - self:emit_signal("um_sinal_com_argumentos", "uma_propriedade_com_detalhes", valor) - end, - -- ["get"] ou ["getter"] = função getter, opcional - get = function(self) - return self.uma_propriedade_com_detalhes - end, - -- ["export"] = sinaliza propriedade como exportada, opcional, padrão false - -- Propriedades exportadas são editáveis pelo Inspetor - export = true, - -- TODO: usage, hint/hint_text, rset_mode -} --- `export` é uma versão de `property` com `export = true` -MinhaClasse.uma_propriedade_exportada = export { "hello world!" } - --- Funções definidas na tabela são registrados como métodos -function MinhaClasse:_init() -- `function t:f(...)` é uma abreviação de `function t.f(self, ...)` - -- Singletons estão disponíveis globalmente - local nome_os = OS:get_name() - print("Instância de MinhaClasse inicializada! Rodando em um sistema " .. nome_os) -end - -function MinhaClasse:uma_propriedade_dobrada() - return self.uma_propriedade * 2 -end - --- Ao final do script, a tabela com definição da classe deve ser retornada -return MinhaClasse -``` - - -## Projeto da implementação -*PluginScripts* possuem três conceitos importantes: Descrição da -Linguagem, Manifestos de *Script* e Instâncias. - -Vamos descobrir o que cada uma dessas camadas é e como elas se -comportarão, numa perspectiva alto nível: - - -### Descrição da Linguagem -A descrição da linguagem informa Godot como inicializar e finalizar o -*runtime* da linguagem, além de como carregar manifestos de scripts a -partir de arquivos com código-fonte. - -Ao inicializar a linguagem, um novo [estado (lua_State)](https://www.lua.org/manual/5.2/pt/manual.html#lua_State) -será criado e funcionalidade de Godot adicionada a ele. -A máquina virtual (VM) de Lua utilizará rotinas de gerenciamento de memória do motor, para -que o uso de memória seja rastreado pelo monitor de performance em -*builds* de *debug* dos jogos/aplicações. -Todos os *scripts* compartilharão desse mesmo estado. - -Haverá uma tabela global chamada `GD` com funções específicas de Godot, -como [load](https://docs.godotengine.org/pt_BR/stable/classes/class_%40gdscript.html#class-gdscript-method-load), -[print](https://docs.godotengine.org/pt_BR/stable/classes/class_%40gdscript.html#class-gdscript-method-print), -[push_error](https://docs.godotengine.org/pt_BR/stable/classes/class_%40gdscript.html#class-gdscript-method-push-error), -[push_warning](https://docs.godotengine.org/pt_BR/stable/classes/class_%40gdscript.html#class-gdscript-method-push-warning) -e [yield](https://docs.godotengine.org/pt_BR/stable/classes/class_%40gdscript.html#class-gdscript-method-yield). -A função global de Lua `print` será trocada por `GD.print` e a -[função de aviso em Lua 5.4](https://www.lua.org/manual/5.4/manual.html#lua_WarnFunction) -se comportará como uma chamada a `push_warning`. - -Funções que recebem nomes de arquivos como argumento, por exemplo -[loadfile](https://www.lua.org/manual/5.2/pt/manual.html#pdf-loadfile) -e [io.open](https://www.lua.org/manual/5.2/pt/manual.html#pdf-io.open), -serão atualizadas para aceitar caminhos nos formatos [`res://*`](https://docs.godotengine.org/pt_BR/stable/tutorials/io/data_paths.html#resource-path) -e [`user://*`](https://docs.godotengine.org/pt_BR/stable/tutorials/io/data_paths.html#user-path-persistent-data). -Do mesmo modo, um [localizador de módulos](https://www.lua.org/manual/5.2/pt/manual.html#pdf-package.searchers) -será adicionado para [require](https://www.lua.org/manual/5.2/pt/manual.html#pdf-require) -carregue módulos relativos ao caminho `res://`. - -Ao finalizar a linguagem, o estado da VM será destruído utilizando -[lua_close](https://www.lua.org/manual/5.2/pt/manual.html#lua_close). - - -### Manifestos de *Script* -Manifestos de *script* são estruturas que carregam metadados sobre as -classes declaradas nos *scripts*, por exemplo a definição de sinais, -propriedades e métodos, assim como se a classe roda em modo -[tool](https://docs.godotengine.org/pt_BR/stable/tutorials/misc/running_code_in_the_editor.html) -e o nome de sua classe base. - -Em Lua, essa informação será guardada em tabelas indexadas pelo caminho -dos *scripts*. - -Ao inicializar um *script*, seu código-fonte será carregado e executado. -*Scripts* devem retornar uma tabela, que definirá os metadados da classe. -Funções declaradas na tabela de manifesto são registradas como métodos -da classe e outras variáveis são declaradas como propriedades ou sinais. - -Ao finalizar um *script*, a tabela do manifesto será destruída. - - -### Instâncias -Quando um *script* é adicionado a um objeto, Godot chamará nosso -*PluginScript* para inicializar os dados da instância e quando o objeto -for destruído ou tiver o *script* removido, devemos destruir esses -dados. - -Em Lua, os dados de instâncias serão guardados em tabelas indexadas pelo -endereço de memória do objeto dono do script. - -Quando instâncias são indexadas com uma chave não presente, métodos e -propriedades padrão serão buscados no manifesto do *script* e na classe -base, nessa ordem. -Essa tabela será passada nos métodos como primeiro argumento, como se -usado a notação de chamadas de método em Lua: `instancia:metodo(...)`. - -Ao finalizar uma instância, a tabela será destruída. - - -## Conclusão -Com a funcionalidade projetada, mesmo que somente em alto nível, já -podemos começar a implementar nosso *plugin*! -Eu criei um repositório Git para ele, disponível no endereço -[https://github.com/gilzoide/godot-lua-pluginscript](https://github.com/gilzoide/godot-lua-pluginscript). - -No próximo artigo discutirei como construir a infraestrutura necessária -para nosso *PluginScript* funcionar, com implementações vazias para os -*callbacks* necessários e um sistema de construção para compilar o -projeto em um único passo. - -Vejo vocês lá ;D diff --git a/blog/2-create-gdnativelibrary-save.png b/blog/2-create-gdnativelibrary-save.png deleted file mode 100644 index f379f62..0000000 Binary files a/blog/2-create-gdnativelibrary-save.png and /dev/null differ diff --git a/blog/2-create-gdnativelibrary.png b/blog/2-create-gdnativelibrary.png deleted file mode 100644 index b734762..0000000 Binary files a/blog/2-create-gdnativelibrary.png and /dev/null differ diff --git a/blog/2-create-resource.png b/blog/2-create-resource.png deleted file mode 100644 index ceb4218..0000000 Binary files a/blog/2-create-resource.png and /dev/null differ diff --git a/blog/2-infrastructure-en.md b/blog/2-infrastructure-en.md deleted file mode 100644 index d09a900..0000000 --- a/blog/2-infrastructure-en.md +++ /dev/null @@ -1,137 +0,0 @@ -# Implementing the infrastructure of a GDNative + PluginScript module -2021-08-03 | `#Godot #Lua #LuaJIT #GDNative #PluginScript #C` | [*Versão em Português*](2-infrastructure-pt.md) - -In the [last post we talked about the design of a plugin for using Lua as a scripting language in Godot](1-design-en.md). -Today we'll start implementing our plugin with the barebones -infrastructure: a [GDNative](https://godotengine.org/article/look-gdnative-architecture) -library that registers [Lua](https://www.lua.org/) as a scripting -language for the [Godot game engine](https://godotengine.org/). -The scripting runtime won't work for now, but Godot will correctly load -our library and import `.lua` files. - - -## How to GDNative -Let's start building an empty GDNative library. -These are shared libraries (DLLs) that are loaded at runtime by the -engine. -They must declare and export the functions `godot_gdnative_init` and -`godot_gdnative_terminate`, to be called when the module is initialized -and terminated, respectively. - -GDNative libraries are loaded only when needed by the project, unless -they are marked as [singletons](https://docs.godotengine.org/en/stable/classes/class_gdnativelibrary.html#class-gdnativelibrary-property-singleton). -Since we want ours to be loaded at project startup, so that Lua scripts -can be imported, we'll make it a singleton. -For this, we also need to declare a function called -`godot_gdnative_singleton`, or Godot won't load our library. -The downside of using singleton GDNative libraries is that they are -never reloaded, so we'll have to reopen the editor each time we -recompile it. - -Ok, time to start this up! -First of all, let's download the [GDNative C API repository](https://github.com/godotengine/godot-headers.git lib/godot-headers). -Since I'm using [Git](https://git-scm.com/) for the project, I'll add it -as a submodule. -I'm using the `lib` directory for maintaining all third-party libraries -at the same place. - -```sh -git submodule add https://github.com/godotengine/godot-headers.git lib/godot-headers -``` - -The GDNative API is very low-level, so I'll also be using my own -[High Level GDNative C/C++ API (HGDN)](https://github.com/gilzoide/high-level-gdnative): - -```sh -git submodule add https://github.com/gilzoide/high-level-gdnative.git lib/high-level-gdnative -``` - -We'll be storing our source files in the `src` folder, for organization. -Here is the skeleton for our GDNative module source, in C: - -```c -/// src/language_gdnative.c - -// HGDN already includes godot-headers -#include "hgdn.h" - -// GDN_EXPORT makes sure our symbols are exported in the way Godot expects -// This is not needed, since symbols are exported by default, but it -// doesn't hurt being explicit about it -GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) { - hgdn_gdnative_init(options); -} - -GDN_EXPORT void godot_gdnative_terminate(godot_gdnative_terminate_options *options) { - hgdn_gdnative_terminate(options); -} - -GDN_EXPORT void godot_gdnative_singleton() { -} -``` - -Since HGDN is a header-only library, we need a C or C++ file for the -implementation. We could use `src/language_gdnative.c` for this, but -I'll add a new file for it to avoid recompiling HGDN implementation on -future builds: - -```c -// src/hgdn.c -#define HGDN_IMPLEMENTATION -#include "hgdn.h" -``` - -Time to build! -I'll be using [xmake](https://xmake.io) as build system, because it -supports several platforms, as well as cross-compiling, out of the box. -Also, it has a nice package system integrated that we'll use for -embedding Lua/LuaJIT later. -The `xmake.lua` build script is as follows: - -```lua --- xmake.lua -target("lua_pluginscript") - set_kind("shared") - -- Set the output name to something easy to find like `build/lua_pluginscript_linux_x86_64.so` - set_targetdir("$(buildir)") - set_prefixname("") - set_suffixname("_$(os)_$(arch)") - -- Add "-I" flags for locating HGDN and godot-header files - add_includedirs("lib/godot-headers", "lib/high-level-gdnative") - -- src/hgdn.c, src/language_gdnative.c - add_files("src/*.c") -target_end() -``` - -Run `xmake` and, if all goes well, we should have a `.so` or `.dll` or -`.dylib` shared library in the `build` folder. - -Time to open Godot. -I've created a new project and added our module repository at -`addons/godot-lua-pluginscript`. -Now we need to create a new GDNativeLibrary Resource: - -![](2-create-resource.png) - -![](2-create-gdnativelibrary.png) - -![](2-create-gdnativelibrary-save.png) - -Set it as singleton: - -![](2-set-singleton.png) - -And set the library path: - -![](2-pick-so.png) -![](2-pick-so-save.png) - -Restart the editor and our module should be imported, nice! - - - - - - - - diff --git a/blog/2-pick-so-save.png b/blog/2-pick-so-save.png deleted file mode 100644 index 549df2f..0000000 Binary files a/blog/2-pick-so-save.png and /dev/null differ diff --git a/blog/2-pick-so.png b/blog/2-pick-so.png deleted file mode 100644 index 760627e..0000000 Binary files a/blog/2-pick-so.png and /dev/null differ diff --git a/blog/2-set-singleton.png b/blog/2-set-singleton.png deleted file mode 100644 index 7f44d67..0000000 Binary files a/blog/2-set-singleton.png and /dev/null differ diff --git a/lua_pluginscript.gdnlib b/lua_pluginscript.gdnlib index bc4b5e3..e46629a 100644 --- a/lua_pluginscript.gdnlib +++ b/lua_pluginscript.gdnlib @@ -7,6 +7,7 @@ reloadable=false [entry] +OSX.64="res://addons/godot-lua-pluginscript/build/lua_pluginscript_macosx_x86_64.dylib" Windows.64="res://addons/godot-lua-pluginscript/build/lua_pluginscript_windows_x86_64.dll" Windows.32="res://addons/godot-lua-pluginscript/build/lua_pluginscript_windows_x86.dll" X11.64="res://addons/godot-lua-pluginscript/build/lua_pluginscript_linux_x86_64.so" @@ -14,6 +15,7 @@ X11.32="res://addons/godot-lua-pluginscript/build/lua_pluginscript_linux_x86.so" [dependencies] +OSX.64=[ ] Windows.64=[ ] Windows.32=[ ] X11.64=[ ] diff --git a/src/ffi.lua b/src/ffi.lua new file mode 100644 index 0000000..811d403 --- /dev/null +++ b/src/ffi.lua @@ -0,0 +1,1369 @@ +local ffi = require 'ffi' + +ffi.cdef[[ +// GDNative type definitions +typedef bool godot_bool; +typedef int godot_int; +typedef float godot_real; + +typedef struct godot_object { + uint8_t _dont_touch_that[0]; +} godot_object; +typedef struct godot_string { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_string; +typedef struct godot_char_string { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_char_string; +typedef struct godot_string_name { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_string_name; +typedef struct godot_node_path { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_node_path; +typedef struct godot_rid { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_rid; +typedef struct godot_dictionary { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_dictionary; +typedef struct godot_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_array; + +typedef struct godot_pool_byte_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_byte_array_read_access; +typedef struct godot_pool_int_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_int_array_read_access; +typedef struct godot_pool_real_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_real_array_read_access; +typedef struct godot_pool_string_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_string_array_read_access; +typedef struct godot_pool_vector2_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_vector2_array_read_access; +typedef struct godot_pool_vector3_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_vector3_array_read_access; +typedef struct godot_pool_color_array_read_access { + uint8_t _dont_touch_that[1]; +} godot_pool_color_array_read_access; +typedef struct godot_pool_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_array_write_access; +typedef struct godot_pool_byte_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_byte_array_write_access; +typedef struct godot_pool_int_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_int_array_write_access; +typedef struct godot_pool_real_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_real_array_write_access; +typedef struct godot_pool_string_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_string_array_write_access; +typedef struct godot_pool_vector2_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_vector2_array_write_access; +typedef struct godot_pool_vector3_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_vector3_array_write_access; +typedef struct godot_pool_color_array_write_access { + uint8_t _dont_touch_that[1]; +} godot_pool_color_array_write_access; + +typedef struct godot_pool_byte_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_byte_array; +typedef struct godot_pool_int_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_int_array; +typedef struct godot_pool_real_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_real_array; +typedef struct godot_pool_string_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_string_array; +typedef struct godot_pool_vector2_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_vector2_array; +typedef struct godot_pool_vector3_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_vector3_array; +typedef struct godot_pool_color_array { + uint8_t _dont_touch_that[sizeof(void *)]; +} godot_pool_color_array; + +typedef struct godot_variant { + uint8_t _dont_touch_that[(16 + sizeof(int64_t))]; +} godot_variant; + +// Math type definitions copied from HGDN +typedef union godot_vector2 { + godot_real elements[2]; + // xy + struct { godot_real x, y; }; + // rg + struct { godot_real r, g; }; + // st + struct { godot_real s, t; }; + // uv + struct { godot_real u, v; }; + // Size: width/height + struct { godot_real width, height; }; +} godot_vector2; + +typedef union godot_vector3 { + godot_real elements[3]; + // xyz + struct { godot_real x, y, z; }; + struct { godot_vector2 xy; godot_real _0; }; + struct { godot_real _1; godot_vector2 yz; }; + // rgb + struct { godot_real r, g, b; }; + struct { godot_vector2 rg; godot_real _2; }; + struct { godot_real _3; godot_vector2 gb; }; + // stp + struct { godot_real s, t, p; }; + struct { godot_vector2 st; godot_real _6; }; + struct { godot_real _7; godot_vector2 tp; }; + // uv + struct { godot_real u, v, _4; }; + struct { godot_vector2 uv; godot_real _5; }; + // 3D Size: width/height/depth + struct { godot_real width, height, depth; }; +} godot_vector3; + +typedef union godot_color { + godot_real elements[4]; + // xyzw + struct { godot_real x, y, z, w; }; + struct { godot_vector2 xy; godot_vector2 zw; }; + struct { godot_vector3 xyz; godot_real _0; }; + struct { godot_real _1; godot_vector3 yzw; }; + // rgba + struct { godot_real r, g, b, a; }; + struct { godot_vector2 rg; godot_vector2 ba; }; + struct { godot_vector3 rgb; godot_real _2; }; + struct { godot_real _3; godot_vector3 gba; }; + // stpq + struct { godot_real s, t, p, q; }; + struct { godot_vector2 st; godot_vector2 pq; }; + struct { godot_vector3 stp; godot_real _6; }; + struct { godot_real _7; godot_vector3 tpq; }; + // uv + struct { godot_real u, v; godot_real _4[2]; }; + struct { godot_vector2 uv; godot_real _5[2]; }; +} godot_color; + +typedef union godot_rect2 { + godot_real elements[4]; + struct { godot_real x, y, width, height; }; + struct { godot_vector2 position; godot_vector2 size; }; +} godot_rect2; + +typedef union godot_plane { + godot_real elements[4]; + struct { godot_vector3 normal; godot_real d; }; +} godot_plane; + +typedef union godot_quat { + godot_real elements[4]; + struct { godot_real x, y, z, w; }; + struct { godot_vector2 xy; godot_vector2 zw; }; + struct { godot_vector3 xyz; godot_real _0; }; + struct { godot_real _1; godot_vector3 yzw; }; +} godot_quat; + +typedef struct godot_basis { + godot_vector3 elements[3]; +} godot_basis; + +typedef struct godot_aabb { + godot_vector3 position, size; +} godot_aabb; + +typedef struct godot_transform2d { + godot_vector2 elements[3]; +} godot_transform2d; + +typedef struct godot_transform { + godot_basis basis; + godot_vector3 origin; +} godot_transform; + +// Enums +typedef enum { + GODOT_OK, // (0) + GODOT_FAILED, ///< Generic fail error + GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable + GODOT_ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet + GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource + GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5) + GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory + GODOT_ERR_FILE_NOT_FOUND, + GODOT_ERR_FILE_BAD_DRIVE, + GODOT_ERR_FILE_BAD_PATH, + GODOT_ERR_FILE_NO_PERMISSION, // (10) + GODOT_ERR_FILE_ALREADY_IN_USE, + GODOT_ERR_FILE_CANT_OPEN, + GODOT_ERR_FILE_CANT_WRITE, + GODOT_ERR_FILE_CANT_READ, + GODOT_ERR_FILE_UNRECOGNIZED, // (15) + GODOT_ERR_FILE_CORRUPT, + GODOT_ERR_FILE_MISSING_DEPENDENCIES, + GODOT_ERR_FILE_EOF, + GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file + GODOT_ERR_CANT_CREATE, // (20) + GODOT_ERR_QUERY_FAILED, + GODOT_ERR_ALREADY_IN_USE, + GODOT_ERR_LOCKED, ///< resource is locked + GODOT_ERR_TIMEOUT, + GODOT_ERR_CANT_CONNECT, // (25) + GODOT_ERR_CANT_RESOLVE, + GODOT_ERR_CONNECTION_ERROR, + GODOT_ERR_CANT_ACQUIRE_RESOURCE, + GODOT_ERR_CANT_FORK, + GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30) + GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid + GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists + GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist + GODOT_ERR_DATABASE_CANT_READ, ///< database is full + GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35) + GODOT_ERR_COMPILATION_FAILED, + GODOT_ERR_METHOD_NOT_FOUND, + GODOT_ERR_LINK_FAILED, + GODOT_ERR_SCRIPT_FAILED, + GODOT_ERR_CYCLIC_LINK, // (40) + GODOT_ERR_INVALID_DECLARATION, + GODOT_ERR_DUPLICATE_SYMBOL, + GODOT_ERR_PARSE_ERROR, + GODOT_ERR_BUSY, + GODOT_ERR_SKIP, // (45) + GODOT_ERR_HELP, ///< user requested help!! + GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. + GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames +} godot_error; + +typedef enum godot_variant_type { + GODOT_VARIANT_TYPE_NIL, + + // atomic types + GODOT_VARIANT_TYPE_BOOL, + GODOT_VARIANT_TYPE_INT, + GODOT_VARIANT_TYPE_REAL, + GODOT_VARIANT_TYPE_STRING, + + // math types + GODOT_VARIANT_TYPE_VECTOR2, // 5 + GODOT_VARIANT_TYPE_RECT2, + GODOT_VARIANT_TYPE_VECTOR3, + GODOT_VARIANT_TYPE_TRANSFORM2D, + GODOT_VARIANT_TYPE_PLANE, + GODOT_VARIANT_TYPE_QUAT, // 10 + GODOT_VARIANT_TYPE_AABB, + GODOT_VARIANT_TYPE_BASIS, + GODOT_VARIANT_TYPE_TRANSFORM, + + // misc types + GODOT_VARIANT_TYPE_COLOR, + GODOT_VARIANT_TYPE_NODE_PATH, // 15 + GODOT_VARIANT_TYPE_RID, + GODOT_VARIANT_TYPE_OBJECT, + GODOT_VARIANT_TYPE_DICTIONARY, + GODOT_VARIANT_TYPE_ARRAY, // 20 + + // arrays + GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, + GODOT_VARIANT_TYPE_POOL_INT_ARRAY, + GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, + GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, + GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25 + GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, + GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, +} godot_variant_type; + +typedef enum godot_variant_call_error_error { + GODOT_CALL_ERROR_CALL_OK, + GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, + GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, + GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, + GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, + GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, +} godot_variant_call_error_error; + +typedef struct godot_variant_call_error { + godot_variant_call_error_error error; + int argument; + godot_variant_type expected; +} godot_variant_call_error; + +typedef enum godot_variant_operator { + // comparison + GODOT_VARIANT_OP_EQUAL, + GODOT_VARIANT_OP_NOT_EQUAL, + GODOT_VARIANT_OP_LESS, + GODOT_VARIANT_OP_LESS_EQUAL, + GODOT_VARIANT_OP_GREATER, + GODOT_VARIANT_OP_GREATER_EQUAL, + + // mathematic + GODOT_VARIANT_OP_ADD, + GODOT_VARIANT_OP_SUBTRACT, + GODOT_VARIANT_OP_MULTIPLY, + GODOT_VARIANT_OP_DIVIDE, + GODOT_VARIANT_OP_NEGATE, + GODOT_VARIANT_OP_POSITIVE, + GODOT_VARIANT_OP_MODULE, + GODOT_VARIANT_OP_STRING_CONCAT, + + // bitwise + GODOT_VARIANT_OP_SHIFT_LEFT, + GODOT_VARIANT_OP_SHIFT_RIGHT, + GODOT_VARIANT_OP_BIT_AND, + GODOT_VARIANT_OP_BIT_OR, + GODOT_VARIANT_OP_BIT_XOR, + GODOT_VARIANT_OP_BIT_NEGATE, + + // logic + GODOT_VARIANT_OP_AND, + GODOT_VARIANT_OP_OR, + GODOT_VARIANT_OP_XOR, + GODOT_VARIANT_OP_NOT, + + // containment + GODOT_VARIANT_OP_IN, + + GODOT_VARIANT_OP_MAX, +} godot_variant_operator; + +typedef enum { + GODOT_VECTOR3_AXIS_X, + GODOT_VECTOR3_AXIS_Y, + GODOT_VECTOR3_AXIS_Z, +} godot_vector3_axis; + +typedef enum { + GODOT_METHOD_RPC_MODE_DISABLED, + GODOT_METHOD_RPC_MODE_REMOTE, + GODOT_METHOD_RPC_MODE_MASTER, + GODOT_METHOD_RPC_MODE_PUPPET, + GODOT_METHOD_RPC_MODE_SLAVE = GODOT_METHOD_RPC_MODE_PUPPET, + GODOT_METHOD_RPC_MODE_REMOTESYNC, + GODOT_METHOD_RPC_MODE_SYNC = GODOT_METHOD_RPC_MODE_REMOTESYNC, + GODOT_METHOD_RPC_MODE_MASTERSYNC, + GODOT_METHOD_RPC_MODE_PUPPETSYNC, +} godot_method_rpc_mode; + +typedef enum { + GODOT_PROPERTY_HINT_NONE, ///< no hint provided. + GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional" + GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit + GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" + GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) + GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer) + GODOT_PROPERTY_HINT_SPRITE_FRAME, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer) + GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) + GODOT_PROPERTY_HINT_LAYERS_2D_RENDER, + GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS, + GODOT_PROPERTY_HINT_LAYERS_3D_RENDER, + GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS, + GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," + GODOT_PROPERTY_HINT_DIR, ///< a directory path must be passed + GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," + GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed + GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type + GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines + GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT, ///< used to set a placeholder text for string properties + GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color + GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY, + GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS, + GODOT_PROPERTY_HINT_OBJECT_ID, + GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose + GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts) + GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type + GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type + GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance + GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base + GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type + GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type + GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance + GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base + GODOT_PROPERTY_HINT_MAX, +} godot_property_hint; + +typedef enum { + GODOT_PROPERTY_USAGE_STORAGE = 1, + GODOT_PROPERTY_USAGE_EDITOR = 2, + GODOT_PROPERTY_USAGE_NETWORK = 4, + GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8, + GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables + GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables + GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings + GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor + GODOT_PROPERTY_USAGE_CATEGORY = 256, + GODOT_PROPERTY_USAGE_STORE_IF_NONZERO = 512, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_USAGE_STORE_IF_NONONE = 1024, // FIXME: Obsolete: drop whenever we can break compat + GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048, + GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096, + GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192, + GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384, + GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768, + GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536, + + GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK, + GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED, + GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK, +} godot_property_usage_flags; + +// Core API +typedef struct godot_method_bind { + uint8_t _dont_touch_that[1]; +} godot_method_bind; + +typedef struct godot_gdnative_api_version { + unsigned int major; + unsigned int minor; +} godot_gdnative_api_version; + +typedef struct godot_gdnative_api_struct { + unsigned int type; + godot_gdnative_api_version version; + const struct godot_gdnative_api_struct *next; +} godot_gdnative_api_struct; + +typedef godot_object *(*godot_class_constructor)(); + +typedef godot_variant (*native_call_cb)(void *, godot_array *); + +typedef struct godot_gdnative_core_api_struct { + unsigned int type; + godot_gdnative_api_version version; + const godot_gdnative_api_struct *next; + unsigned int num_extensions; + const godot_gdnative_api_struct **extensions; + void (*godot_color_new_rgba)(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); + void (*godot_color_new_rgb)(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); + godot_real (*godot_color_get_r)(const godot_color *p_self); + void (*godot_color_set_r)(godot_color *p_self, const godot_real r); + godot_real (*godot_color_get_g)(const godot_color *p_self); + void (*godot_color_set_g)(godot_color *p_self, const godot_real g); + godot_real (*godot_color_get_b)(const godot_color *p_self); + void (*godot_color_set_b)(godot_color *p_self, const godot_real b); + godot_real (*godot_color_get_a)(const godot_color *p_self); + void (*godot_color_set_a)(godot_color *p_self, const godot_real a); + godot_real (*godot_color_get_h)(const godot_color *p_self); + godot_real (*godot_color_get_s)(const godot_color *p_self); + godot_real (*godot_color_get_v)(const godot_color *p_self); + godot_string (*godot_color_as_string)(const godot_color *p_self); + godot_int (*godot_color_to_rgba32)(const godot_color *p_self); + godot_int (*godot_color_to_argb32)(const godot_color *p_self); + godot_real (*godot_color_gray)(const godot_color *p_self); + godot_color (*godot_color_inverted)(const godot_color *p_self); + godot_color (*godot_color_contrasted)(const godot_color *p_self); + godot_color (*godot_color_linear_interpolate)(const godot_color *p_self, const godot_color *p_b, const godot_real p_t); + godot_color (*godot_color_blend)(const godot_color *p_self, const godot_color *p_over); + godot_string (*godot_color_to_html)(const godot_color *p_self, const godot_bool p_with_alpha); + godot_bool (*godot_color_operator_equal)(const godot_color *p_self, const godot_color *p_b); + godot_bool (*godot_color_operator_less)(const godot_color *p_self, const godot_color *p_b); + void (*godot_vector2_new)(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y); + godot_string (*godot_vector2_as_string)(const godot_vector2 *p_self); + godot_vector2 (*godot_vector2_normalized)(const godot_vector2 *p_self); + godot_real (*godot_vector2_length)(const godot_vector2 *p_self); + godot_real (*godot_vector2_angle)(const godot_vector2 *p_self); + godot_real (*godot_vector2_length_squared)(const godot_vector2 *p_self); + godot_bool (*godot_vector2_is_normalized)(const godot_vector2 *p_self); + godot_real (*godot_vector2_distance_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); + godot_real (*godot_vector2_distance_squared_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); + godot_real (*godot_vector2_angle_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); + godot_real (*godot_vector2_angle_to_point)(const godot_vector2 *p_self, const godot_vector2 *p_to); + godot_vector2 (*godot_vector2_linear_interpolate)(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t); + godot_vector2 (*godot_vector2_cubic_interpolate)(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t); + godot_vector2 (*godot_vector2_rotated)(const godot_vector2 *p_self, const godot_real p_phi); + godot_vector2 (*godot_vector2_tangent)(const godot_vector2 *p_self); + godot_vector2 (*godot_vector2_floor)(const godot_vector2 *p_self); + godot_vector2 (*godot_vector2_snapped)(const godot_vector2 *p_self, const godot_vector2 *p_by); + godot_real (*godot_vector2_aspect)(const godot_vector2 *p_self); + godot_real (*godot_vector2_dot)(const godot_vector2 *p_self, const godot_vector2 *p_with); + godot_vector2 (*godot_vector2_slide)(const godot_vector2 *p_self, const godot_vector2 *p_n); + godot_vector2 (*godot_vector2_bounce)(const godot_vector2 *p_self, const godot_vector2 *p_n); + godot_vector2 (*godot_vector2_reflect)(const godot_vector2 *p_self, const godot_vector2 *p_n); + godot_vector2 (*godot_vector2_abs)(const godot_vector2 *p_self); + godot_vector2 (*godot_vector2_clamped)(const godot_vector2 *p_self, const godot_real p_length); + godot_vector2 (*godot_vector2_operator_add)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_vector2 (*godot_vector2_operator_subtract)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_vector2 (*godot_vector2_operator_multiply_vector)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_vector2 (*godot_vector2_operator_multiply_scalar)(const godot_vector2 *p_self, const godot_real p_b); + godot_vector2 (*godot_vector2_operator_divide_vector)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_vector2 (*godot_vector2_operator_divide_scalar)(const godot_vector2 *p_self, const godot_real p_b); + godot_bool (*godot_vector2_operator_equal)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_bool (*godot_vector2_operator_less)(const godot_vector2 *p_self, const godot_vector2 *p_b); + godot_vector2 (*godot_vector2_operator_neg)(const godot_vector2 *p_self); + void (*godot_vector2_set_x)(godot_vector2 *p_self, const godot_real p_x); + void (*godot_vector2_set_y)(godot_vector2 *p_self, const godot_real p_y); + godot_real (*godot_vector2_get_x)(const godot_vector2 *p_self); + godot_real (*godot_vector2_get_y)(const godot_vector2 *p_self); + void (*godot_quat_new)(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); + void (*godot_quat_new_with_axis_angle)(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); + godot_real (*godot_quat_get_x)(const godot_quat *p_self); + void (*godot_quat_set_x)(godot_quat *p_self, const godot_real val); + godot_real (*godot_quat_get_y)(const godot_quat *p_self); + void (*godot_quat_set_y)(godot_quat *p_self, const godot_real val); + godot_real (*godot_quat_get_z)(const godot_quat *p_self); + void (*godot_quat_set_z)(godot_quat *p_self, const godot_real val); + godot_real (*godot_quat_get_w)(const godot_quat *p_self); + void (*godot_quat_set_w)(godot_quat *p_self, const godot_real val); + godot_string (*godot_quat_as_string)(const godot_quat *p_self); + godot_real (*godot_quat_length)(const godot_quat *p_self); + godot_real (*godot_quat_length_squared)(const godot_quat *p_self); + godot_quat (*godot_quat_normalized)(const godot_quat *p_self); + godot_bool (*godot_quat_is_normalized)(const godot_quat *p_self); + godot_quat (*godot_quat_inverse)(const godot_quat *p_self); + godot_real (*godot_quat_dot)(const godot_quat *p_self, const godot_quat *p_b); + godot_vector3 (*godot_quat_xform)(const godot_quat *p_self, const godot_vector3 *p_v); + godot_quat (*godot_quat_slerp)(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); + godot_quat (*godot_quat_slerpni)(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); + godot_quat (*godot_quat_cubic_slerp)(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t); + godot_quat (*godot_quat_operator_multiply)(const godot_quat *p_self, const godot_real p_b); + godot_quat (*godot_quat_operator_add)(const godot_quat *p_self, const godot_quat *p_b); + godot_quat (*godot_quat_operator_subtract)(const godot_quat *p_self, const godot_quat *p_b); + godot_quat (*godot_quat_operator_divide)(const godot_quat *p_self, const godot_real p_b); + godot_bool (*godot_quat_operator_equal)(const godot_quat *p_self, const godot_quat *p_b); + godot_quat (*godot_quat_operator_neg)(const godot_quat *p_self); + void (*godot_basis_new_with_rows)(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis); + void (*godot_basis_new_with_axis_and_angle)(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi); + void (*godot_basis_new_with_euler)(godot_basis *r_dest, const godot_vector3 *p_euler); + godot_string (*godot_basis_as_string)(const godot_basis *p_self); + godot_basis (*godot_basis_inverse)(const godot_basis *p_self); + godot_basis (*godot_basis_transposed)(const godot_basis *p_self); + godot_basis (*godot_basis_orthonormalized)(const godot_basis *p_self); + godot_real (*godot_basis_determinant)(const godot_basis *p_self); + godot_basis (*godot_basis_rotated)(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + godot_basis (*godot_basis_scaled)(const godot_basis *p_self, const godot_vector3 *p_scale); + godot_vector3 (*godot_basis_get_scale)(const godot_basis *p_self); + godot_vector3 (*godot_basis_get_euler)(const godot_basis *p_self); + godot_real (*godot_basis_tdotx)(const godot_basis *p_self, const godot_vector3 *p_with); + godot_real (*godot_basis_tdoty)(const godot_basis *p_self, const godot_vector3 *p_with); + godot_real (*godot_basis_tdotz)(const godot_basis *p_self, const godot_vector3 *p_with); + godot_vector3 (*godot_basis_xform)(const godot_basis *p_self, const godot_vector3 *p_v); + godot_vector3 (*godot_basis_xform_inv)(const godot_basis *p_self, const godot_vector3 *p_v); + godot_int (*godot_basis_get_orthogonal_index)(const godot_basis *p_self); + void (*godot_basis_new)(godot_basis *r_dest); + void (*godot_basis_new_with_euler_quat)(godot_basis *r_dest, const godot_quat *p_euler); + void (*godot_basis_get_elements)(const godot_basis *p_self, godot_vector3 *p_elements); + godot_vector3 (*godot_basis_get_axis)(const godot_basis *p_self, const godot_int p_axis); + void (*godot_basis_set_axis)(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value); + godot_vector3 (*godot_basis_get_row)(const godot_basis *p_self, const godot_int p_row); + void (*godot_basis_set_row)(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value); + godot_bool (*godot_basis_operator_equal)(const godot_basis *p_self, const godot_basis *p_b); + godot_basis (*godot_basis_operator_add)(const godot_basis *p_self, const godot_basis *p_b); + godot_basis (*godot_basis_operator_subtract)(const godot_basis *p_self, const godot_basis *p_b); + godot_basis (*godot_basis_operator_multiply_vector)(const godot_basis *p_self, const godot_basis *p_b); + godot_basis (*godot_basis_operator_multiply_scalar)(const godot_basis *p_self, const godot_real p_b); + void (*godot_vector3_new)(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z); + godot_string (*godot_vector3_as_string)(const godot_vector3 *p_self); + godot_int (*godot_vector3_min_axis)(const godot_vector3 *p_self); + godot_int (*godot_vector3_max_axis)(const godot_vector3 *p_self); + godot_real (*godot_vector3_length)(const godot_vector3 *p_self); + godot_real (*godot_vector3_length_squared)(const godot_vector3 *p_self); + godot_bool (*godot_vector3_is_normalized)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_normalized)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_inverse)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_snapped)(const godot_vector3 *p_self, const godot_vector3 *p_by); + godot_vector3 (*godot_vector3_rotated)(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + godot_vector3 (*godot_vector3_linear_interpolate)(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t); + godot_vector3 (*godot_vector3_cubic_interpolate)(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t); + godot_real (*godot_vector3_dot)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_cross)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_basis (*godot_vector3_outer)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_basis (*godot_vector3_to_diagonal_matrix)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_abs)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_floor)(const godot_vector3 *p_self); + godot_vector3 (*godot_vector3_ceil)(const godot_vector3 *p_self); + godot_real (*godot_vector3_distance_to)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_real (*godot_vector3_distance_squared_to)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_real (*godot_vector3_angle_to)(const godot_vector3 *p_self, const godot_vector3 *p_to); + godot_vector3 (*godot_vector3_slide)(const godot_vector3 *p_self, const godot_vector3 *p_n); + godot_vector3 (*godot_vector3_bounce)(const godot_vector3 *p_self, const godot_vector3 *p_n); + godot_vector3 (*godot_vector3_reflect)(const godot_vector3 *p_self, const godot_vector3 *p_n); + godot_vector3 (*godot_vector3_operator_add)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_operator_subtract)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_operator_multiply_vector)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_operator_multiply_scalar)(const godot_vector3 *p_self, const godot_real p_b); + godot_vector3 (*godot_vector3_operator_divide_vector)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_operator_divide_scalar)(const godot_vector3 *p_self, const godot_real p_b); + godot_bool (*godot_vector3_operator_equal)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_bool (*godot_vector3_operator_less)(const godot_vector3 *p_self, const godot_vector3 *p_b); + godot_vector3 (*godot_vector3_operator_neg)(const godot_vector3 *p_self); + void (*godot_vector3_set_axis)(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val); + godot_real (*godot_vector3_get_axis)(const godot_vector3 *p_self, const godot_vector3_axis p_axis); + void (*godot_pool_byte_array_new)(godot_pool_byte_array *r_dest); + void (*godot_pool_byte_array_new_copy)(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); + void (*godot_pool_byte_array_new_with_array)(godot_pool_byte_array *r_dest, const godot_array *p_a); + void (*godot_pool_byte_array_append)(godot_pool_byte_array *p_self, const uint8_t p_data); + void (*godot_pool_byte_array_append_array)(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); + godot_error (*godot_pool_byte_array_insert)(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); + void (*godot_pool_byte_array_invert)(godot_pool_byte_array *p_self); + void (*godot_pool_byte_array_push_back)(godot_pool_byte_array *p_self, const uint8_t p_data); + void (*godot_pool_byte_array_remove)(godot_pool_byte_array *p_self, const godot_int p_idx); + void (*godot_pool_byte_array_resize)(godot_pool_byte_array *p_self, const godot_int p_size); + godot_pool_byte_array_read_access *(*godot_pool_byte_array_read)(const godot_pool_byte_array *p_self); + godot_pool_byte_array_write_access *(*godot_pool_byte_array_write)(godot_pool_byte_array *p_self); + void (*godot_pool_byte_array_set)(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); + uint8_t (*godot_pool_byte_array_get)(const godot_pool_byte_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_byte_array_size)(const godot_pool_byte_array *p_self); + void (*godot_pool_byte_array_destroy)(godot_pool_byte_array *p_self); + void (*godot_pool_int_array_new)(godot_pool_int_array *r_dest); + void (*godot_pool_int_array_new_copy)(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); + void (*godot_pool_int_array_new_with_array)(godot_pool_int_array *r_dest, const godot_array *p_a); + void (*godot_pool_int_array_append)(godot_pool_int_array *p_self, const godot_int p_data); + void (*godot_pool_int_array_append_array)(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); + godot_error (*godot_pool_int_array_insert)(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); + void (*godot_pool_int_array_invert)(godot_pool_int_array *p_self); + void (*godot_pool_int_array_push_back)(godot_pool_int_array *p_self, const godot_int p_data); + void (*godot_pool_int_array_remove)(godot_pool_int_array *p_self, const godot_int p_idx); + void (*godot_pool_int_array_resize)(godot_pool_int_array *p_self, const godot_int p_size); + godot_pool_int_array_read_access *(*godot_pool_int_array_read)(const godot_pool_int_array *p_self); + godot_pool_int_array_write_access *(*godot_pool_int_array_write)(godot_pool_int_array *p_self); + void (*godot_pool_int_array_set)(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); + godot_int (*godot_pool_int_array_get)(const godot_pool_int_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_int_array_size)(const godot_pool_int_array *p_self); + void (*godot_pool_int_array_destroy)(godot_pool_int_array *p_self); + void (*godot_pool_real_array_new)(godot_pool_real_array *r_dest); + void (*godot_pool_real_array_new_copy)(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); + void (*godot_pool_real_array_new_with_array)(godot_pool_real_array *r_dest, const godot_array *p_a); + void (*godot_pool_real_array_append)(godot_pool_real_array *p_self, const godot_real p_data); + void (*godot_pool_real_array_append_array)(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); + godot_error (*godot_pool_real_array_insert)(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); + void (*godot_pool_real_array_invert)(godot_pool_real_array *p_self); + void (*godot_pool_real_array_push_back)(godot_pool_real_array *p_self, const godot_real p_data); + void (*godot_pool_real_array_remove)(godot_pool_real_array *p_self, const godot_int p_idx); + void (*godot_pool_real_array_resize)(godot_pool_real_array *p_self, const godot_int p_size); + godot_pool_real_array_read_access *(*godot_pool_real_array_read)(const godot_pool_real_array *p_self); + godot_pool_real_array_write_access *(*godot_pool_real_array_write)(godot_pool_real_array *p_self); + void (*godot_pool_real_array_set)(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); + godot_real (*godot_pool_real_array_get)(const godot_pool_real_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_real_array_size)(const godot_pool_real_array *p_self); + void (*godot_pool_real_array_destroy)(godot_pool_real_array *p_self); + void (*godot_pool_string_array_new)(godot_pool_string_array *r_dest); + void (*godot_pool_string_array_new_copy)(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); + void (*godot_pool_string_array_new_with_array)(godot_pool_string_array *r_dest, const godot_array *p_a); + void (*godot_pool_string_array_append)(godot_pool_string_array *p_self, const godot_string *p_data); + void (*godot_pool_string_array_append_array)(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); + godot_error (*godot_pool_string_array_insert)(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); + void (*godot_pool_string_array_invert)(godot_pool_string_array *p_self); + void (*godot_pool_string_array_push_back)(godot_pool_string_array *p_self, const godot_string *p_data); + void (*godot_pool_string_array_remove)(godot_pool_string_array *p_self, const godot_int p_idx); + void (*godot_pool_string_array_resize)(godot_pool_string_array *p_self, const godot_int p_size); + godot_pool_string_array_read_access *(*godot_pool_string_array_read)(const godot_pool_string_array *p_self); + godot_pool_string_array_write_access *(*godot_pool_string_array_write)(godot_pool_string_array *p_self); + void (*godot_pool_string_array_set)(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); + godot_string (*godot_pool_string_array_get)(const godot_pool_string_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_string_array_size)(const godot_pool_string_array *p_self); + void (*godot_pool_string_array_destroy)(godot_pool_string_array *p_self); + void (*godot_pool_vector2_array_new)(godot_pool_vector2_array *r_dest); + void (*godot_pool_vector2_array_new_copy)(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); + void (*godot_pool_vector2_array_new_with_array)(godot_pool_vector2_array *r_dest, const godot_array *p_a); + void (*godot_pool_vector2_array_append)(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + void (*godot_pool_vector2_array_append_array)(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); + godot_error (*godot_pool_vector2_array_insert)(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); + void (*godot_pool_vector2_array_invert)(godot_pool_vector2_array *p_self); + void (*godot_pool_vector2_array_push_back)(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + void (*godot_pool_vector2_array_remove)(godot_pool_vector2_array *p_self, const godot_int p_idx); + void (*godot_pool_vector2_array_resize)(godot_pool_vector2_array *p_self, const godot_int p_size); + godot_pool_vector2_array_read_access *(*godot_pool_vector2_array_read)(const godot_pool_vector2_array *p_self); + godot_pool_vector2_array_write_access *(*godot_pool_vector2_array_write)(godot_pool_vector2_array *p_self); + void (*godot_pool_vector2_array_set)(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); + godot_vector2 (*godot_pool_vector2_array_get)(const godot_pool_vector2_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_vector2_array_size)(const godot_pool_vector2_array *p_self); + void (*godot_pool_vector2_array_destroy)(godot_pool_vector2_array *p_self); + void (*godot_pool_vector3_array_new)(godot_pool_vector3_array *r_dest); + void (*godot_pool_vector3_array_new_copy)(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); + void (*godot_pool_vector3_array_new_with_array)(godot_pool_vector3_array *r_dest, const godot_array *p_a); + void (*godot_pool_vector3_array_append)(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + void (*godot_pool_vector3_array_append_array)(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); + godot_error (*godot_pool_vector3_array_insert)(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); + void (*godot_pool_vector3_array_invert)(godot_pool_vector3_array *p_self); + void (*godot_pool_vector3_array_push_back)(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + void (*godot_pool_vector3_array_remove)(godot_pool_vector3_array *p_self, const godot_int p_idx); + void (*godot_pool_vector3_array_resize)(godot_pool_vector3_array *p_self, const godot_int p_size); + godot_pool_vector3_array_read_access *(*godot_pool_vector3_array_read)(const godot_pool_vector3_array *p_self); + godot_pool_vector3_array_write_access *(*godot_pool_vector3_array_write)(godot_pool_vector3_array *p_self); + void (*godot_pool_vector3_array_set)(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); + godot_vector3 (*godot_pool_vector3_array_get)(const godot_pool_vector3_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_vector3_array_size)(const godot_pool_vector3_array *p_self); + void (*godot_pool_vector3_array_destroy)(godot_pool_vector3_array *p_self); + void (*godot_pool_color_array_new)(godot_pool_color_array *r_dest); + void (*godot_pool_color_array_new_copy)(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); + void (*godot_pool_color_array_new_with_array)(godot_pool_color_array *r_dest, const godot_array *p_a); + void (*godot_pool_color_array_append)(godot_pool_color_array *p_self, const godot_color *p_data); + void (*godot_pool_color_array_append_array)(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); + godot_error (*godot_pool_color_array_insert)(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); + void (*godot_pool_color_array_invert)(godot_pool_color_array *p_self); + void (*godot_pool_color_array_push_back)(godot_pool_color_array *p_self, const godot_color *p_data); + void (*godot_pool_color_array_remove)(godot_pool_color_array *p_self, const godot_int p_idx); + void (*godot_pool_color_array_resize)(godot_pool_color_array *p_self, const godot_int p_size); + godot_pool_color_array_read_access *(*godot_pool_color_array_read)(const godot_pool_color_array *p_self); + godot_pool_color_array_write_access *(*godot_pool_color_array_write)(godot_pool_color_array *p_self); + void (*godot_pool_color_array_set)(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); + godot_color (*godot_pool_color_array_get)(const godot_pool_color_array *p_self, const godot_int p_idx); + godot_int (*godot_pool_color_array_size)(const godot_pool_color_array *p_self); + void (*godot_pool_color_array_destroy)(godot_pool_color_array *p_self); + godot_pool_byte_array_read_access *(*godot_pool_byte_array_read_access_copy)(const godot_pool_byte_array_read_access *p_read); + const uint8_t *(*godot_pool_byte_array_read_access_ptr)(const godot_pool_byte_array_read_access *p_read); + void (*godot_pool_byte_array_read_access_operator_assign)(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other); + void (*godot_pool_byte_array_read_access_destroy)(godot_pool_byte_array_read_access *p_read); + godot_pool_int_array_read_access *(*godot_pool_int_array_read_access_copy)(const godot_pool_int_array_read_access *p_read); + const godot_int *(*godot_pool_int_array_read_access_ptr)(const godot_pool_int_array_read_access *p_read); + void (*godot_pool_int_array_read_access_operator_assign)(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other); + void (*godot_pool_int_array_read_access_destroy)(godot_pool_int_array_read_access *p_read); + godot_pool_real_array_read_access *(*godot_pool_real_array_read_access_copy)(const godot_pool_real_array_read_access *p_read); + const godot_real *(*godot_pool_real_array_read_access_ptr)(const godot_pool_real_array_read_access *p_read); + void (*godot_pool_real_array_read_access_operator_assign)(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other); + void (*godot_pool_real_array_read_access_destroy)(godot_pool_real_array_read_access *p_read); + godot_pool_string_array_read_access *(*godot_pool_string_array_read_access_copy)(const godot_pool_string_array_read_access *p_read); + const godot_string *(*godot_pool_string_array_read_access_ptr)(const godot_pool_string_array_read_access *p_read); + void (*godot_pool_string_array_read_access_operator_assign)(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other); + void (*godot_pool_string_array_read_access_destroy)(godot_pool_string_array_read_access *p_read); + godot_pool_vector2_array_read_access *(*godot_pool_vector2_array_read_access_copy)(const godot_pool_vector2_array_read_access *p_read); + const godot_vector2 *(*godot_pool_vector2_array_read_access_ptr)(const godot_pool_vector2_array_read_access *p_read); + void (*godot_pool_vector2_array_read_access_operator_assign)(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other); + void (*godot_pool_vector2_array_read_access_destroy)(godot_pool_vector2_array_read_access *p_read); + godot_pool_vector3_array_read_access *(*godot_pool_vector3_array_read_access_copy)(const godot_pool_vector3_array_read_access *p_read); + const godot_vector3 *(*godot_pool_vector3_array_read_access_ptr)(const godot_pool_vector3_array_read_access *p_read); + void (*godot_pool_vector3_array_read_access_operator_assign)(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other); + void (*godot_pool_vector3_array_read_access_destroy)(godot_pool_vector3_array_read_access *p_read); + godot_pool_color_array_read_access *(*godot_pool_color_array_read_access_copy)(const godot_pool_color_array_read_access *p_read); + const godot_color *(*godot_pool_color_array_read_access_ptr)(const godot_pool_color_array_read_access *p_read); + void (*godot_pool_color_array_read_access_operator_assign)(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other); + void (*godot_pool_color_array_read_access_destroy)(godot_pool_color_array_read_access *p_read); + godot_pool_byte_array_write_access *(*godot_pool_byte_array_write_access_copy)(const godot_pool_byte_array_write_access *p_write); + uint8_t *(*godot_pool_byte_array_write_access_ptr)(const godot_pool_byte_array_write_access *p_write); + void (*godot_pool_byte_array_write_access_operator_assign)(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other); + void (*godot_pool_byte_array_write_access_destroy)(godot_pool_byte_array_write_access *p_write); + godot_pool_int_array_write_access *(*godot_pool_int_array_write_access_copy)(const godot_pool_int_array_write_access *p_write); + godot_int *(*godot_pool_int_array_write_access_ptr)(const godot_pool_int_array_write_access *p_write); + void (*godot_pool_int_array_write_access_operator_assign)(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other); + void (*godot_pool_int_array_write_access_destroy)(godot_pool_int_array_write_access *p_write); + godot_pool_real_array_write_access *(*godot_pool_real_array_write_access_copy)(const godot_pool_real_array_write_access *p_write); + godot_real *(*godot_pool_real_array_write_access_ptr)(const godot_pool_real_array_write_access *p_write); + void (*godot_pool_real_array_write_access_operator_assign)(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other); + void (*godot_pool_real_array_write_access_destroy)(godot_pool_real_array_write_access *p_write); + godot_pool_string_array_write_access *(*godot_pool_string_array_write_access_copy)(const godot_pool_string_array_write_access *p_write); + godot_string *(*godot_pool_string_array_write_access_ptr)(const godot_pool_string_array_write_access *p_write); + void (*godot_pool_string_array_write_access_operator_assign)(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other); + void (*godot_pool_string_array_write_access_destroy)(godot_pool_string_array_write_access *p_write); + godot_pool_vector2_array_write_access *(*godot_pool_vector2_array_write_access_copy)(const godot_pool_vector2_array_write_access *p_write); + godot_vector2 *(*godot_pool_vector2_array_write_access_ptr)(const godot_pool_vector2_array_write_access *p_write); + void (*godot_pool_vector2_array_write_access_operator_assign)(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other); + void (*godot_pool_vector2_array_write_access_destroy)(godot_pool_vector2_array_write_access *p_write); + godot_pool_vector3_array_write_access *(*godot_pool_vector3_array_write_access_copy)(const godot_pool_vector3_array_write_access *p_write); + godot_vector3 *(*godot_pool_vector3_array_write_access_ptr)(const godot_pool_vector3_array_write_access *p_write); + void (*godot_pool_vector3_array_write_access_operator_assign)(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other); + void (*godot_pool_vector3_array_write_access_destroy)(godot_pool_vector3_array_write_access *p_write); + godot_pool_color_array_write_access *(*godot_pool_color_array_write_access_copy)(const godot_pool_color_array_write_access *p_write); + godot_color *(*godot_pool_color_array_write_access_ptr)(const godot_pool_color_array_write_access *p_write); + void (*godot_pool_color_array_write_access_operator_assign)(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other); + void (*godot_pool_color_array_write_access_destroy)(godot_pool_color_array_write_access *p_write); + void (*godot_array_new)(godot_array *r_dest); + void (*godot_array_new_copy)(godot_array *r_dest, const godot_array *p_src); + void (*godot_array_new_pool_color_array)(godot_array *r_dest, const godot_pool_color_array *p_pca); + void (*godot_array_new_pool_vector3_array)(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); + void (*godot_array_new_pool_vector2_array)(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); + void (*godot_array_new_pool_string_array)(godot_array *r_dest, const godot_pool_string_array *p_psa); + void (*godot_array_new_pool_real_array)(godot_array *r_dest, const godot_pool_real_array *p_pra); + void (*godot_array_new_pool_int_array)(godot_array *r_dest, const godot_pool_int_array *p_pia); + void (*godot_array_new_pool_byte_array)(godot_array *r_dest, const godot_pool_byte_array *p_pba); + void (*godot_array_set)(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); + godot_variant (*godot_array_get)(const godot_array *p_self, const godot_int p_idx); + godot_variant *(*godot_array_operator_index)(godot_array *p_self, const godot_int p_idx); + const godot_variant *(*godot_array_operator_index_const)(const godot_array *p_self, const godot_int p_idx); + void (*godot_array_append)(godot_array *p_self, const godot_variant *p_value); + void (*godot_array_clear)(godot_array *p_self); + godot_int (*godot_array_count)(const godot_array *p_self, const godot_variant *p_value); + godot_bool (*godot_array_empty)(const godot_array *p_self); + void (*godot_array_erase)(godot_array *p_self, const godot_variant *p_value); + godot_variant (*godot_array_front)(const godot_array *p_self); + godot_variant (*godot_array_back)(const godot_array *p_self); + godot_int (*godot_array_find)(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); + godot_int (*godot_array_find_last)(const godot_array *p_self, const godot_variant *p_what); + godot_bool (*godot_array_has)(const godot_array *p_self, const godot_variant *p_value); + godot_int (*godot_array_hash)(const godot_array *p_self); + void (*godot_array_insert)(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); + void (*godot_array_invert)(godot_array *p_self); + godot_variant (*godot_array_pop_back)(godot_array *p_self); + godot_variant (*godot_array_pop_front)(godot_array *p_self); + void (*godot_array_push_back)(godot_array *p_self, const godot_variant *p_value); + void (*godot_array_push_front)(godot_array *p_self, const godot_variant *p_value); + void (*godot_array_remove)(godot_array *p_self, const godot_int p_idx); + void (*godot_array_resize)(godot_array *p_self, const godot_int p_size); + godot_int (*godot_array_rfind)(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); + godot_int (*godot_array_size)(const godot_array *p_self); + void (*godot_array_sort)(godot_array *p_self); + void (*godot_array_sort_custom)(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); + godot_int (*godot_array_bsearch)(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before); + godot_int (*godot_array_bsearch_custom)(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before); + void (*godot_array_destroy)(godot_array *p_self); + void (*godot_dictionary_new)(godot_dictionary *r_dest); + void (*godot_dictionary_new_copy)(godot_dictionary *r_dest, const godot_dictionary *p_src); + void (*godot_dictionary_destroy)(godot_dictionary *p_self); + godot_int (*godot_dictionary_size)(const godot_dictionary *p_self); + godot_bool (*godot_dictionary_empty)(const godot_dictionary *p_self); + void (*godot_dictionary_clear)(godot_dictionary *p_self); + godot_bool (*godot_dictionary_has)(const godot_dictionary *p_self, const godot_variant *p_key); + godot_bool (*godot_dictionary_has_all)(const godot_dictionary *p_self, const godot_array *p_keys); + void (*godot_dictionary_erase)(godot_dictionary *p_self, const godot_variant *p_key); + godot_int (*godot_dictionary_hash)(const godot_dictionary *p_self); + godot_array (*godot_dictionary_keys)(const godot_dictionary *p_self); + godot_array (*godot_dictionary_values)(const godot_dictionary *p_self); + godot_variant (*godot_dictionary_get)(const godot_dictionary *p_self, const godot_variant *p_key); + void (*godot_dictionary_set)(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); + godot_variant *(*godot_dictionary_operator_index)(godot_dictionary *p_self, const godot_variant *p_key); + const godot_variant *(*godot_dictionary_operator_index_const)(const godot_dictionary *p_self, const godot_variant *p_key); + godot_variant *(*godot_dictionary_next)(const godot_dictionary *p_self, const godot_variant *p_key); + godot_bool (*godot_dictionary_operator_equal)(const godot_dictionary *p_self, const godot_dictionary *p_b); + godot_string (*godot_dictionary_to_json)(const godot_dictionary *p_self); + void (*godot_node_path_new)(godot_node_path *r_dest, const godot_string *p_from); + void (*godot_node_path_new_copy)(godot_node_path *r_dest, const godot_node_path *p_src); + void (*godot_node_path_destroy)(godot_node_path *p_self); + godot_string (*godot_node_path_as_string)(const godot_node_path *p_self); + godot_bool (*godot_node_path_is_absolute)(const godot_node_path *p_self); + godot_int (*godot_node_path_get_name_count)(const godot_node_path *p_self); + godot_string (*godot_node_path_get_name)(const godot_node_path *p_self, const godot_int p_idx); + godot_int (*godot_node_path_get_subname_count)(const godot_node_path *p_self); + godot_string (*godot_node_path_get_subname)(const godot_node_path *p_self, const godot_int p_idx); + godot_string (*godot_node_path_get_concatenated_subnames)(const godot_node_path *p_self); + godot_bool (*godot_node_path_is_empty)(const godot_node_path *p_self); + godot_bool (*godot_node_path_operator_equal)(const godot_node_path *p_self, const godot_node_path *p_b); + void (*godot_plane_new_with_reals)(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d); + void (*godot_plane_new_with_vectors)(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3); + void (*godot_plane_new_with_normal)(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d); + godot_string (*godot_plane_as_string)(const godot_plane *p_self); + godot_plane (*godot_plane_normalized)(const godot_plane *p_self); + godot_vector3 (*godot_plane_center)(const godot_plane *p_self); + godot_vector3 (*godot_plane_get_any_point)(const godot_plane *p_self); + godot_bool (*godot_plane_is_point_over)(const godot_plane *p_self, const godot_vector3 *p_point); + godot_real (*godot_plane_distance_to)(const godot_plane *p_self, const godot_vector3 *p_point); + godot_bool (*godot_plane_has_point)(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon); + godot_vector3 (*godot_plane_project)(const godot_plane *p_self, const godot_vector3 *p_point); + godot_bool (*godot_plane_intersect_3)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c); + godot_bool (*godot_plane_intersects_ray)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir); + godot_bool (*godot_plane_intersects_segment)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end); + godot_plane (*godot_plane_operator_neg)(const godot_plane *p_self); + godot_bool (*godot_plane_operator_equal)(const godot_plane *p_self, const godot_plane *p_b); + void (*godot_plane_set_normal)(godot_plane *p_self, const godot_vector3 *p_normal); + godot_vector3 (*godot_plane_get_normal)(const godot_plane *p_self); + godot_real (*godot_plane_get_d)(const godot_plane *p_self); + void (*godot_plane_set_d)(godot_plane *p_self, const godot_real p_d); + void (*godot_rect2_new_with_position_and_size)(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); + void (*godot_rect2_new)(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); + godot_string (*godot_rect2_as_string)(const godot_rect2 *p_self); + godot_real (*godot_rect2_get_area)(const godot_rect2 *p_self); + godot_bool (*godot_rect2_intersects)(const godot_rect2 *p_self, const godot_rect2 *p_b); + godot_bool (*godot_rect2_encloses)(const godot_rect2 *p_self, const godot_rect2 *p_b); + godot_bool (*godot_rect2_has_no_area)(const godot_rect2 *p_self); + godot_rect2 (*godot_rect2_clip)(const godot_rect2 *p_self, const godot_rect2 *p_b); + godot_rect2 (*godot_rect2_merge)(const godot_rect2 *p_self, const godot_rect2 *p_b); + godot_bool (*godot_rect2_has_point)(const godot_rect2 *p_self, const godot_vector2 *p_point); + godot_rect2 (*godot_rect2_grow)(const godot_rect2 *p_self, const godot_real p_by); + godot_rect2 (*godot_rect2_expand)(const godot_rect2 *p_self, const godot_vector2 *p_to); + godot_bool (*godot_rect2_operator_equal)(const godot_rect2 *p_self, const godot_rect2 *p_b); + godot_vector2 (*godot_rect2_get_position)(const godot_rect2 *p_self); + godot_vector2 (*godot_rect2_get_size)(const godot_rect2 *p_self); + void (*godot_rect2_set_position)(godot_rect2 *p_self, const godot_vector2 *p_pos); + void (*godot_rect2_set_size)(godot_rect2 *p_self, const godot_vector2 *p_size); + void (*godot_aabb_new)(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); + godot_vector3 (*godot_aabb_get_position)(const godot_aabb *p_self); + void (*godot_aabb_set_position)(const godot_aabb *p_self, const godot_vector3 *p_v); + godot_vector3 (*godot_aabb_get_size)(const godot_aabb *p_self); + void (*godot_aabb_set_size)(const godot_aabb *p_self, const godot_vector3 *p_v); + godot_string (*godot_aabb_as_string)(const godot_aabb *p_self); + godot_real (*godot_aabb_get_area)(const godot_aabb *p_self); + godot_bool (*godot_aabb_has_no_area)(const godot_aabb *p_self); + godot_bool (*godot_aabb_has_no_surface)(const godot_aabb *p_self); + godot_bool (*godot_aabb_intersects)(const godot_aabb *p_self, const godot_aabb *p_with); + godot_bool (*godot_aabb_encloses)(const godot_aabb *p_self, const godot_aabb *p_with); + godot_aabb (*godot_aabb_merge)(const godot_aabb *p_self, const godot_aabb *p_with); + godot_aabb (*godot_aabb_intersection)(const godot_aabb *p_self, const godot_aabb *p_with); + godot_bool (*godot_aabb_intersects_plane)(const godot_aabb *p_self, const godot_plane *p_plane); + godot_bool (*godot_aabb_intersects_segment)(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); + godot_bool (*godot_aabb_has_point)(const godot_aabb *p_self, const godot_vector3 *p_point); + godot_vector3 (*godot_aabb_get_support)(const godot_aabb *p_self, const godot_vector3 *p_dir); + godot_vector3 (*godot_aabb_get_longest_axis)(const godot_aabb *p_self); + godot_int (*godot_aabb_get_longest_axis_index)(const godot_aabb *p_self); + godot_real (*godot_aabb_get_longest_axis_size)(const godot_aabb *p_self); + godot_vector3 (*godot_aabb_get_shortest_axis)(const godot_aabb *p_self); + godot_int (*godot_aabb_get_shortest_axis_index)(const godot_aabb *p_self); + godot_real (*godot_aabb_get_shortest_axis_size)(const godot_aabb *p_self); + godot_aabb (*godot_aabb_expand)(const godot_aabb *p_self, const godot_vector3 *p_to_point); + godot_aabb (*godot_aabb_grow)(const godot_aabb *p_self, const godot_real p_by); + godot_vector3 (*godot_aabb_get_endpoint)(const godot_aabb *p_self, const godot_int p_idx); + godot_bool (*godot_aabb_operator_equal)(const godot_aabb *p_self, const godot_aabb *p_b); + void (*godot_rid_new)(godot_rid *r_dest); + godot_int (*godot_rid_get_id)(const godot_rid *p_self); + void (*godot_rid_new_with_resource)(godot_rid *r_dest, const godot_object *p_from); + godot_bool (*godot_rid_operator_equal)(const godot_rid *p_self, const godot_rid *p_b); + godot_bool (*godot_rid_operator_less)(const godot_rid *p_self, const godot_rid *p_b); + void (*godot_transform_new_with_axis_origin)(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); + void (*godot_transform_new)(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); + godot_basis (*godot_transform_get_basis)(const godot_transform *p_self); + void (*godot_transform_set_basis)(godot_transform *p_self, const godot_basis *p_v); + godot_vector3 (*godot_transform_get_origin)(const godot_transform *p_self); + void (*godot_transform_set_origin)(godot_transform *p_self, const godot_vector3 *p_v); + godot_string (*godot_transform_as_string)(const godot_transform *p_self); + godot_transform (*godot_transform_inverse)(const godot_transform *p_self); + godot_transform (*godot_transform_affine_inverse)(const godot_transform *p_self); + godot_transform (*godot_transform_orthonormalized)(const godot_transform *p_self); + godot_transform (*godot_transform_rotated)(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi); + godot_transform (*godot_transform_scaled)(const godot_transform *p_self, const godot_vector3 *p_scale); + godot_transform (*godot_transform_translated)(const godot_transform *p_self, const godot_vector3 *p_ofs); + godot_transform (*godot_transform_looking_at)(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up); + godot_plane (*godot_transform_xform_plane)(const godot_transform *p_self, const godot_plane *p_v); + godot_plane (*godot_transform_xform_inv_plane)(const godot_transform *p_self, const godot_plane *p_v); + void (*godot_transform_new_identity)(godot_transform *r_dest); + godot_bool (*godot_transform_operator_equal)(const godot_transform *p_self, const godot_transform *p_b); + godot_transform (*godot_transform_operator_multiply)(const godot_transform *p_self, const godot_transform *p_b); + godot_vector3 (*godot_transform_xform_vector3)(const godot_transform *p_self, const godot_vector3 *p_v); + godot_vector3 (*godot_transform_xform_inv_vector3)(const godot_transform *p_self, const godot_vector3 *p_v); + godot_aabb (*godot_transform_xform_aabb)(const godot_transform *p_self, const godot_aabb *p_v); + godot_aabb (*godot_transform_xform_inv_aabb)(const godot_transform *p_self, const godot_aabb *p_v); + void (*godot_transform2d_new)(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos); + void (*godot_transform2d_new_axis_origin)(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin); + godot_string (*godot_transform2d_as_string)(const godot_transform2d *p_self); + godot_transform2d (*godot_transform2d_inverse)(const godot_transform2d *p_self); + godot_transform2d (*godot_transform2d_affine_inverse)(const godot_transform2d *p_self); + godot_real (*godot_transform2d_get_rotation)(const godot_transform2d *p_self); + godot_vector2 (*godot_transform2d_get_origin)(const godot_transform2d *p_self); + godot_vector2 (*godot_transform2d_get_scale)(const godot_transform2d *p_self); + godot_transform2d (*godot_transform2d_orthonormalized)(const godot_transform2d *p_self); + godot_transform2d (*godot_transform2d_rotated)(const godot_transform2d *p_self, const godot_real p_phi); + godot_transform2d (*godot_transform2d_scaled)(const godot_transform2d *p_self, const godot_vector2 *p_scale); + godot_transform2d (*godot_transform2d_translated)(const godot_transform2d *p_self, const godot_vector2 *p_offset); + godot_vector2 (*godot_transform2d_xform_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); + godot_vector2 (*godot_transform2d_xform_inv_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); + godot_vector2 (*godot_transform2d_basis_xform_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); + godot_vector2 (*godot_transform2d_basis_xform_inv_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); + godot_transform2d (*godot_transform2d_interpolate_with)(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c); + godot_bool (*godot_transform2d_operator_equal)(const godot_transform2d *p_self, const godot_transform2d *p_b); + godot_transform2d (*godot_transform2d_operator_multiply)(const godot_transform2d *p_self, const godot_transform2d *p_b); + void (*godot_transform2d_new_identity)(godot_transform2d *r_dest); + godot_rect2 (*godot_transform2d_xform_rect2)(const godot_transform2d *p_self, const godot_rect2 *p_v); + godot_rect2 (*godot_transform2d_xform_inv_rect2)(const godot_transform2d *p_self, const godot_rect2 *p_v); + godot_variant_type (*godot_variant_get_type)(const godot_variant *p_v); + void (*godot_variant_new_copy)(godot_variant *r_dest, const godot_variant *p_src); + void (*godot_variant_new_nil)(godot_variant *r_dest); + void (*godot_variant_new_bool)(godot_variant *r_dest, const godot_bool p_b); + void (*godot_variant_new_uint)(godot_variant *r_dest, const uint64_t p_i); + void (*godot_variant_new_int)(godot_variant *r_dest, const int64_t p_i); + void (*godot_variant_new_real)(godot_variant *r_dest, const double p_r); + void (*godot_variant_new_string)(godot_variant *r_dest, const godot_string *p_s); + void (*godot_variant_new_vector2)(godot_variant *r_dest, const godot_vector2 *p_v2); + void (*godot_variant_new_rect2)(godot_variant *r_dest, const godot_rect2 *p_rect2); + void (*godot_variant_new_vector3)(godot_variant *r_dest, const godot_vector3 *p_v3); + void (*godot_variant_new_transform2d)(godot_variant *r_dest, const godot_transform2d *p_t2d); + void (*godot_variant_new_plane)(godot_variant *r_dest, const godot_plane *p_plane); + void (*godot_variant_new_quat)(godot_variant *r_dest, const godot_quat *p_quat); + void (*godot_variant_new_aabb)(godot_variant *r_dest, const godot_aabb *p_aabb); + void (*godot_variant_new_basis)(godot_variant *r_dest, const godot_basis *p_basis); + void (*godot_variant_new_transform)(godot_variant *r_dest, const godot_transform *p_trans); + void (*godot_variant_new_color)(godot_variant *r_dest, const godot_color *p_color); + void (*godot_variant_new_node_path)(godot_variant *r_dest, const godot_node_path *p_np); + void (*godot_variant_new_rid)(godot_variant *r_dest, const godot_rid *p_rid); + void (*godot_variant_new_object)(godot_variant *r_dest, const godot_object *p_obj); + void (*godot_variant_new_dictionary)(godot_variant *r_dest, const godot_dictionary *p_dict); + void (*godot_variant_new_array)(godot_variant *r_dest, const godot_array *p_arr); + void (*godot_variant_new_pool_byte_array)(godot_variant *r_dest, const godot_pool_byte_array *p_pba); + void (*godot_variant_new_pool_int_array)(godot_variant *r_dest, const godot_pool_int_array *p_pia); + void (*godot_variant_new_pool_real_array)(godot_variant *r_dest, const godot_pool_real_array *p_pra); + void (*godot_variant_new_pool_string_array)(godot_variant *r_dest, const godot_pool_string_array *p_psa); + void (*godot_variant_new_pool_vector2_array)(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a); + void (*godot_variant_new_pool_vector3_array)(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a); + void (*godot_variant_new_pool_color_array)(godot_variant *r_dest, const godot_pool_color_array *p_pca); + godot_bool (*godot_variant_as_bool)(const godot_variant *p_self); + uint64_t (*godot_variant_as_uint)(const godot_variant *p_self); + int64_t (*godot_variant_as_int)(const godot_variant *p_self); + double (*godot_variant_as_real)(const godot_variant *p_self); + godot_string (*godot_variant_as_string)(const godot_variant *p_self); + godot_vector2 (*godot_variant_as_vector2)(const godot_variant *p_self); + godot_rect2 (*godot_variant_as_rect2)(const godot_variant *p_self); + godot_vector3 (*godot_variant_as_vector3)(const godot_variant *p_self); + godot_transform2d (*godot_variant_as_transform2d)(const godot_variant *p_self); + godot_plane (*godot_variant_as_plane)(const godot_variant *p_self); + godot_quat (*godot_variant_as_quat)(const godot_variant *p_self); + godot_aabb (*godot_variant_as_aabb)(const godot_variant *p_self); + godot_basis (*godot_variant_as_basis)(const godot_variant *p_self); + godot_transform (*godot_variant_as_transform)(const godot_variant *p_self); + godot_color (*godot_variant_as_color)(const godot_variant *p_self); + godot_node_path (*godot_variant_as_node_path)(const godot_variant *p_self); + godot_rid (*godot_variant_as_rid)(const godot_variant *p_self); + godot_object *(*godot_variant_as_object)(const godot_variant *p_self); + godot_dictionary (*godot_variant_as_dictionary)(const godot_variant *p_self); + godot_array (*godot_variant_as_array)(const godot_variant *p_self); + godot_pool_byte_array (*godot_variant_as_pool_byte_array)(const godot_variant *p_self); + godot_pool_int_array (*godot_variant_as_pool_int_array)(const godot_variant *p_self); + godot_pool_real_array (*godot_variant_as_pool_real_array)(const godot_variant *p_self); + godot_pool_string_array (*godot_variant_as_pool_string_array)(const godot_variant *p_self); + godot_pool_vector2_array (*godot_variant_as_pool_vector2_array)(const godot_variant *p_self); + godot_pool_vector3_array (*godot_variant_as_pool_vector3_array)(const godot_variant *p_self); + godot_pool_color_array (*godot_variant_as_pool_color_array)(const godot_variant *p_self); + godot_variant (*godot_variant_call)(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error); + godot_bool (*godot_variant_has_method)(const godot_variant *p_self, const godot_string *p_method); + godot_bool (*godot_variant_operator_equal)(const godot_variant *p_self, const godot_variant *p_other); + godot_bool (*godot_variant_operator_less)(const godot_variant *p_self, const godot_variant *p_other); + godot_bool (*godot_variant_hash_compare)(const godot_variant *p_self, const godot_variant *p_other); + godot_bool (*godot_variant_booleanize)(const godot_variant *p_self); + void (*godot_variant_destroy)(godot_variant *p_self); + godot_int (*godot_char_string_length)(const godot_char_string *p_cs); + const char *(*godot_char_string_get_data)(const godot_char_string *p_cs); + void (*godot_char_string_destroy)(godot_char_string *p_cs); + void (*godot_string_new)(godot_string *r_dest); + void (*godot_string_new_copy)(godot_string *r_dest, const godot_string *p_src); + void (*godot_string_new_with_wide_string)(godot_string *r_dest, const wchar_t *p_contents, const int p_size); + const wchar_t *(*godot_string_operator_index)(godot_string *p_self, const godot_int p_idx); + wchar_t (*godot_string_operator_index_const)(const godot_string *p_self, const godot_int p_idx); + const wchar_t *(*godot_string_wide_str)(const godot_string *p_self); + godot_bool (*godot_string_operator_equal)(const godot_string *p_self, const godot_string *p_b); + godot_bool (*godot_string_operator_less)(const godot_string *p_self, const godot_string *p_b); + godot_string (*godot_string_operator_plus)(const godot_string *p_self, const godot_string *p_b); + godot_int (*godot_string_length)(const godot_string *p_self); + signed char (*godot_string_casecmp_to)(const godot_string *p_self, const godot_string *p_str); + signed char (*godot_string_nocasecmp_to)(const godot_string *p_self, const godot_string *p_str); + signed char (*godot_string_naturalnocasecmp_to)(const godot_string *p_self, const godot_string *p_str); + godot_bool (*godot_string_begins_with)(const godot_string *p_self, const godot_string *p_string); + godot_bool (*godot_string_begins_with_char_array)(const godot_string *p_self, const char *p_char_array); + godot_array (*godot_string_bigrams)(const godot_string *p_self); + godot_string (*godot_string_chr)(wchar_t p_character); + godot_bool (*godot_string_ends_with)(const godot_string *p_self, const godot_string *p_string); + godot_int (*godot_string_find)(const godot_string *p_self, godot_string p_what); + godot_int (*godot_string_find_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); + godot_int (*godot_string_findmk)(const godot_string *p_self, const godot_array *p_keys); + godot_int (*godot_string_findmk_from)(const godot_string *p_self, const godot_array *p_keys, godot_int p_from); + godot_int (*godot_string_findmk_from_in_place)(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key); + godot_int (*godot_string_findn)(const godot_string *p_self, godot_string p_what); + godot_int (*godot_string_findn_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); + godot_int (*godot_string_find_last)(const godot_string *p_self, godot_string p_what); + godot_string (*godot_string_format)(const godot_string *p_self, const godot_variant *p_values); + godot_string (*godot_string_format_with_custom_placeholder)(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); + godot_string (*godot_string_hex_encode_buffer)(const uint8_t *p_buffer, godot_int p_len); + godot_int (*godot_string_hex_to_int)(const godot_string *p_self); + godot_int (*godot_string_hex_to_int_without_prefix)(const godot_string *p_self); + godot_string (*godot_string_insert)(const godot_string *p_self, godot_int p_at_pos, godot_string p_string); + godot_bool (*godot_string_is_numeric)(const godot_string *p_self); + godot_bool (*godot_string_is_subsequence_of)(const godot_string *p_self, const godot_string *p_string); + godot_bool (*godot_string_is_subsequence_ofi)(const godot_string *p_self, const godot_string *p_string); + godot_string (*godot_string_lpad)(const godot_string *p_self, godot_int p_min_length); + godot_string (*godot_string_lpad_with_custom_character)(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); + godot_bool (*godot_string_match)(const godot_string *p_self, const godot_string *p_wildcard); + godot_bool (*godot_string_matchn)(const godot_string *p_self, const godot_string *p_wildcard); + godot_string (*godot_string_md5)(const uint8_t *p_md5); + godot_string (*godot_string_num)(double p_num); + godot_string (*godot_string_num_int64)(int64_t p_num, godot_int p_base); + godot_string (*godot_string_num_int64_capitalized)(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); + godot_string (*godot_string_num_real)(double p_num); + godot_string (*godot_string_num_scientific)(double p_num); + godot_string (*godot_string_num_with_decimals)(double p_num, godot_int p_decimals); + godot_string (*godot_string_pad_decimals)(const godot_string *p_self, godot_int p_digits); + godot_string (*godot_string_pad_zeros)(const godot_string *p_self, godot_int p_digits); + godot_string (*godot_string_replace_first)(const godot_string *p_self, godot_string p_key, godot_string p_with); + godot_string (*godot_string_replace)(const godot_string *p_self, godot_string p_key, godot_string p_with); + godot_string (*godot_string_replacen)(const godot_string *p_self, godot_string p_key, godot_string p_with); + godot_int (*godot_string_rfind)(const godot_string *p_self, godot_string p_what); + godot_int (*godot_string_rfindn)(const godot_string *p_self, godot_string p_what); + godot_int (*godot_string_rfind_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); + godot_int (*godot_string_rfindn_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); + godot_string (*godot_string_rpad)(const godot_string *p_self, godot_int p_min_length); + godot_string (*godot_string_rpad_with_custom_character)(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); + godot_real (*godot_string_similarity)(const godot_string *p_self, const godot_string *p_string); + godot_string (*godot_string_sprintf)(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); + godot_string (*godot_string_substr)(const godot_string *p_self, godot_int p_from, godot_int p_chars); + double (*godot_string_to_double)(const godot_string *p_self); + godot_real (*godot_string_to_float)(const godot_string *p_self); + godot_int (*godot_string_to_int)(const godot_string *p_self); + godot_string (*godot_string_camelcase_to_underscore)(const godot_string *p_self); + godot_string (*godot_string_camelcase_to_underscore_lowercased)(const godot_string *p_self); + godot_string (*godot_string_capitalize)(const godot_string *p_self); + double (*godot_string_char_to_double)(const char *p_what); + godot_int (*godot_string_char_to_int)(const char *p_what); + int64_t (*godot_string_wchar_to_int)(const wchar_t *p_str); + godot_int (*godot_string_char_to_int_with_len)(const char *p_what, godot_int p_len); + int64_t (*godot_string_char_to_int64_with_len)(const wchar_t *p_str, int p_len); + int64_t (*godot_string_hex_to_int64)(const godot_string *p_self); + int64_t (*godot_string_hex_to_int64_with_prefix)(const godot_string *p_self); + int64_t (*godot_string_to_int64)(const godot_string *p_self); + double (*godot_string_unicode_char_to_double)(const wchar_t *p_str, const wchar_t **r_end); + godot_int (*godot_string_get_slice_count)(const godot_string *p_self, godot_string p_splitter); + godot_string (*godot_string_get_slice)(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); + godot_string (*godot_string_get_slicec)(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice); + godot_array (*godot_string_split)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_allow_empty)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_floats)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_floats_allows_empty)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_floats_mk)(const godot_string *p_self, const godot_array *p_splitters); + godot_array (*godot_string_split_floats_mk_allows_empty)(const godot_string *p_self, const godot_array *p_splitters); + godot_array (*godot_string_split_ints)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_ints_allows_empty)(const godot_string *p_self, const godot_string *p_splitter); + godot_array (*godot_string_split_ints_mk)(const godot_string *p_self, const godot_array *p_splitters); + godot_array (*godot_string_split_ints_mk_allows_empty)(const godot_string *p_self, const godot_array *p_splitters); + godot_array (*godot_string_split_spaces)(const godot_string *p_self); + wchar_t (*godot_string_char_lowercase)(wchar_t p_char); + wchar_t (*godot_string_char_uppercase)(wchar_t p_char); + godot_string (*godot_string_to_lower)(const godot_string *p_self); + godot_string (*godot_string_to_upper)(const godot_string *p_self); + godot_string (*godot_string_get_basename)(const godot_string *p_self); + godot_string (*godot_string_get_extension)(const godot_string *p_self); + godot_string (*godot_string_left)(const godot_string *p_self, godot_int p_pos); + wchar_t (*godot_string_ord_at)(const godot_string *p_self, godot_int p_idx); + godot_string (*godot_string_plus_file)(const godot_string *p_self, const godot_string *p_file); + godot_string (*godot_string_right)(const godot_string *p_self, godot_int p_pos); + godot_string (*godot_string_strip_edges)(const godot_string *p_self, godot_bool p_left, godot_bool p_right); + godot_string (*godot_string_strip_escapes)(const godot_string *p_self); + void (*godot_string_erase)(godot_string *p_self, godot_int p_pos, godot_int p_chars); + godot_char_string (*godot_string_ascii)(const godot_string *p_self); + godot_char_string (*godot_string_ascii_extended)(const godot_string *p_self); + godot_char_string (*godot_string_utf8)(const godot_string *p_self); + godot_bool (*godot_string_parse_utf8)(godot_string *p_self, const char *p_utf8); + godot_bool (*godot_string_parse_utf8_with_len)(godot_string *p_self, const char *p_utf8, godot_int p_len); + godot_string (*godot_string_chars_to_utf8)(const char *p_utf8); + godot_string (*godot_string_chars_to_utf8_with_len)(const char *p_utf8, godot_int p_len); + uint32_t (*godot_string_hash)(const godot_string *p_self); + uint64_t (*godot_string_hash64)(const godot_string *p_self); + uint32_t (*godot_string_hash_chars)(const char *p_cstr); + uint32_t (*godot_string_hash_chars_with_len)(const char *p_cstr, godot_int p_len); + uint32_t (*godot_string_hash_utf8_chars)(const wchar_t *p_str); + uint32_t (*godot_string_hash_utf8_chars_with_len)(const wchar_t *p_str, godot_int p_len); + godot_pool_byte_array (*godot_string_md5_buffer)(const godot_string *p_self); + godot_string (*godot_string_md5_text)(const godot_string *p_self); + godot_pool_byte_array (*godot_string_sha256_buffer)(const godot_string *p_self); + godot_string (*godot_string_sha256_text)(const godot_string *p_self); + godot_bool (*godot_string_empty)(const godot_string *p_self); + godot_string (*godot_string_get_base_dir)(const godot_string *p_self); + godot_string (*godot_string_get_file)(const godot_string *p_self); + godot_string (*godot_string_humanize_size)(uint64_t p_size); + godot_bool (*godot_string_is_abs_path)(const godot_string *p_self); + godot_bool (*godot_string_is_rel_path)(const godot_string *p_self); + godot_bool (*godot_string_is_resource_file)(const godot_string *p_self); + godot_string (*godot_string_path_to)(const godot_string *p_self, const godot_string *p_path); + godot_string (*godot_string_path_to_file)(const godot_string *p_self, const godot_string *p_path); + godot_string (*godot_string_simplify_path)(const godot_string *p_self); + godot_string (*godot_string_c_escape)(const godot_string *p_self); + godot_string (*godot_string_c_escape_multiline)(const godot_string *p_self); + godot_string (*godot_string_c_unescape)(const godot_string *p_self); + godot_string (*godot_string_http_escape)(const godot_string *p_self); + godot_string (*godot_string_http_unescape)(const godot_string *p_self); + godot_string (*godot_string_json_escape)(const godot_string *p_self); + godot_string (*godot_string_word_wrap)(const godot_string *p_self, godot_int p_chars_per_line); + godot_string (*godot_string_xml_escape)(const godot_string *p_self); + godot_string (*godot_string_xml_escape_with_quotes)(const godot_string *p_self); + godot_string (*godot_string_xml_unescape)(const godot_string *p_self); + godot_string (*godot_string_percent_decode)(const godot_string *p_self); + godot_string (*godot_string_percent_encode)(const godot_string *p_self); + godot_bool (*godot_string_is_valid_float)(const godot_string *p_self); + godot_bool (*godot_string_is_valid_hex_number)(const godot_string *p_self, godot_bool p_with_prefix); + godot_bool (*godot_string_is_valid_html_color)(const godot_string *p_self); + godot_bool (*godot_string_is_valid_identifier)(const godot_string *p_self); + godot_bool (*godot_string_is_valid_integer)(const godot_string *p_self); + godot_bool (*godot_string_is_valid_ip_address)(const godot_string *p_self); + void (*godot_string_destroy)(godot_string *p_self); + void (*godot_string_name_new)(godot_string_name *r_dest, const godot_string *p_name); + void (*godot_string_name_new_data)(godot_string_name *r_dest, const char *p_name); + godot_string (*godot_string_name_get_name)(const godot_string_name *p_self); + uint32_t (*godot_string_name_get_hash)(const godot_string_name *p_self); + const void *(*godot_string_name_get_data_unique_pointer)(const godot_string_name *p_self); + godot_bool (*godot_string_name_operator_equal)(const godot_string_name *p_self, const godot_string_name *p_other); + godot_bool (*godot_string_name_operator_less)(const godot_string_name *p_self, const godot_string_name *p_other); + void (*godot_string_name_destroy)(godot_string_name *p_self); + void (*godot_object_destroy)(godot_object *p_o); + godot_object *(*godot_global_get_singleton)(const char *p_name); + godot_method_bind *(*godot_method_bind_get_method)(const char *p_classname, const char *p_methodname); + void (*godot_method_bind_ptrcall)(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret); + godot_variant (*godot_method_bind_call)(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error); + godot_class_constructor (*godot_get_class_constructor)(const char *p_classname); + godot_dictionary (*godot_get_global_constants)(); + void (*godot_register_native_call_type)(const char *call_type, native_call_cb p_callback); + void *(*godot_alloc)(int p_bytes); + void *(*godot_realloc)(void *p_ptr, int p_bytes); + void (*godot_free)(void *p_ptr); + void (*godot_print_error)(const char *p_description, const char *p_function, const char *p_file, int p_line); + void (*godot_print_warning)(const char *p_description, const char *p_function, const char *p_file, int p_line); + void (*godot_print)(const godot_string *p_message); +} godot_gdnative_core_api_struct; + +typedef struct godot_gdnative_core_1_1_api_struct { + unsigned int type; + godot_gdnative_api_version version; + const godot_gdnative_api_struct *next; + godot_int (*godot_color_to_abgr32)(const godot_color *p_self); + godot_int (*godot_color_to_abgr64)(const godot_color *p_self); + godot_int (*godot_color_to_argb64)(const godot_color *p_self); + godot_int (*godot_color_to_rgba64)(const godot_color *p_self); + godot_color (*godot_color_darkened)(const godot_color *p_self, const godot_real p_amount); + godot_color (*godot_color_from_hsv)(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a); + godot_color (*godot_color_lightened)(const godot_color *p_self, const godot_real p_amount); + godot_array (*godot_array_duplicate)(const godot_array *p_self, const godot_bool p_deep); + godot_variant (*godot_array_max)(const godot_array *p_self); + godot_variant (*godot_array_min)(const godot_array *p_self); + void (*godot_array_shuffle)(godot_array *p_self); + godot_basis (*godot_basis_slerp)(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t); + godot_variant (*godot_dictionary_get_with_default)(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); + bool (*godot_dictionary_erase_with_return)(godot_dictionary *p_self, const godot_variant *p_key); + godot_node_path (*godot_node_path_get_as_property_path)(const godot_node_path *p_self); + void (*godot_quat_set_axis_angle)(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle); + godot_rect2 (*godot_rect2_grow_individual)(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom); + godot_rect2 (*godot_rect2_grow_margin)(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by); + godot_rect2 (*godot_rect2_abs)(const godot_rect2 *p_self); + godot_string (*godot_string_dedent)(const godot_string *p_self); + godot_string (*godot_string_trim_prefix)(const godot_string *p_self, const godot_string *p_prefix); + godot_string (*godot_string_trim_suffix)(const godot_string *p_self, const godot_string *p_suffix); + godot_string (*godot_string_rstrip)(const godot_string *p_self, const godot_string *p_chars); + godot_pool_string_array (*godot_string_rsplit)(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit); + godot_quat (*godot_basis_get_quat)(const godot_basis *p_self); + void (*godot_basis_set_quat)(godot_basis *p_self, const godot_quat *p_quat); + void (*godot_basis_set_axis_angle_scale)(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale); + void (*godot_basis_set_euler_scale)(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale); + void (*godot_basis_set_quat_scale)(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale); + bool (*godot_is_instance_valid)(const godot_object *p_object); + void (*godot_quat_new_with_basis)(godot_quat *r_dest, const godot_basis *p_basis); + void (*godot_quat_new_with_euler)(godot_quat *r_dest, const godot_vector3 *p_euler); + void (*godot_transform_new_with_quat)(godot_transform *r_dest, const godot_quat *p_quat); + godot_string (*godot_variant_get_operator_name)(godot_variant_operator p_op); + void (*godot_variant_evaluate)(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid); +} godot_gdnative_core_1_1_api_struct; + +typedef struct godot_gdnative_core_1_2_api_struct { + unsigned int type; + godot_gdnative_api_version version; + const godot_gdnative_api_struct *next; + godot_dictionary (*godot_dictionary_duplicate)(const godot_dictionary *p_self, const godot_bool p_deep); + godot_vector3 (*godot_vector3_move_toward)(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta); + godot_vector2 (*godot_vector2_move_toward)(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta); + godot_int (*godot_string_count)(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); + godot_int (*godot_string_countn)(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); + godot_vector3 (*godot_vector3_direction_to)(const godot_vector3 *p_self, const godot_vector3 *p_to); + godot_vector2 (*godot_vector2_direction_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); + godot_array (*godot_array_slice)(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep); + godot_bool (*godot_pool_byte_array_empty)(const godot_pool_byte_array *p_self); + godot_bool (*godot_pool_int_array_empty)(const godot_pool_int_array *p_self); + godot_bool (*godot_pool_real_array_empty)(const godot_pool_real_array *p_self); + godot_bool (*godot_pool_string_array_empty)(const godot_pool_string_array *p_self); + godot_bool (*godot_pool_vector2_array_empty)(const godot_pool_vector2_array *p_self); + godot_bool (*godot_pool_vector3_array_empty)(const godot_pool_vector3_array *p_self); + godot_bool (*godot_pool_color_array_empty)(const godot_pool_color_array *p_self); + void *(*godot_get_class_tag)(const godot_string_name *p_class); + godot_object *(*godot_object_cast_to)(const godot_object *p_object, void *p_class_tag); + godot_object *(*godot_instance_from_id)(godot_int p_instance_id); +} godot_gdnative_core_1_2_api_struct; + +// PluginScript +typedef void godot_pluginscript_instance_data; +typedef void godot_pluginscript_script_data; +typedef void godot_pluginscript_language_data; + +typedef struct godot_property_attributes { + godot_method_rpc_mode rset_type; + + godot_int type; + godot_property_hint hint; + godot_string hint_string; + godot_property_usage_flags usage; + godot_variant default_value; +} godot_property_attributes; + +typedef struct godot_pluginscript_instance_desc { + godot_pluginscript_instance_data *(*init)(godot_pluginscript_script_data *p_data, godot_object *p_owner); + void (*finish)(godot_pluginscript_instance_data *p_data); + godot_bool (*set_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, const godot_variant *p_value); + godot_bool (*get_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, godot_variant *r_ret); + godot_variant (*call_method)(godot_pluginscript_instance_data *p_data, const godot_string_name *p_method, const godot_variant **p_args, int p_argcount, godot_variant_call_error *r_error); + void (*notification)(godot_pluginscript_instance_data *p_data, int p_notification); + godot_method_rpc_mode (*get_rpc_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_method); + godot_method_rpc_mode (*get_rset_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_variable); + void (*refcount_incremented)(godot_pluginscript_instance_data *p_data); + bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die +} godot_pluginscript_instance_desc; + +typedef struct godot_pluginscript_script_manifest { + godot_pluginscript_script_data *data; + godot_string_name name; + godot_bool is_tool; + godot_string_name base; + godot_dictionary member_lines; + godot_array methods; + godot_array signals; + godot_array properties; +} godot_pluginscript_script_manifest; + +typedef struct godot_pluginscript_script_desc { + godot_pluginscript_script_manifest (*init)(godot_pluginscript_language_data *p_data, const godot_string *p_path, const godot_string *p_source, godot_error *r_error); + void (*finish)(godot_pluginscript_script_data *p_data); + godot_pluginscript_instance_desc instance_desc; +} godot_pluginscript_script_desc; + +typedef struct godot_pluginscript_profiling_data { + godot_string_name signature; + godot_int call_count; + godot_int total_time; // In microseconds + godot_int self_time; // In microseconds +} godot_pluginscript_profiling_data; + +typedef struct godot_pluginscript_language_desc { + const char *name; + const char *type; + const char *extension; + const char **recognized_extensions; // NULL terminated array + godot_pluginscript_language_data *(*init)(); + void (*finish)(godot_pluginscript_language_data *p_data); + const char **reserved_words; // NULL terminated array + const char **comment_delimiters; // NULL terminated array + const char **string_delimiters; // NULL terminated array + godot_bool has_named_classes; + godot_bool supports_builtin_mode; + godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); + godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions); + int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL + godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_pool_string_array *p_args); + godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); + void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); + void (*add_global_constant)(godot_pluginscript_language_data *p_data, const godot_string *p_variable, const godot_variant *p_value); + godot_string (*debug_get_error)(godot_pluginscript_language_data *p_data); + int (*debug_get_stack_level_count)(godot_pluginscript_language_data *p_data); + int (*debug_get_stack_level_line)(godot_pluginscript_language_data *p_data, int p_level); + godot_string (*debug_get_stack_level_function)(godot_pluginscript_language_data *p_data, int p_level); + godot_string (*debug_get_stack_level_source)(godot_pluginscript_language_data *p_data, int p_level); + void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + godot_string (*debug_parse_stack_level_expression)(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth); + void (*get_public_functions)(godot_pluginscript_language_data *p_data, godot_array *r_functions); + void (*get_public_constants)(godot_pluginscript_language_data *p_data, godot_dictionary *r_constants); + void (*profiling_start)(godot_pluginscript_language_data *p_data); + void (*profiling_stop)(godot_pluginscript_language_data *p_data); + int (*profiling_get_accumulated_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); + int (*profiling_get_frame_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); + void (*profiling_frame)(godot_pluginscript_language_data *p_data); + godot_pluginscript_script_desc script_desc; +} godot_pluginscript_language_desc; + +// Global API pointers +const godot_gdnative_core_api_struct *hgdn_core_api; + +// Global PluginScript callbacks +void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); +void (*lps_script_init_cb)(godot_pluginscript_script_manifest *manifest, const godot_string *path, const godot_string *source, godot_error *error); +void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); +godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); +void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); +godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); +godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); +void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); +void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); +]] + +-- `hgdn_core_api` will be already initialized at this point +-- by the call to `hgdn_gdnative_init` at `godot_gdnative_init` +local api = ffi.C.hgdn_core_api diff --git a/src/godot_array.lua b/src/godot_array.lua deleted file mode 100644 index 75e70df..0000000 --- a/src/godot_array.lua +++ /dev/null @@ -1,136 +0,0 @@ -local methods = { - tovariant = ffi.C.hgdn_new_array_variant, - varianttype = GD.TYPE_ARRAY, - get = function(self, index) - return api.godot_array_get(self, index):unbox() - end, - set = function(self, index, value) - api.godot_array_set(self, index, Variant(value)) - end, - append = function(self, value) - api.godot_array_append(self, Variant(value)) - end, - clear = api.godot_array_clear, - count = function(self, value) - return api.godot_array_count(self, Variant(value)) - end, - empty = api.godot_array_empty, - erase = function(self, value) - api.godot_array_erase(self, Variant(value)) - end, - front = function(self) - return api.godot_array_front(self):unbox() - end, - back = function(self) - return api.godot_array_back(self):unbox() - end, - find = function(self, what, from) - return api.godot_array_find(self, Variant(what), from or 0) - end, - find_last = function(self, what) - return api.godot_array_find_last(self, Variant(what)) - end, - has = function(self, value) - return api.godot_array_has(self, Variant(value)) - end, - hash = api.godot_array_hash, - insert = function(self, pos, value) - api.godot_array_insert(self, pos, Variant(value)) - end, - invert = api.godot_array_invert, - push_back = function(self, value) - api.godot_array_push_back(self, Variant(value)) - end, - push_front = function(self, value) - api.godot_array_push_front(self, Variant(value)) - end, - pop_back = function(self) - return api.godot_array_pop_back(self):unbox() - end, - pop_front = function(self) - return api.godot_array_pop_front(self):unbox() - end, - remove = api.godot_array_remove, - resize = api.godot_array_resize, - rfind = function(self, what, from) - return api.godot_array_rfind(self, Variant(what), from or -1) - end, - size = function(self) - return api.godot_array_size(self) - end, - sort = api.godot_array_sort, - sort_custom = function(self, obj, func) - api.godot_array_sort_custom(self, obj, String(func)) - end, - bsearch = function(self, value, before) - if before == nil then before = true end - return api.godot_array_bsearch(self, Variant(value), before) - end, - bsearch_custom = function(self, value, obj, func, before) - if before == nil then before = true end - return api.godot_array_bsearch_custom(self, Variant(value), obj, String(func), before) - end, - duplicate = function(self, deep) - return api.godot_array_duplicate(self, deep or false) - end, - slice = function(self, begin, _end, step, deep) - return api.godot_array_slice(self, begin, _end, step, deep or false) - end, -} - -if api_1_1 then - methods.max = function(self) - return api_1_1.godot_array_max(self):unbox() - end - methods.min = function(self) - return api_1_1.godot_array_min(self):unbox() - end - methods.shuffle = api_1_1.godot_array_shuffle -end - -local function array_next(self, index) - index = index + 1 - if index < #self then - return index, self:get(index) - end -end - -local function array_ipairs(self) - return array_next, self, -1 -end - -Array = ffi.metatype('godot_array', { - __new = function(mt, ...) - local self = ffi.new(mt) - api.godot_array_new(self) - for i = 1, select('#', ...) do - local v = select(i, ...) - self:append(v) - end - return self - end, - __gc = api.godot_array_destroy, - __tostring = GD.tostring, - __index = function(self, key) - local numeric_index = tonumber(key) - if numeric_index then - if numeric_index >= 0 and numeric_index < #self then - return methods.get(self, numeric_index) - end - else - return methods[key] - end - end, - __newindex = function(self, key, value) - key = assert(tonumber(key), "Array indices must be numeric") - if key == #self then - methods.append(self, value) - else - methods.set(self, key, value) - end - end, - __concat = concat_gdvalues, - __len = methods.size, - __ipairs = array_ipairs, - __pairs = array_ipairs, -}) diff --git a/src/godot_class.lua b/src/godot_class.lua deleted file mode 100644 index ca81345..0000000 --- a/src/godot_class.lua +++ /dev/null @@ -1,76 +0,0 @@ -local ClassDB = api.godot_global_get_singleton("ClassDB") - -local Variant_p_array = ffi.typeof('godot_variant *[?]') -local const_Variant_pp = ffi.typeof('const godot_variant **') -local VariantCallError = ffi.typeof('godot_variant_call_error') - -local MethodBind = ffi.metatype('godot_method_bind', { - __call = function(self, obj, ...) - local argc = select('#', ...) - local argv = ffi.new(Variant_p_array, argc) - for i = 1, argc do - local arg = select(i, ...) - argv[i - 1] = Variant(arg) - end - local r_error = ffi.new(VariantCallError) - local value = api.godot_method_bind_call(self, Object(obj), ffi.cast(const_Variant_pp, argv), argc, r_error) - if r_error.error == GD.CALL_OK then - return value:unbox() - else - return nil - end - end, -}) - -local MethodBindByName = { - new = function(self, method) - return setmetatable({ method = method }, self) - end, - __call = function(self, obj, ...) - return obj:call(self.method, ...) - end, -} - -local class_methods = { - new = function(self, ...) - local instance = ClassDB:instance(self.class_name) - instance:call('_init', ...) - instance:call('unreference') -- Balance Variant:as_object `reference` call - return instance - end, -} -local Class = { - new = function(self, class_name) - return setmetatable({ class_name = class_name }, self) - end, - __index = function(self, key) - local method = class_methods[key] - if method then return method end - local varkey = Variant(key) - if ClassDB:class_has_integer_constant(self.class_name, varkey) then - local constant = ClassDB:class_get_integer_constant(self.class_name, varkey) - rawset(self, key, constant) - return constant - end - end, -} - -local instance_methods = { - tovariant = function(self) - return Variant(rawget(self, '__owner')) - end, - pcall = function(self, ...) - return rawget(self, '__owner'):pcall(...) - end, - call = function(self, ...) - return rawget(self, '__owner'):call(...) - end, -} -local Instance = { - __index = function(self, key) - local script_value = instance_methods[key] or rawget(self, '__script')[key] - if script_value ~= nil then return script_value end - return rawget(self, '__owner')[key] - end, -} - diff --git a/src/godot_dictionary.lua b/src/godot_dictionary.lua deleted file mode 100644 index 757e36a..0000000 --- a/src/godot_dictionary.lua +++ /dev/null @@ -1,84 +0,0 @@ -local methods = { - tovariant = ffi.C.hgdn_new_dictionary_variant, - varianttype = GD.TYPE_DICTIONARY, - duplicate = function(self, deep) - return api.godot_dictionary_duplicate(self, deep or false) - end, - size = function(self) - return api.godot_dictionary_size(self) - end, - empty = api.godot_dictionary_empty, - clear = api.godot_dictionary_clear, - has = function(self, key) - return api.godot_dictionary_has(self, Variant(key)) - end, - has_all = function(self, ...) - local keys = Array{ ... } - return api.godot_dictionary_has_all(self, keys) - end, - erase = function(self, key) - api.godot_dictionary_erase(self, Variant(key)) - end, - hash = api.godot_dictionary_hash, - keys = api.godot_dictionary_keys, - values = api.godot_dictionary_values, - get = function(self, key) - return api.godot_dictionary_get(self, Variant(key)):unbox() - end, - set = function(self, key, value) - if type(value) == 'nil' then - api.godot_dictionary_erase(self, Variant(key)) - else - api.godot_dictionary_set(self, Variant(key), Variant(value)) - end - end, - next = function(self, key) -- behave like `next(table [, index])` for __pairs - if key ~= nil then - key = Variant(key) - end - local next_key = api.godot_dictionary_next(self, key) - if next_key ~= nil then - return next_key:unbox(), self:get(next_key) - else - return nil - end - end, - to_json = api.godot_dictionary_to_json, -} - -if api_1_1 then - methods.erase_with_return = function(self, key) - return api_1_1.godot_dictionary_erase_with_return(self, Variant(key)) - end - methods.get_with_default = function(self, key, default) - return api_1_1.godot_dictionary_get_with_default(self, Variant(key), Variant(default)) - end -end - -Dictionary = ffi.metatype('godot_dictionary', { - __new = function(mt, value) - local self = ffi.new('godot_dictionary') - if ffi.istype(mt, value) then - api.godot_dictionary_new_copy(self, value) - else - api.godot_dictionary_new(self) - if value then - for k, v in pairs(value) do - self[k] = v - end - end - end - return self - end, - __gc = api.godot_dictionary_destroy, - __tostring = GD.tostring, - __concat = concat_gdvalues, - __index = function(self, key) - return methods[key] or methods.get(self, key) - end, - __newindex = methods.set, - __len = methods.size, - __pairs = function(self) - return methods.next, self, nil - end, -}) diff --git a/src/godot_ffi.lua b/src/godot_ffi.lua deleted file mode 100644 index 70624cf..0000000 --- a/src/godot_ffi.lua +++ /dev/null @@ -1,1347 +0,0 @@ -local ffi = require 'ffi' - -ffi.cdef[[ -// GDNative type definitions -typedef bool godot_bool; -typedef int godot_int; -typedef float godot_real; - -typedef struct godot_object { - uint8_t _dont_touch_that[0]; -} godot_object; -typedef struct godot_string { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_string; -typedef struct godot_char_string { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_char_string; -typedef struct godot_string_name { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_string_name; -typedef struct godot_node_path { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_node_path; -typedef struct godot_rid { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_rid; -typedef struct godot_dictionary { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_dictionary; -typedef struct godot_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_array; - -typedef void godot_pool_byte_array_read_access; -typedef void godot_pool_int_array_read_access; -typedef void godot_pool_real_array_read_access; -typedef void godot_pool_string_array_read_access; -typedef void godot_pool_vector2_array_read_access; -typedef void godot_pool_vector3_array_read_access; -typedef void godot_pool_color_array_read_access; -typedef void godot_pool_array_write_access; -typedef void godot_pool_byte_array_write_access; -typedef void godot_pool_int_array_write_access; -typedef void godot_pool_real_array_write_access; -typedef void godot_pool_string_array_write_access; -typedef void godot_pool_vector2_array_write_access; -typedef void godot_pool_vector3_array_write_access; -typedef void godot_pool_color_array_write_access; -typedef struct godot_pool_byte_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_byte_array; -typedef struct godot_pool_int_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_int_array; -typedef struct godot_pool_real_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_real_array; -typedef struct godot_pool_string_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_string_array; -typedef struct godot_pool_vector2_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_vector2_array; -typedef struct godot_pool_vector3_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_vector3_array; -typedef struct godot_pool_color_array { - uint8_t _dont_touch_that[sizeof(void *)]; -} godot_pool_color_array; - -typedef struct godot_variant { - uint8_t _dont_touch_that[(16 + sizeof(int64_t))]; -} godot_variant; - -// Math type definitions copied from HGDN -typedef union godot_vector2 { - float elements[2]; - // xy - struct { float x, y; }; - // rg - struct { float r, g; }; - // st - struct { float s, t; }; - // uv - struct { float u, v; }; - // Size: width/height - struct { float width, height; }; -} godot_vector2; - -typedef union godot_vector3 { - float elements[3]; - // xyz - struct { float x, y, z; }; - struct { godot_vector2 xy; float _0; }; - struct { float _1; godot_vector2 yz; }; - // rgb - struct { float r, g, b; }; - struct { godot_vector2 rg; float _2; }; - struct { float _3; godot_vector2 gb; }; - // stp - struct { float s, t, p; }; - struct { godot_vector2 st; float _6; }; - struct { float _7; godot_vector2 tp; }; - // uv - struct { float u, v, _4; }; - struct { godot_vector2 uv; float _5; }; - // 3D Size: width/height/depth - struct { float width, height, depth; }; -} godot_vector3; - -typedef union godot_vector4 { - float elements[4]; - // xyzw - struct { float x, y, z, w; }; - struct { godot_vector2 xy; godot_vector2 zw; }; - struct { godot_vector3 xyz; float _0; }; - struct { float _1; godot_vector3 yzw; }; - // rgba - struct { float r, g, b, a; }; - struct { godot_vector2 rg; godot_vector2 ba; }; - struct { godot_vector3 rgb; float _2; }; - struct { float _3; godot_vector3 gba; }; - // stpq - struct { float s, t, p, q; }; - struct { godot_vector2 st; godot_vector2 pq; }; - struct { godot_vector3 stp; float _6; }; - struct { float _7; godot_vector3 tpq; }; - // uv - struct { float u, v; float _4[2]; }; - struct { godot_vector2 uv; float _5[2]; }; -} godot_vector4; -typedef godot_vector4 godot_color; - -typedef union godot_rect2 { - float elements[4]; - struct { float x, y, width, height; }; - struct { godot_vector2 position; godot_vector2 size; }; -} godot_rect2; - -typedef union godot_plane { - float elements[4]; - struct { godot_vector3 normal; float d; }; -} godot_plane; - -typedef union godot_quat { - float elements[4]; - struct { float x, y, z, w; }; - struct { godot_vector2 xy; godot_vector2 zw; }; - struct { godot_vector3 xyz; float _0; }; - struct { float _1; godot_vector3 yzw; }; -} godot_quat; - -typedef struct godot_basis { - godot_vector3 elements[3]; -} godot_basis; - -typedef struct godot_aabb { - godot_vector3 position, size; -} godot_aabb; - -typedef struct godot_transform2d { - godot_vector2 elements[3]; -} godot_transform2d; - -typedef struct godot_transform { - godot_basis basis; - godot_vector3 origin; -} godot_transform; - -// Enums -typedef enum { - GODOT_OK, // (0) - GODOT_FAILED, ///< Generic fail error - GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable - GODOT_ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet - GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource - GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5) - GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory - GODOT_ERR_FILE_NOT_FOUND, - GODOT_ERR_FILE_BAD_DRIVE, - GODOT_ERR_FILE_BAD_PATH, - GODOT_ERR_FILE_NO_PERMISSION, // (10) - GODOT_ERR_FILE_ALREADY_IN_USE, - GODOT_ERR_FILE_CANT_OPEN, - GODOT_ERR_FILE_CANT_WRITE, - GODOT_ERR_FILE_CANT_READ, - GODOT_ERR_FILE_UNRECOGNIZED, // (15) - GODOT_ERR_FILE_CORRUPT, - GODOT_ERR_FILE_MISSING_DEPENDENCIES, - GODOT_ERR_FILE_EOF, - GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file - GODOT_ERR_CANT_CREATE, // (20) - GODOT_ERR_QUERY_FAILED, - GODOT_ERR_ALREADY_IN_USE, - GODOT_ERR_LOCKED, ///< resource is locked - GODOT_ERR_TIMEOUT, - GODOT_ERR_CANT_CONNECT, // (25) - GODOT_ERR_CANT_RESOLVE, - GODOT_ERR_CONNECTION_ERROR, - GODOT_ERR_CANT_ACQUIRE_RESOURCE, - GODOT_ERR_CANT_FORK, - GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30) - GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid - GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists - GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist - GODOT_ERR_DATABASE_CANT_READ, ///< database is full - GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35) - GODOT_ERR_COMPILATION_FAILED, - GODOT_ERR_METHOD_NOT_FOUND, - GODOT_ERR_LINK_FAILED, - GODOT_ERR_SCRIPT_FAILED, - GODOT_ERR_CYCLIC_LINK, // (40) - GODOT_ERR_INVALID_DECLARATION, - GODOT_ERR_DUPLICATE_SYMBOL, - GODOT_ERR_PARSE_ERROR, - GODOT_ERR_BUSY, - GODOT_ERR_SKIP, // (45) - GODOT_ERR_HELP, ///< user requested help!! - GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. - GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames -} godot_error; - -typedef enum godot_variant_type { - GODOT_VARIANT_TYPE_NIL, - - // atomic types - GODOT_VARIANT_TYPE_BOOL, - GODOT_VARIANT_TYPE_INT, - GODOT_VARIANT_TYPE_REAL, - GODOT_VARIANT_TYPE_STRING, - - // math types - GODOT_VARIANT_TYPE_VECTOR2, // 5 - GODOT_VARIANT_TYPE_RECT2, - GODOT_VARIANT_TYPE_VECTOR3, - GODOT_VARIANT_TYPE_TRANSFORM2D, - GODOT_VARIANT_TYPE_PLANE, - GODOT_VARIANT_TYPE_QUAT, // 10 - GODOT_VARIANT_TYPE_AABB, - GODOT_VARIANT_TYPE_BASIS, - GODOT_VARIANT_TYPE_TRANSFORM, - - // misc types - GODOT_VARIANT_TYPE_COLOR, - GODOT_VARIANT_TYPE_NODE_PATH, // 15 - GODOT_VARIANT_TYPE_RID, - GODOT_VARIANT_TYPE_OBJECT, - GODOT_VARIANT_TYPE_DICTIONARY, - GODOT_VARIANT_TYPE_ARRAY, // 20 - - // arrays - GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, - GODOT_VARIANT_TYPE_POOL_INT_ARRAY, - GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, - GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, - GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25 - GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, - GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, -} godot_variant_type; - -typedef enum godot_variant_call_error_error { - GODOT_CALL_ERROR_CALL_OK, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, - GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, -} godot_variant_call_error_error; - -typedef struct godot_variant_call_error { - godot_variant_call_error_error error; - int argument; - godot_variant_type expected; -} godot_variant_call_error; - -typedef enum godot_variant_operator { - // comparison - GODOT_VARIANT_OP_EQUAL, - GODOT_VARIANT_OP_NOT_EQUAL, - GODOT_VARIANT_OP_LESS, - GODOT_VARIANT_OP_LESS_EQUAL, - GODOT_VARIANT_OP_GREATER, - GODOT_VARIANT_OP_GREATER_EQUAL, - - // mathematic - GODOT_VARIANT_OP_ADD, - GODOT_VARIANT_OP_SUBTRACT, - GODOT_VARIANT_OP_MULTIPLY, - GODOT_VARIANT_OP_DIVIDE, - GODOT_VARIANT_OP_NEGATE, - GODOT_VARIANT_OP_POSITIVE, - GODOT_VARIANT_OP_MODULE, - GODOT_VARIANT_OP_STRING_CONCAT, - - // bitwise - GODOT_VARIANT_OP_SHIFT_LEFT, - GODOT_VARIANT_OP_SHIFT_RIGHT, - GODOT_VARIANT_OP_BIT_AND, - GODOT_VARIANT_OP_BIT_OR, - GODOT_VARIANT_OP_BIT_XOR, - GODOT_VARIANT_OP_BIT_NEGATE, - - // logic - GODOT_VARIANT_OP_AND, - GODOT_VARIANT_OP_OR, - GODOT_VARIANT_OP_XOR, - GODOT_VARIANT_OP_NOT, - - // containment - GODOT_VARIANT_OP_IN, - - GODOT_VARIANT_OP_MAX, -} godot_variant_operator; - -typedef enum { - GODOT_VECTOR3_AXIS_X, - GODOT_VECTOR3_AXIS_Y, - GODOT_VECTOR3_AXIS_Z, -} godot_vector3_axis; - -typedef enum { - GODOT_METHOD_RPC_MODE_DISABLED, - GODOT_METHOD_RPC_MODE_REMOTE, - GODOT_METHOD_RPC_MODE_MASTER, - GODOT_METHOD_RPC_MODE_PUPPET, - GODOT_METHOD_RPC_MODE_SLAVE = GODOT_METHOD_RPC_MODE_PUPPET, - GODOT_METHOD_RPC_MODE_REMOTESYNC, - GODOT_METHOD_RPC_MODE_SYNC = GODOT_METHOD_RPC_MODE_REMOTESYNC, - GODOT_METHOD_RPC_MODE_MASTERSYNC, - GODOT_METHOD_RPC_MODE_PUPPETSYNC, -} godot_method_rpc_mode; - -typedef enum { - GODOT_PROPERTY_HINT_NONE, ///< no hint provided. - GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional" - GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit - GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" - GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) - GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer) - GODOT_PROPERTY_HINT_SPRITE_FRAME, // FIXME: Obsolete: drop whenever we can break compat - GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer) - GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) - GODOT_PROPERTY_HINT_LAYERS_2D_RENDER, - GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS, - GODOT_PROPERTY_HINT_LAYERS_3D_RENDER, - GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS, - GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," - GODOT_PROPERTY_HINT_DIR, ///< a directory path must be passed - GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," - GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed - GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type - GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines - GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT, ///< used to set a placeholder text for string properties - GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color - GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY, - GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS, - GODOT_PROPERTY_HINT_OBJECT_ID, - GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose - GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts) - GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type - GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type - GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance - GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base - GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type - GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type - GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance - GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base - GODOT_PROPERTY_HINT_MAX, -} godot_property_hint; - -typedef enum { - GODOT_PROPERTY_USAGE_STORAGE = 1, - GODOT_PROPERTY_USAGE_EDITOR = 2, - GODOT_PROPERTY_USAGE_NETWORK = 4, - GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8, - GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables - GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables - GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings - GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor - GODOT_PROPERTY_USAGE_CATEGORY = 256, - GODOT_PROPERTY_USAGE_STORE_IF_NONZERO = 512, // FIXME: Obsolete: drop whenever we can break compat - GODOT_PROPERTY_USAGE_STORE_IF_NONONE = 1024, // FIXME: Obsolete: drop whenever we can break compat - GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048, - GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096, - GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192, - GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384, - GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768, - GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536, - - GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK, - GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED, - GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK, -} godot_property_usage_flags; - -// Core API -typedef struct godot_method_bind { - uint8_t _dont_touch_that[1]; -} godot_method_bind; - -typedef struct godot_gdnative_api_version { - unsigned int major; - unsigned int minor; -} godot_gdnative_api_version; - -typedef struct godot_gdnative_api_struct godot_gdnative_api_struct; - -struct godot_gdnative_api_struct { - unsigned int type; - godot_gdnative_api_version version; - const godot_gdnative_api_struct *next; -}; - -typedef godot_object *(*godot_class_constructor)(); - -typedef godot_variant (*native_call_cb)(void *, godot_array *); - -typedef struct godot_gdnative_core_api_struct { - unsigned int type; - godot_gdnative_api_version version; - const godot_gdnative_api_struct *next; - unsigned int num_extensions; - const godot_gdnative_api_struct **extensions; - void (*godot_color_new_rgba)(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); - void (*godot_color_new_rgb)(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); - godot_real (*godot_color_get_r)(const godot_color *p_self); - void (*godot_color_set_r)(godot_color *p_self, const godot_real r); - godot_real (*godot_color_get_g)(const godot_color *p_self); - void (*godot_color_set_g)(godot_color *p_self, const godot_real g); - godot_real (*godot_color_get_b)(const godot_color *p_self); - void (*godot_color_set_b)(godot_color *p_self, const godot_real b); - godot_real (*godot_color_get_a)(const godot_color *p_self); - void (*godot_color_set_a)(godot_color *p_self, const godot_real a); - godot_real (*godot_color_get_h)(const godot_color *p_self); - godot_real (*godot_color_get_s)(const godot_color *p_self); - godot_real (*godot_color_get_v)(const godot_color *p_self); - godot_string (*godot_color_as_string)(const godot_color *p_self); - godot_int (*godot_color_to_rgba32)(const godot_color *p_self); - godot_int (*godot_color_to_argb32)(const godot_color *p_self); - godot_real (*godot_color_gray)(const godot_color *p_self); - godot_color (*godot_color_inverted)(const godot_color *p_self); - godot_color (*godot_color_contrasted)(const godot_color *p_self); - godot_color (*godot_color_linear_interpolate)(const godot_color *p_self, const godot_color *p_b, const godot_real p_t); - godot_color (*godot_color_blend)(const godot_color *p_self, const godot_color *p_over); - godot_string (*godot_color_to_html)(const godot_color *p_self, const godot_bool p_with_alpha); - godot_bool (*godot_color_operator_equal)(const godot_color *p_self, const godot_color *p_b); - godot_bool (*godot_color_operator_less)(const godot_color *p_self, const godot_color *p_b); - void (*godot_vector2_new)(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y); - godot_string (*godot_vector2_as_string)(const godot_vector2 *p_self); - godot_vector2 (*godot_vector2_normalized)(const godot_vector2 *p_self); - godot_real (*godot_vector2_length)(const godot_vector2 *p_self); - godot_real (*godot_vector2_angle)(const godot_vector2 *p_self); - godot_real (*godot_vector2_length_squared)(const godot_vector2 *p_self); - godot_bool (*godot_vector2_is_normalized)(const godot_vector2 *p_self); - godot_real (*godot_vector2_distance_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); - godot_real (*godot_vector2_distance_squared_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); - godot_real (*godot_vector2_angle_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); - godot_real (*godot_vector2_angle_to_point)(const godot_vector2 *p_self, const godot_vector2 *p_to); - godot_vector2 (*godot_vector2_linear_interpolate)(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t); - godot_vector2 (*godot_vector2_cubic_interpolate)(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t); - godot_vector2 (*godot_vector2_rotated)(const godot_vector2 *p_self, const godot_real p_phi); - godot_vector2 (*godot_vector2_tangent)(const godot_vector2 *p_self); - godot_vector2 (*godot_vector2_floor)(const godot_vector2 *p_self); - godot_vector2 (*godot_vector2_snapped)(const godot_vector2 *p_self, const godot_vector2 *p_by); - godot_real (*godot_vector2_aspect)(const godot_vector2 *p_self); - godot_real (*godot_vector2_dot)(const godot_vector2 *p_self, const godot_vector2 *p_with); - godot_vector2 (*godot_vector2_slide)(const godot_vector2 *p_self, const godot_vector2 *p_n); - godot_vector2 (*godot_vector2_bounce)(const godot_vector2 *p_self, const godot_vector2 *p_n); - godot_vector2 (*godot_vector2_reflect)(const godot_vector2 *p_self, const godot_vector2 *p_n); - godot_vector2 (*godot_vector2_abs)(const godot_vector2 *p_self); - godot_vector2 (*godot_vector2_clamped)(const godot_vector2 *p_self, const godot_real p_length); - godot_vector2 (*godot_vector2_operator_add)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_vector2 (*godot_vector2_operator_subtract)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_vector2 (*godot_vector2_operator_multiply_vector)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_vector2 (*godot_vector2_operator_multiply_scalar)(const godot_vector2 *p_self, const godot_real p_b); - godot_vector2 (*godot_vector2_operator_divide_vector)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_vector2 (*godot_vector2_operator_divide_scalar)(const godot_vector2 *p_self, const godot_real p_b); - godot_bool (*godot_vector2_operator_equal)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_bool (*godot_vector2_operator_less)(const godot_vector2 *p_self, const godot_vector2 *p_b); - godot_vector2 (*godot_vector2_operator_neg)(const godot_vector2 *p_self); - void (*godot_vector2_set_x)(godot_vector2 *p_self, const godot_real p_x); - void (*godot_vector2_set_y)(godot_vector2 *p_self, const godot_real p_y); - godot_real (*godot_vector2_get_x)(const godot_vector2 *p_self); - godot_real (*godot_vector2_get_y)(const godot_vector2 *p_self); - void (*godot_quat_new)(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); - void (*godot_quat_new_with_axis_angle)(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); - godot_real (*godot_quat_get_x)(const godot_quat *p_self); - void (*godot_quat_set_x)(godot_quat *p_self, const godot_real val); - godot_real (*godot_quat_get_y)(const godot_quat *p_self); - void (*godot_quat_set_y)(godot_quat *p_self, const godot_real val); - godot_real (*godot_quat_get_z)(const godot_quat *p_self); - void (*godot_quat_set_z)(godot_quat *p_self, const godot_real val); - godot_real (*godot_quat_get_w)(const godot_quat *p_self); - void (*godot_quat_set_w)(godot_quat *p_self, const godot_real val); - godot_string (*godot_quat_as_string)(const godot_quat *p_self); - godot_real (*godot_quat_length)(const godot_quat *p_self); - godot_real (*godot_quat_length_squared)(const godot_quat *p_self); - godot_quat (*godot_quat_normalized)(const godot_quat *p_self); - godot_bool (*godot_quat_is_normalized)(const godot_quat *p_self); - godot_quat (*godot_quat_inverse)(const godot_quat *p_self); - godot_real (*godot_quat_dot)(const godot_quat *p_self, const godot_quat *p_b); - godot_vector3 (*godot_quat_xform)(const godot_quat *p_self, const godot_vector3 *p_v); - godot_quat (*godot_quat_slerp)(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - godot_quat (*godot_quat_slerpni)(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - godot_quat (*godot_quat_cubic_slerp)(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t); - godot_quat (*godot_quat_operator_multiply)(const godot_quat *p_self, const godot_real p_b); - godot_quat (*godot_quat_operator_add)(const godot_quat *p_self, const godot_quat *p_b); - godot_quat (*godot_quat_operator_subtract)(const godot_quat *p_self, const godot_quat *p_b); - godot_quat (*godot_quat_operator_divide)(const godot_quat *p_self, const godot_real p_b); - godot_bool (*godot_quat_operator_equal)(const godot_quat *p_self, const godot_quat *p_b); - godot_quat (*godot_quat_operator_neg)(const godot_quat *p_self); - void (*godot_basis_new_with_rows)(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis); - void (*godot_basis_new_with_axis_and_angle)(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi); - void (*godot_basis_new_with_euler)(godot_basis *r_dest, const godot_vector3 *p_euler); - godot_string (*godot_basis_as_string)(const godot_basis *p_self); - godot_basis (*godot_basis_inverse)(const godot_basis *p_self); - godot_basis (*godot_basis_transposed)(const godot_basis *p_self); - godot_basis (*godot_basis_orthonormalized)(const godot_basis *p_self); - godot_real (*godot_basis_determinant)(const godot_basis *p_self); - godot_basis (*godot_basis_rotated)(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - godot_basis (*godot_basis_scaled)(const godot_basis *p_self, const godot_vector3 *p_scale); - godot_vector3 (*godot_basis_get_scale)(const godot_basis *p_self); - godot_vector3 (*godot_basis_get_euler)(const godot_basis *p_self); - godot_real (*godot_basis_tdotx)(const godot_basis *p_self, const godot_vector3 *p_with); - godot_real (*godot_basis_tdoty)(const godot_basis *p_self, const godot_vector3 *p_with); - godot_real (*godot_basis_tdotz)(const godot_basis *p_self, const godot_vector3 *p_with); - godot_vector3 (*godot_basis_xform)(const godot_basis *p_self, const godot_vector3 *p_v); - godot_vector3 (*godot_basis_xform_inv)(const godot_basis *p_self, const godot_vector3 *p_v); - godot_int (*godot_basis_get_orthogonal_index)(const godot_basis *p_self); - void (*godot_basis_new)(godot_basis *r_dest); - void (*godot_basis_new_with_euler_quat)(godot_basis *r_dest, const godot_quat *p_euler); - void (*godot_basis_get_elements)(const godot_basis *p_self, godot_vector3 *p_elements); - godot_vector3 (*godot_basis_get_axis)(const godot_basis *p_self, const godot_int p_axis); - void (*godot_basis_set_axis)(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value); - godot_vector3 (*godot_basis_get_row)(const godot_basis *p_self, const godot_int p_row); - void (*godot_basis_set_row)(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value); - godot_bool (*godot_basis_operator_equal)(const godot_basis *p_self, const godot_basis *p_b); - godot_basis (*godot_basis_operator_add)(const godot_basis *p_self, const godot_basis *p_b); - godot_basis (*godot_basis_operator_subtract)(const godot_basis *p_self, const godot_basis *p_b); - godot_basis (*godot_basis_operator_multiply_vector)(const godot_basis *p_self, const godot_basis *p_b); - godot_basis (*godot_basis_operator_multiply_scalar)(const godot_basis *p_self, const godot_real p_b); - void (*godot_vector3_new)(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z); - godot_string (*godot_vector3_as_string)(const godot_vector3 *p_self); - godot_int (*godot_vector3_min_axis)(const godot_vector3 *p_self); - godot_int (*godot_vector3_max_axis)(const godot_vector3 *p_self); - godot_real (*godot_vector3_length)(const godot_vector3 *p_self); - godot_real (*godot_vector3_length_squared)(const godot_vector3 *p_self); - godot_bool (*godot_vector3_is_normalized)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_normalized)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_inverse)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_snapped)(const godot_vector3 *p_self, const godot_vector3 *p_by); - godot_vector3 (*godot_vector3_rotated)(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - godot_vector3 (*godot_vector3_linear_interpolate)(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t); - godot_vector3 (*godot_vector3_cubic_interpolate)(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t); - godot_real (*godot_vector3_dot)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_cross)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_basis (*godot_vector3_outer)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_basis (*godot_vector3_to_diagonal_matrix)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_abs)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_floor)(const godot_vector3 *p_self); - godot_vector3 (*godot_vector3_ceil)(const godot_vector3 *p_self); - godot_real (*godot_vector3_distance_to)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_real (*godot_vector3_distance_squared_to)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_real (*godot_vector3_angle_to)(const godot_vector3 *p_self, const godot_vector3 *p_to); - godot_vector3 (*godot_vector3_slide)(const godot_vector3 *p_self, const godot_vector3 *p_n); - godot_vector3 (*godot_vector3_bounce)(const godot_vector3 *p_self, const godot_vector3 *p_n); - godot_vector3 (*godot_vector3_reflect)(const godot_vector3 *p_self, const godot_vector3 *p_n); - godot_vector3 (*godot_vector3_operator_add)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_operator_subtract)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_operator_multiply_vector)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_operator_multiply_scalar)(const godot_vector3 *p_self, const godot_real p_b); - godot_vector3 (*godot_vector3_operator_divide_vector)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_operator_divide_scalar)(const godot_vector3 *p_self, const godot_real p_b); - godot_bool (*godot_vector3_operator_equal)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_bool (*godot_vector3_operator_less)(const godot_vector3 *p_self, const godot_vector3 *p_b); - godot_vector3 (*godot_vector3_operator_neg)(const godot_vector3 *p_self); - void (*godot_vector3_set_axis)(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val); - godot_real (*godot_vector3_get_axis)(const godot_vector3 *p_self, const godot_vector3_axis p_axis); - void (*godot_pool_byte_array_new)(godot_pool_byte_array *r_dest); - void (*godot_pool_byte_array_new_copy)(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); - void (*godot_pool_byte_array_new_with_array)(godot_pool_byte_array *r_dest, const godot_array *p_a); - void (*godot_pool_byte_array_append)(godot_pool_byte_array *p_self, const uint8_t p_data); - void (*godot_pool_byte_array_append_array)(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); - godot_error (*godot_pool_byte_array_insert)(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); - void (*godot_pool_byte_array_invert)(godot_pool_byte_array *p_self); - void (*godot_pool_byte_array_push_back)(godot_pool_byte_array *p_self, const uint8_t p_data); - void (*godot_pool_byte_array_remove)(godot_pool_byte_array *p_self, const godot_int p_idx); - void (*godot_pool_byte_array_resize)(godot_pool_byte_array *p_self, const godot_int p_size); - godot_pool_byte_array_read_access *(*godot_pool_byte_array_read)(const godot_pool_byte_array *p_self); - godot_pool_byte_array_write_access *(*godot_pool_byte_array_write)(godot_pool_byte_array *p_self); - void (*godot_pool_byte_array_set)(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); - uint8_t (*godot_pool_byte_array_get)(const godot_pool_byte_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_byte_array_size)(const godot_pool_byte_array *p_self); - void (*godot_pool_byte_array_destroy)(godot_pool_byte_array *p_self); - void (*godot_pool_int_array_new)(godot_pool_int_array *r_dest); - void (*godot_pool_int_array_new_copy)(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); - void (*godot_pool_int_array_new_with_array)(godot_pool_int_array *r_dest, const godot_array *p_a); - void (*godot_pool_int_array_append)(godot_pool_int_array *p_self, const godot_int p_data); - void (*godot_pool_int_array_append_array)(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); - godot_error (*godot_pool_int_array_insert)(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); - void (*godot_pool_int_array_invert)(godot_pool_int_array *p_self); - void (*godot_pool_int_array_push_back)(godot_pool_int_array *p_self, const godot_int p_data); - void (*godot_pool_int_array_remove)(godot_pool_int_array *p_self, const godot_int p_idx); - void (*godot_pool_int_array_resize)(godot_pool_int_array *p_self, const godot_int p_size); - godot_pool_int_array_read_access *(*godot_pool_int_array_read)(const godot_pool_int_array *p_self); - godot_pool_int_array_write_access *(*godot_pool_int_array_write)(godot_pool_int_array *p_self); - void (*godot_pool_int_array_set)(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); - godot_int (*godot_pool_int_array_get)(const godot_pool_int_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_int_array_size)(const godot_pool_int_array *p_self); - void (*godot_pool_int_array_destroy)(godot_pool_int_array *p_self); - void (*godot_pool_real_array_new)(godot_pool_real_array *r_dest); - void (*godot_pool_real_array_new_copy)(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); - void (*godot_pool_real_array_new_with_array)(godot_pool_real_array *r_dest, const godot_array *p_a); - void (*godot_pool_real_array_append)(godot_pool_real_array *p_self, const godot_real p_data); - void (*godot_pool_real_array_append_array)(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); - godot_error (*godot_pool_real_array_insert)(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); - void (*godot_pool_real_array_invert)(godot_pool_real_array *p_self); - void (*godot_pool_real_array_push_back)(godot_pool_real_array *p_self, const godot_real p_data); - void (*godot_pool_real_array_remove)(godot_pool_real_array *p_self, const godot_int p_idx); - void (*godot_pool_real_array_resize)(godot_pool_real_array *p_self, const godot_int p_size); - godot_pool_real_array_read_access *(*godot_pool_real_array_read)(const godot_pool_real_array *p_self); - godot_pool_real_array_write_access *(*godot_pool_real_array_write)(godot_pool_real_array *p_self); - void (*godot_pool_real_array_set)(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); - godot_real (*godot_pool_real_array_get)(const godot_pool_real_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_real_array_size)(const godot_pool_real_array *p_self); - void (*godot_pool_real_array_destroy)(godot_pool_real_array *p_self); - void (*godot_pool_string_array_new)(godot_pool_string_array *r_dest); - void (*godot_pool_string_array_new_copy)(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); - void (*godot_pool_string_array_new_with_array)(godot_pool_string_array *r_dest, const godot_array *p_a); - void (*godot_pool_string_array_append)(godot_pool_string_array *p_self, const godot_string *p_data); - void (*godot_pool_string_array_append_array)(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); - godot_error (*godot_pool_string_array_insert)(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); - void (*godot_pool_string_array_invert)(godot_pool_string_array *p_self); - void (*godot_pool_string_array_push_back)(godot_pool_string_array *p_self, const godot_string *p_data); - void (*godot_pool_string_array_remove)(godot_pool_string_array *p_self, const godot_int p_idx); - void (*godot_pool_string_array_resize)(godot_pool_string_array *p_self, const godot_int p_size); - godot_pool_string_array_read_access *(*godot_pool_string_array_read)(const godot_pool_string_array *p_self); - godot_pool_string_array_write_access *(*godot_pool_string_array_write)(godot_pool_string_array *p_self); - void (*godot_pool_string_array_set)(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); - godot_string (*godot_pool_string_array_get)(const godot_pool_string_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_string_array_size)(const godot_pool_string_array *p_self); - void (*godot_pool_string_array_destroy)(godot_pool_string_array *p_self); - void (*godot_pool_vector2_array_new)(godot_pool_vector2_array *r_dest); - void (*godot_pool_vector2_array_new_copy)(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); - void (*godot_pool_vector2_array_new_with_array)(godot_pool_vector2_array *r_dest, const godot_array *p_a); - void (*godot_pool_vector2_array_append)(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); - void (*godot_pool_vector2_array_append_array)(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); - godot_error (*godot_pool_vector2_array_insert)(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); - void (*godot_pool_vector2_array_invert)(godot_pool_vector2_array *p_self); - void (*godot_pool_vector2_array_push_back)(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); - void (*godot_pool_vector2_array_remove)(godot_pool_vector2_array *p_self, const godot_int p_idx); - void (*godot_pool_vector2_array_resize)(godot_pool_vector2_array *p_self, const godot_int p_size); - godot_pool_vector2_array_read_access *(*godot_pool_vector2_array_read)(const godot_pool_vector2_array *p_self); - godot_pool_vector2_array_write_access *(*godot_pool_vector2_array_write)(godot_pool_vector2_array *p_self); - void (*godot_pool_vector2_array_set)(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); - godot_vector2 (*godot_pool_vector2_array_get)(const godot_pool_vector2_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_vector2_array_size)(const godot_pool_vector2_array *p_self); - void (*godot_pool_vector2_array_destroy)(godot_pool_vector2_array *p_self); - void (*godot_pool_vector3_array_new)(godot_pool_vector3_array *r_dest); - void (*godot_pool_vector3_array_new_copy)(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); - void (*godot_pool_vector3_array_new_with_array)(godot_pool_vector3_array *r_dest, const godot_array *p_a); - void (*godot_pool_vector3_array_append)(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); - void (*godot_pool_vector3_array_append_array)(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); - godot_error (*godot_pool_vector3_array_insert)(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); - void (*godot_pool_vector3_array_invert)(godot_pool_vector3_array *p_self); - void (*godot_pool_vector3_array_push_back)(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); - void (*godot_pool_vector3_array_remove)(godot_pool_vector3_array *p_self, const godot_int p_idx); - void (*godot_pool_vector3_array_resize)(godot_pool_vector3_array *p_self, const godot_int p_size); - godot_pool_vector3_array_read_access *(*godot_pool_vector3_array_read)(const godot_pool_vector3_array *p_self); - godot_pool_vector3_array_write_access *(*godot_pool_vector3_array_write)(godot_pool_vector3_array *p_self); - void (*godot_pool_vector3_array_set)(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); - godot_vector3 (*godot_pool_vector3_array_get)(const godot_pool_vector3_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_vector3_array_size)(const godot_pool_vector3_array *p_self); - void (*godot_pool_vector3_array_destroy)(godot_pool_vector3_array *p_self); - void (*godot_pool_color_array_new)(godot_pool_color_array *r_dest); - void (*godot_pool_color_array_new_copy)(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); - void (*godot_pool_color_array_new_with_array)(godot_pool_color_array *r_dest, const godot_array *p_a); - void (*godot_pool_color_array_append)(godot_pool_color_array *p_self, const godot_color *p_data); - void (*godot_pool_color_array_append_array)(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); - godot_error (*godot_pool_color_array_insert)(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); - void (*godot_pool_color_array_invert)(godot_pool_color_array *p_self); - void (*godot_pool_color_array_push_back)(godot_pool_color_array *p_self, const godot_color *p_data); - void (*godot_pool_color_array_remove)(godot_pool_color_array *p_self, const godot_int p_idx); - void (*godot_pool_color_array_resize)(godot_pool_color_array *p_self, const godot_int p_size); - godot_pool_color_array_read_access *(*godot_pool_color_array_read)(const godot_pool_color_array *p_self); - godot_pool_color_array_write_access *(*godot_pool_color_array_write)(godot_pool_color_array *p_self); - void (*godot_pool_color_array_set)(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); - godot_color (*godot_pool_color_array_get)(const godot_pool_color_array *p_self, const godot_int p_idx); - godot_int (*godot_pool_color_array_size)(const godot_pool_color_array *p_self); - void (*godot_pool_color_array_destroy)(godot_pool_color_array *p_self); - godot_pool_byte_array_read_access *(*godot_pool_byte_array_read_access_copy)(const godot_pool_byte_array_read_access *p_read); - const uint8_t *(*godot_pool_byte_array_read_access_ptr)(const godot_pool_byte_array_read_access *p_read); - void (*godot_pool_byte_array_read_access_operator_assign)(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other); - void (*godot_pool_byte_array_read_access_destroy)(godot_pool_byte_array_read_access *p_read); - godot_pool_int_array_read_access *(*godot_pool_int_array_read_access_copy)(const godot_pool_int_array_read_access *p_read); - const godot_int *(*godot_pool_int_array_read_access_ptr)(const godot_pool_int_array_read_access *p_read); - void (*godot_pool_int_array_read_access_operator_assign)(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other); - void (*godot_pool_int_array_read_access_destroy)(godot_pool_int_array_read_access *p_read); - godot_pool_real_array_read_access *(*godot_pool_real_array_read_access_copy)(const godot_pool_real_array_read_access *p_read); - const godot_real *(*godot_pool_real_array_read_access_ptr)(const godot_pool_real_array_read_access *p_read); - void (*godot_pool_real_array_read_access_operator_assign)(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other); - void (*godot_pool_real_array_read_access_destroy)(godot_pool_real_array_read_access *p_read); - godot_pool_string_array_read_access *(*godot_pool_string_array_read_access_copy)(const godot_pool_string_array_read_access *p_read); - const godot_string *(*godot_pool_string_array_read_access_ptr)(const godot_pool_string_array_read_access *p_read); - void (*godot_pool_string_array_read_access_operator_assign)(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other); - void (*godot_pool_string_array_read_access_destroy)(godot_pool_string_array_read_access *p_read); - godot_pool_vector2_array_read_access *(*godot_pool_vector2_array_read_access_copy)(const godot_pool_vector2_array_read_access *p_read); - const godot_vector2 *(*godot_pool_vector2_array_read_access_ptr)(const godot_pool_vector2_array_read_access *p_read); - void (*godot_pool_vector2_array_read_access_operator_assign)(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other); - void (*godot_pool_vector2_array_read_access_destroy)(godot_pool_vector2_array_read_access *p_read); - godot_pool_vector3_array_read_access *(*godot_pool_vector3_array_read_access_copy)(const godot_pool_vector3_array_read_access *p_read); - const godot_vector3 *(*godot_pool_vector3_array_read_access_ptr)(const godot_pool_vector3_array_read_access *p_read); - void (*godot_pool_vector3_array_read_access_operator_assign)(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other); - void (*godot_pool_vector3_array_read_access_destroy)(godot_pool_vector3_array_read_access *p_read); - godot_pool_color_array_read_access *(*godot_pool_color_array_read_access_copy)(const godot_pool_color_array_read_access *p_read); - const godot_color *(*godot_pool_color_array_read_access_ptr)(const godot_pool_color_array_read_access *p_read); - void (*godot_pool_color_array_read_access_operator_assign)(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other); - void (*godot_pool_color_array_read_access_destroy)(godot_pool_color_array_read_access *p_read); - godot_pool_byte_array_write_access *(*godot_pool_byte_array_write_access_copy)(const godot_pool_byte_array_write_access *p_write); - uint8_t *(*godot_pool_byte_array_write_access_ptr)(const godot_pool_byte_array_write_access *p_write); - void (*godot_pool_byte_array_write_access_operator_assign)(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other); - void (*godot_pool_byte_array_write_access_destroy)(godot_pool_byte_array_write_access *p_write); - godot_pool_int_array_write_access *(*godot_pool_int_array_write_access_copy)(const godot_pool_int_array_write_access *p_write); - godot_int *(*godot_pool_int_array_write_access_ptr)(const godot_pool_int_array_write_access *p_write); - void (*godot_pool_int_array_write_access_operator_assign)(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other); - void (*godot_pool_int_array_write_access_destroy)(godot_pool_int_array_write_access *p_write); - godot_pool_real_array_write_access *(*godot_pool_real_array_write_access_copy)(const godot_pool_real_array_write_access *p_write); - godot_real *(*godot_pool_real_array_write_access_ptr)(const godot_pool_real_array_write_access *p_write); - void (*godot_pool_real_array_write_access_operator_assign)(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other); - void (*godot_pool_real_array_write_access_destroy)(godot_pool_real_array_write_access *p_write); - godot_pool_string_array_write_access *(*godot_pool_string_array_write_access_copy)(const godot_pool_string_array_write_access *p_write); - godot_string *(*godot_pool_string_array_write_access_ptr)(const godot_pool_string_array_write_access *p_write); - void (*godot_pool_string_array_write_access_operator_assign)(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other); - void (*godot_pool_string_array_write_access_destroy)(godot_pool_string_array_write_access *p_write); - godot_pool_vector2_array_write_access *(*godot_pool_vector2_array_write_access_copy)(const godot_pool_vector2_array_write_access *p_write); - godot_vector2 *(*godot_pool_vector2_array_write_access_ptr)(const godot_pool_vector2_array_write_access *p_write); - void (*godot_pool_vector2_array_write_access_operator_assign)(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other); - void (*godot_pool_vector2_array_write_access_destroy)(godot_pool_vector2_array_write_access *p_write); - godot_pool_vector3_array_write_access *(*godot_pool_vector3_array_write_access_copy)(const godot_pool_vector3_array_write_access *p_write); - godot_vector3 *(*godot_pool_vector3_array_write_access_ptr)(const godot_pool_vector3_array_write_access *p_write); - void (*godot_pool_vector3_array_write_access_operator_assign)(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other); - void (*godot_pool_vector3_array_write_access_destroy)(godot_pool_vector3_array_write_access *p_write); - godot_pool_color_array_write_access *(*godot_pool_color_array_write_access_copy)(const godot_pool_color_array_write_access *p_write); - godot_color *(*godot_pool_color_array_write_access_ptr)(const godot_pool_color_array_write_access *p_write); - void (*godot_pool_color_array_write_access_operator_assign)(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other); - void (*godot_pool_color_array_write_access_destroy)(godot_pool_color_array_write_access *p_write); - void (*godot_array_new)(godot_array *r_dest); - void (*godot_array_new_copy)(godot_array *r_dest, const godot_array *p_src); - void (*godot_array_new_pool_color_array)(godot_array *r_dest, const godot_pool_color_array *p_pca); - void (*godot_array_new_pool_vector3_array)(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); - void (*godot_array_new_pool_vector2_array)(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); - void (*godot_array_new_pool_string_array)(godot_array *r_dest, const godot_pool_string_array *p_psa); - void (*godot_array_new_pool_real_array)(godot_array *r_dest, const godot_pool_real_array *p_pra); - void (*godot_array_new_pool_int_array)(godot_array *r_dest, const godot_pool_int_array *p_pia); - void (*godot_array_new_pool_byte_array)(godot_array *r_dest, const godot_pool_byte_array *p_pba); - void (*godot_array_set)(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); - godot_variant (*godot_array_get)(const godot_array *p_self, const godot_int p_idx); - godot_variant *(*godot_array_operator_index)(godot_array *p_self, const godot_int p_idx); - const godot_variant *(*godot_array_operator_index_const)(const godot_array *p_self, const godot_int p_idx); - void (*godot_array_append)(godot_array *p_self, const godot_variant *p_value); - void (*godot_array_clear)(godot_array *p_self); - godot_int (*godot_array_count)(const godot_array *p_self, const godot_variant *p_value); - godot_bool (*godot_array_empty)(const godot_array *p_self); - void (*godot_array_erase)(godot_array *p_self, const godot_variant *p_value); - godot_variant (*godot_array_front)(const godot_array *p_self); - godot_variant (*godot_array_back)(const godot_array *p_self); - godot_int (*godot_array_find)(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - godot_int (*godot_array_find_last)(const godot_array *p_self, const godot_variant *p_what); - godot_bool (*godot_array_has)(const godot_array *p_self, const godot_variant *p_value); - godot_int (*godot_array_hash)(const godot_array *p_self); - void (*godot_array_insert)(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); - void (*godot_array_invert)(godot_array *p_self); - godot_variant (*godot_array_pop_back)(godot_array *p_self); - godot_variant (*godot_array_pop_front)(godot_array *p_self); - void (*godot_array_push_back)(godot_array *p_self, const godot_variant *p_value); - void (*godot_array_push_front)(godot_array *p_self, const godot_variant *p_value); - void (*godot_array_remove)(godot_array *p_self, const godot_int p_idx); - void (*godot_array_resize)(godot_array *p_self, const godot_int p_size); - godot_int (*godot_array_rfind)(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - godot_int (*godot_array_size)(const godot_array *p_self); - void (*godot_array_sort)(godot_array *p_self); - void (*godot_array_sort_custom)(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); - godot_int (*godot_array_bsearch)(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before); - godot_int (*godot_array_bsearch_custom)(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before); - void (*godot_array_destroy)(godot_array *p_self); - void (*godot_dictionary_new)(godot_dictionary *r_dest); - void (*godot_dictionary_new_copy)(godot_dictionary *r_dest, const godot_dictionary *p_src); - void (*godot_dictionary_destroy)(godot_dictionary *p_self); - godot_int (*godot_dictionary_size)(const godot_dictionary *p_self); - godot_bool (*godot_dictionary_empty)(const godot_dictionary *p_self); - void (*godot_dictionary_clear)(godot_dictionary *p_self); - godot_bool (*godot_dictionary_has)(const godot_dictionary *p_self, const godot_variant *p_key); - godot_bool (*godot_dictionary_has_all)(const godot_dictionary *p_self, const godot_array *p_keys); - void (*godot_dictionary_erase)(godot_dictionary *p_self, const godot_variant *p_key); - godot_int (*godot_dictionary_hash)(const godot_dictionary *p_self); - godot_array (*godot_dictionary_keys)(const godot_dictionary *p_self); - godot_array (*godot_dictionary_values)(const godot_dictionary *p_self); - godot_variant (*godot_dictionary_get)(const godot_dictionary *p_self, const godot_variant *p_key); - void (*godot_dictionary_set)(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); - godot_variant *(*godot_dictionary_operator_index)(godot_dictionary *p_self, const godot_variant *p_key); - const godot_variant *(*godot_dictionary_operator_index_const)(const godot_dictionary *p_self, const godot_variant *p_key); - godot_variant *(*godot_dictionary_next)(const godot_dictionary *p_self, const godot_variant *p_key); - godot_bool (*godot_dictionary_operator_equal)(const godot_dictionary *p_self, const godot_dictionary *p_b); - godot_string (*godot_dictionary_to_json)(const godot_dictionary *p_self); - void (*godot_node_path_new)(godot_node_path *r_dest, const godot_string *p_from); - void (*godot_node_path_new_copy)(godot_node_path *r_dest, const godot_node_path *p_src); - void (*godot_node_path_destroy)(godot_node_path *p_self); - godot_string (*godot_node_path_as_string)(const godot_node_path *p_self); - godot_bool (*godot_node_path_is_absolute)(const godot_node_path *p_self); - godot_int (*godot_node_path_get_name_count)(const godot_node_path *p_self); - godot_string (*godot_node_path_get_name)(const godot_node_path *p_self, const godot_int p_idx); - godot_int (*godot_node_path_get_subname_count)(const godot_node_path *p_self); - godot_string (*godot_node_path_get_subname)(const godot_node_path *p_self, const godot_int p_idx); - godot_string (*godot_node_path_get_concatenated_subnames)(const godot_node_path *p_self); - godot_bool (*godot_node_path_is_empty)(const godot_node_path *p_self); - godot_bool (*godot_node_path_operator_equal)(const godot_node_path *p_self, const godot_node_path *p_b); - void (*godot_plane_new_with_reals)(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d); - void (*godot_plane_new_with_vectors)(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3); - void (*godot_plane_new_with_normal)(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d); - godot_string (*godot_plane_as_string)(const godot_plane *p_self); - godot_plane (*godot_plane_normalized)(const godot_plane *p_self); - godot_vector3 (*godot_plane_center)(const godot_plane *p_self); - godot_vector3 (*godot_plane_get_any_point)(const godot_plane *p_self); - godot_bool (*godot_plane_is_point_over)(const godot_plane *p_self, const godot_vector3 *p_point); - godot_real (*godot_plane_distance_to)(const godot_plane *p_self, const godot_vector3 *p_point); - godot_bool (*godot_plane_has_point)(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon); - godot_vector3 (*godot_plane_project)(const godot_plane *p_self, const godot_vector3 *p_point); - godot_bool (*godot_plane_intersect_3)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c); - godot_bool (*godot_plane_intersects_ray)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir); - godot_bool (*godot_plane_intersects_segment)(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end); - godot_plane (*godot_plane_operator_neg)(const godot_plane *p_self); - godot_bool (*godot_plane_operator_equal)(const godot_plane *p_self, const godot_plane *p_b); - void (*godot_plane_set_normal)(godot_plane *p_self, const godot_vector3 *p_normal); - godot_vector3 (*godot_plane_get_normal)(const godot_plane *p_self); - godot_real (*godot_plane_get_d)(const godot_plane *p_self); - void (*godot_plane_set_d)(godot_plane *p_self, const godot_real p_d); - void (*godot_rect2_new_with_position_and_size)(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); - void (*godot_rect2_new)(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); - godot_string (*godot_rect2_as_string)(const godot_rect2 *p_self); - godot_real (*godot_rect2_get_area)(const godot_rect2 *p_self); - godot_bool (*godot_rect2_intersects)(const godot_rect2 *p_self, const godot_rect2 *p_b); - godot_bool (*godot_rect2_encloses)(const godot_rect2 *p_self, const godot_rect2 *p_b); - godot_bool (*godot_rect2_has_no_area)(const godot_rect2 *p_self); - godot_rect2 (*godot_rect2_clip)(const godot_rect2 *p_self, const godot_rect2 *p_b); - godot_rect2 (*godot_rect2_merge)(const godot_rect2 *p_self, const godot_rect2 *p_b); - godot_bool (*godot_rect2_has_point)(const godot_rect2 *p_self, const godot_vector2 *p_point); - godot_rect2 (*godot_rect2_grow)(const godot_rect2 *p_self, const godot_real p_by); - godot_rect2 (*godot_rect2_expand)(const godot_rect2 *p_self, const godot_vector2 *p_to); - godot_bool (*godot_rect2_operator_equal)(const godot_rect2 *p_self, const godot_rect2 *p_b); - godot_vector2 (*godot_rect2_get_position)(const godot_rect2 *p_self); - godot_vector2 (*godot_rect2_get_size)(const godot_rect2 *p_self); - void (*godot_rect2_set_position)(godot_rect2 *p_self, const godot_vector2 *p_pos); - void (*godot_rect2_set_size)(godot_rect2 *p_self, const godot_vector2 *p_size); - void (*godot_aabb_new)(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); - godot_vector3 (*godot_aabb_get_position)(const godot_aabb *p_self); - void (*godot_aabb_set_position)(const godot_aabb *p_self, const godot_vector3 *p_v); - godot_vector3 (*godot_aabb_get_size)(const godot_aabb *p_self); - void (*godot_aabb_set_size)(const godot_aabb *p_self, const godot_vector3 *p_v); - godot_string (*godot_aabb_as_string)(const godot_aabb *p_self); - godot_real (*godot_aabb_get_area)(const godot_aabb *p_self); - godot_bool (*godot_aabb_has_no_area)(const godot_aabb *p_self); - godot_bool (*godot_aabb_has_no_surface)(const godot_aabb *p_self); - godot_bool (*godot_aabb_intersects)(const godot_aabb *p_self, const godot_aabb *p_with); - godot_bool (*godot_aabb_encloses)(const godot_aabb *p_self, const godot_aabb *p_with); - godot_aabb (*godot_aabb_merge)(const godot_aabb *p_self, const godot_aabb *p_with); - godot_aabb (*godot_aabb_intersection)(const godot_aabb *p_self, const godot_aabb *p_with); - godot_bool (*godot_aabb_intersects_plane)(const godot_aabb *p_self, const godot_plane *p_plane); - godot_bool (*godot_aabb_intersects_segment)(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); - godot_bool (*godot_aabb_has_point)(const godot_aabb *p_self, const godot_vector3 *p_point); - godot_vector3 (*godot_aabb_get_support)(const godot_aabb *p_self, const godot_vector3 *p_dir); - godot_vector3 (*godot_aabb_get_longest_axis)(const godot_aabb *p_self); - godot_int (*godot_aabb_get_longest_axis_index)(const godot_aabb *p_self); - godot_real (*godot_aabb_get_longest_axis_size)(const godot_aabb *p_self); - godot_vector3 (*godot_aabb_get_shortest_axis)(const godot_aabb *p_self); - godot_int (*godot_aabb_get_shortest_axis_index)(const godot_aabb *p_self); - godot_real (*godot_aabb_get_shortest_axis_size)(const godot_aabb *p_self); - godot_aabb (*godot_aabb_expand)(const godot_aabb *p_self, const godot_vector3 *p_to_point); - godot_aabb (*godot_aabb_grow)(const godot_aabb *p_self, const godot_real p_by); - godot_vector3 (*godot_aabb_get_endpoint)(const godot_aabb *p_self, const godot_int p_idx); - godot_bool (*godot_aabb_operator_equal)(const godot_aabb *p_self, const godot_aabb *p_b); - void (*godot_rid_new)(godot_rid *r_dest); - godot_int (*godot_rid_get_id)(const godot_rid *p_self); - void (*godot_rid_new_with_resource)(godot_rid *r_dest, const godot_object *p_from); - godot_bool (*godot_rid_operator_equal)(const godot_rid *p_self, const godot_rid *p_b); - godot_bool (*godot_rid_operator_less)(const godot_rid *p_self, const godot_rid *p_b); - void (*godot_transform_new_with_axis_origin)(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); - void (*godot_transform_new)(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); - godot_basis (*godot_transform_get_basis)(const godot_transform *p_self); - void (*godot_transform_set_basis)(godot_transform *p_self, const godot_basis *p_v); - godot_vector3 (*godot_transform_get_origin)(const godot_transform *p_self); - void (*godot_transform_set_origin)(godot_transform *p_self, const godot_vector3 *p_v); - godot_string (*godot_transform_as_string)(const godot_transform *p_self); - godot_transform (*godot_transform_inverse)(const godot_transform *p_self); - godot_transform (*godot_transform_affine_inverse)(const godot_transform *p_self); - godot_transform (*godot_transform_orthonormalized)(const godot_transform *p_self); - godot_transform (*godot_transform_rotated)(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - godot_transform (*godot_transform_scaled)(const godot_transform *p_self, const godot_vector3 *p_scale); - godot_transform (*godot_transform_translated)(const godot_transform *p_self, const godot_vector3 *p_ofs); - godot_transform (*godot_transform_looking_at)(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up); - godot_plane (*godot_transform_xform_plane)(const godot_transform *p_self, const godot_plane *p_v); - godot_plane (*godot_transform_xform_inv_plane)(const godot_transform *p_self, const godot_plane *p_v); - void (*godot_transform_new_identity)(godot_transform *r_dest); - godot_bool (*godot_transform_operator_equal)(const godot_transform *p_self, const godot_transform *p_b); - godot_transform (*godot_transform_operator_multiply)(const godot_transform *p_self, const godot_transform *p_b); - godot_vector3 (*godot_transform_xform_vector3)(const godot_transform *p_self, const godot_vector3 *p_v); - godot_vector3 (*godot_transform_xform_inv_vector3)(const godot_transform *p_self, const godot_vector3 *p_v); - godot_aabb (*godot_transform_xform_aabb)(const godot_transform *p_self, const godot_aabb *p_v); - godot_aabb (*godot_transform_xform_inv_aabb)(const godot_transform *p_self, const godot_aabb *p_v); - void (*godot_transform2d_new)(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos); - void (*godot_transform2d_new_axis_origin)(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin); - godot_string (*godot_transform2d_as_string)(const godot_transform2d *p_self); - godot_transform2d (*godot_transform2d_inverse)(const godot_transform2d *p_self); - godot_transform2d (*godot_transform2d_affine_inverse)(const godot_transform2d *p_self); - godot_real (*godot_transform2d_get_rotation)(const godot_transform2d *p_self); - godot_vector2 (*godot_transform2d_get_origin)(const godot_transform2d *p_self); - godot_vector2 (*godot_transform2d_get_scale)(const godot_transform2d *p_self); - godot_transform2d (*godot_transform2d_orthonormalized)(const godot_transform2d *p_self); - godot_transform2d (*godot_transform2d_rotated)(const godot_transform2d *p_self, const godot_real p_phi); - godot_transform2d (*godot_transform2d_scaled)(const godot_transform2d *p_self, const godot_vector2 *p_scale); - godot_transform2d (*godot_transform2d_translated)(const godot_transform2d *p_self, const godot_vector2 *p_offset); - godot_vector2 (*godot_transform2d_xform_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); - godot_vector2 (*godot_transform2d_xform_inv_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); - godot_vector2 (*godot_transform2d_basis_xform_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); - godot_vector2 (*godot_transform2d_basis_xform_inv_vector2)(const godot_transform2d *p_self, const godot_vector2 *p_v); - godot_transform2d (*godot_transform2d_interpolate_with)(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c); - godot_bool (*godot_transform2d_operator_equal)(const godot_transform2d *p_self, const godot_transform2d *p_b); - godot_transform2d (*godot_transform2d_operator_multiply)(const godot_transform2d *p_self, const godot_transform2d *p_b); - void (*godot_transform2d_new_identity)(godot_transform2d *r_dest); - godot_rect2 (*godot_transform2d_xform_rect2)(const godot_transform2d *p_self, const godot_rect2 *p_v); - godot_rect2 (*godot_transform2d_xform_inv_rect2)(const godot_transform2d *p_self, const godot_rect2 *p_v); - godot_variant_type (*godot_variant_get_type)(const godot_variant *p_v); - void (*godot_variant_new_copy)(godot_variant *r_dest, const godot_variant *p_src); - void (*godot_variant_new_nil)(godot_variant *r_dest); - void (*godot_variant_new_bool)(godot_variant *r_dest, const godot_bool p_b); - void (*godot_variant_new_uint)(godot_variant *r_dest, const uint64_t p_i); - void (*godot_variant_new_int)(godot_variant *r_dest, const int64_t p_i); - void (*godot_variant_new_real)(godot_variant *r_dest, const double p_r); - void (*godot_variant_new_string)(godot_variant *r_dest, const godot_string *p_s); - void (*godot_variant_new_vector2)(godot_variant *r_dest, const godot_vector2 *p_v2); - void (*godot_variant_new_rect2)(godot_variant *r_dest, const godot_rect2 *p_rect2); - void (*godot_variant_new_vector3)(godot_variant *r_dest, const godot_vector3 *p_v3); - void (*godot_variant_new_transform2d)(godot_variant *r_dest, const godot_transform2d *p_t2d); - void (*godot_variant_new_plane)(godot_variant *r_dest, const godot_plane *p_plane); - void (*godot_variant_new_quat)(godot_variant *r_dest, const godot_quat *p_quat); - void (*godot_variant_new_aabb)(godot_variant *r_dest, const godot_aabb *p_aabb); - void (*godot_variant_new_basis)(godot_variant *r_dest, const godot_basis *p_basis); - void (*godot_variant_new_transform)(godot_variant *r_dest, const godot_transform *p_trans); - void (*godot_variant_new_color)(godot_variant *r_dest, const godot_color *p_color); - void (*godot_variant_new_node_path)(godot_variant *r_dest, const godot_node_path *p_np); - void (*godot_variant_new_rid)(godot_variant *r_dest, const godot_rid *p_rid); - void (*godot_variant_new_object)(godot_variant *r_dest, const godot_object *p_obj); - void (*godot_variant_new_dictionary)(godot_variant *r_dest, const godot_dictionary *p_dict); - void (*godot_variant_new_array)(godot_variant *r_dest, const godot_array *p_arr); - void (*godot_variant_new_pool_byte_array)(godot_variant *r_dest, const godot_pool_byte_array *p_pba); - void (*godot_variant_new_pool_int_array)(godot_variant *r_dest, const godot_pool_int_array *p_pia); - void (*godot_variant_new_pool_real_array)(godot_variant *r_dest, const godot_pool_real_array *p_pra); - void (*godot_variant_new_pool_string_array)(godot_variant *r_dest, const godot_pool_string_array *p_psa); - void (*godot_variant_new_pool_vector2_array)(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a); - void (*godot_variant_new_pool_vector3_array)(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a); - void (*godot_variant_new_pool_color_array)(godot_variant *r_dest, const godot_pool_color_array *p_pca); - godot_bool (*godot_variant_as_bool)(const godot_variant *p_self); - uint64_t (*godot_variant_as_uint)(const godot_variant *p_self); - int64_t (*godot_variant_as_int)(const godot_variant *p_self); - double (*godot_variant_as_real)(const godot_variant *p_self); - godot_string (*godot_variant_as_string)(const godot_variant *p_self); - godot_vector2 (*godot_variant_as_vector2)(const godot_variant *p_self); - godot_rect2 (*godot_variant_as_rect2)(const godot_variant *p_self); - godot_vector3 (*godot_variant_as_vector3)(const godot_variant *p_self); - godot_transform2d (*godot_variant_as_transform2d)(const godot_variant *p_self); - godot_plane (*godot_variant_as_plane)(const godot_variant *p_self); - godot_quat (*godot_variant_as_quat)(const godot_variant *p_self); - godot_aabb (*godot_variant_as_aabb)(const godot_variant *p_self); - godot_basis (*godot_variant_as_basis)(const godot_variant *p_self); - godot_transform (*godot_variant_as_transform)(const godot_variant *p_self); - godot_color (*godot_variant_as_color)(const godot_variant *p_self); - godot_node_path (*godot_variant_as_node_path)(const godot_variant *p_self); - godot_rid (*godot_variant_as_rid)(const godot_variant *p_self); - godot_object *(*godot_variant_as_object)(const godot_variant *p_self); - godot_dictionary (*godot_variant_as_dictionary)(const godot_variant *p_self); - godot_array (*godot_variant_as_array)(const godot_variant *p_self); - godot_pool_byte_array (*godot_variant_as_pool_byte_array)(const godot_variant *p_self); - godot_pool_int_array (*godot_variant_as_pool_int_array)(const godot_variant *p_self); - godot_pool_real_array (*godot_variant_as_pool_real_array)(const godot_variant *p_self); - godot_pool_string_array (*godot_variant_as_pool_string_array)(const godot_variant *p_self); - godot_pool_vector2_array (*godot_variant_as_pool_vector2_array)(const godot_variant *p_self); - godot_pool_vector3_array (*godot_variant_as_pool_vector3_array)(const godot_variant *p_self); - godot_pool_color_array (*godot_variant_as_pool_color_array)(const godot_variant *p_self); - godot_variant (*godot_variant_call)(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error); - godot_bool (*godot_variant_has_method)(const godot_variant *p_self, const godot_string *p_method); - godot_bool (*godot_variant_operator_equal)(const godot_variant *p_self, const godot_variant *p_other); - godot_bool (*godot_variant_operator_less)(const godot_variant *p_self, const godot_variant *p_other); - godot_bool (*godot_variant_hash_compare)(const godot_variant *p_self, const godot_variant *p_other); - godot_bool (*godot_variant_booleanize)(const godot_variant *p_self); - void (*godot_variant_destroy)(godot_variant *p_self); - godot_int (*godot_char_string_length)(const godot_char_string *p_cs); - const char *(*godot_char_string_get_data)(const godot_char_string *p_cs); - void (*godot_char_string_destroy)(godot_char_string *p_cs); - void (*godot_string_new)(godot_string *r_dest); - void (*godot_string_new_copy)(godot_string *r_dest, const godot_string *p_src); - void (*godot_string_new_with_wide_string)(godot_string *r_dest, const wchar_t *p_contents, const int p_size); - const wchar_t *(*godot_string_operator_index)(godot_string *p_self, const godot_int p_idx); - wchar_t (*godot_string_operator_index_const)(const godot_string *p_self, const godot_int p_idx); - const wchar_t *(*godot_string_wide_str)(const godot_string *p_self); - godot_bool (*godot_string_operator_equal)(const godot_string *p_self, const godot_string *p_b); - godot_bool (*godot_string_operator_less)(const godot_string *p_self, const godot_string *p_b); - godot_string (*godot_string_operator_plus)(const godot_string *p_self, const godot_string *p_b); - godot_int (*godot_string_length)(const godot_string *p_self); - signed char (*godot_string_casecmp_to)(const godot_string *p_self, const godot_string *p_str); - signed char (*godot_string_nocasecmp_to)(const godot_string *p_self, const godot_string *p_str); - signed char (*godot_string_naturalnocasecmp_to)(const godot_string *p_self, const godot_string *p_str); - godot_bool (*godot_string_begins_with)(const godot_string *p_self, const godot_string *p_string); - godot_bool (*godot_string_begins_with_char_array)(const godot_string *p_self, const char *p_char_array); - godot_array (*godot_string_bigrams)(const godot_string *p_self); - godot_string (*godot_string_chr)(wchar_t p_character); - godot_bool (*godot_string_ends_with)(const godot_string *p_self, const godot_string *p_string); - godot_int (*godot_string_find)(const godot_string *p_self, godot_string p_what); - godot_int (*godot_string_find_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); - godot_int (*godot_string_findmk)(const godot_string *p_self, const godot_array *p_keys); - godot_int (*godot_string_findmk_from)(const godot_string *p_self, const godot_array *p_keys, godot_int p_from); - godot_int (*godot_string_findmk_from_in_place)(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key); - godot_int (*godot_string_findn)(const godot_string *p_self, godot_string p_what); - godot_int (*godot_string_findn_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); - godot_int (*godot_string_find_last)(const godot_string *p_self, godot_string p_what); - godot_string (*godot_string_format)(const godot_string *p_self, const godot_variant *p_values); - godot_string (*godot_string_format_with_custom_placeholder)(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); - godot_string (*godot_string_hex_encode_buffer)(const uint8_t *p_buffer, godot_int p_len); - godot_int (*godot_string_hex_to_int)(const godot_string *p_self); - godot_int (*godot_string_hex_to_int_without_prefix)(const godot_string *p_self); - godot_string (*godot_string_insert)(const godot_string *p_self, godot_int p_at_pos, godot_string p_string); - godot_bool (*godot_string_is_numeric)(const godot_string *p_self); - godot_bool (*godot_string_is_subsequence_of)(const godot_string *p_self, const godot_string *p_string); - godot_bool (*godot_string_is_subsequence_ofi)(const godot_string *p_self, const godot_string *p_string); - godot_string (*godot_string_lpad)(const godot_string *p_self, godot_int p_min_length); - godot_string (*godot_string_lpad_with_custom_character)(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); - godot_bool (*godot_string_match)(const godot_string *p_self, const godot_string *p_wildcard); - godot_bool (*godot_string_matchn)(const godot_string *p_self, const godot_string *p_wildcard); - godot_string (*godot_string_md5)(const uint8_t *p_md5); - godot_string (*godot_string_num)(double p_num); - godot_string (*godot_string_num_int64)(int64_t p_num, godot_int p_base); - godot_string (*godot_string_num_int64_capitalized)(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); - godot_string (*godot_string_num_real)(double p_num); - godot_string (*godot_string_num_scientific)(double p_num); - godot_string (*godot_string_num_with_decimals)(double p_num, godot_int p_decimals); - godot_string (*godot_string_pad_decimals)(const godot_string *p_self, godot_int p_digits); - godot_string (*godot_string_pad_zeros)(const godot_string *p_self, godot_int p_digits); - godot_string (*godot_string_replace_first)(const godot_string *p_self, godot_string p_key, godot_string p_with); - godot_string (*godot_string_replace)(const godot_string *p_self, godot_string p_key, godot_string p_with); - godot_string (*godot_string_replacen)(const godot_string *p_self, godot_string p_key, godot_string p_with); - godot_int (*godot_string_rfind)(const godot_string *p_self, godot_string p_what); - godot_int (*godot_string_rfindn)(const godot_string *p_self, godot_string p_what); - godot_int (*godot_string_rfind_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); - godot_int (*godot_string_rfindn_from)(const godot_string *p_self, godot_string p_what, godot_int p_from); - godot_string (*godot_string_rpad)(const godot_string *p_self, godot_int p_min_length); - godot_string (*godot_string_rpad_with_custom_character)(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); - godot_real (*godot_string_similarity)(const godot_string *p_self, const godot_string *p_string); - godot_string (*godot_string_sprintf)(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); - godot_string (*godot_string_substr)(const godot_string *p_self, godot_int p_from, godot_int p_chars); - double (*godot_string_to_double)(const godot_string *p_self); - godot_real (*godot_string_to_float)(const godot_string *p_self); - godot_int (*godot_string_to_int)(const godot_string *p_self); - godot_string (*godot_string_camelcase_to_underscore)(const godot_string *p_self); - godot_string (*godot_string_camelcase_to_underscore_lowercased)(const godot_string *p_self); - godot_string (*godot_string_capitalize)(const godot_string *p_self); - double (*godot_string_char_to_double)(const char *p_what); - godot_int (*godot_string_char_to_int)(const char *p_what); - int64_t (*godot_string_wchar_to_int)(const wchar_t *p_str); - godot_int (*godot_string_char_to_int_with_len)(const char *p_what, godot_int p_len); - int64_t (*godot_string_char_to_int64_with_len)(const wchar_t *p_str, int p_len); - int64_t (*godot_string_hex_to_int64)(const godot_string *p_self); - int64_t (*godot_string_hex_to_int64_with_prefix)(const godot_string *p_self); - int64_t (*godot_string_to_int64)(const godot_string *p_self); - double (*godot_string_unicode_char_to_double)(const wchar_t *p_str, const wchar_t **r_end); - godot_int (*godot_string_get_slice_count)(const godot_string *p_self, godot_string p_splitter); - godot_string (*godot_string_get_slice)(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); - godot_string (*godot_string_get_slicec)(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice); - godot_array (*godot_string_split)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_allow_empty)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_floats)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_floats_allows_empty)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_floats_mk)(const godot_string *p_self, const godot_array *p_splitters); - godot_array (*godot_string_split_floats_mk_allows_empty)(const godot_string *p_self, const godot_array *p_splitters); - godot_array (*godot_string_split_ints)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_ints_allows_empty)(const godot_string *p_self, const godot_string *p_splitter); - godot_array (*godot_string_split_ints_mk)(const godot_string *p_self, const godot_array *p_splitters); - godot_array (*godot_string_split_ints_mk_allows_empty)(const godot_string *p_self, const godot_array *p_splitters); - godot_array (*godot_string_split_spaces)(const godot_string *p_self); - wchar_t (*godot_string_char_lowercase)(wchar_t p_char); - wchar_t (*godot_string_char_uppercase)(wchar_t p_char); - godot_string (*godot_string_to_lower)(const godot_string *p_self); - godot_string (*godot_string_to_upper)(const godot_string *p_self); - godot_string (*godot_string_get_basename)(const godot_string *p_self); - godot_string (*godot_string_get_extension)(const godot_string *p_self); - godot_string (*godot_string_left)(const godot_string *p_self, godot_int p_pos); - wchar_t (*godot_string_ord_at)(const godot_string *p_self, godot_int p_idx); - godot_string (*godot_string_plus_file)(const godot_string *p_self, const godot_string *p_file); - godot_string (*godot_string_right)(const godot_string *p_self, godot_int p_pos); - godot_string (*godot_string_strip_edges)(const godot_string *p_self, godot_bool p_left, godot_bool p_right); - godot_string (*godot_string_strip_escapes)(const godot_string *p_self); - void (*godot_string_erase)(godot_string *p_self, godot_int p_pos, godot_int p_chars); - godot_char_string (*godot_string_ascii)(const godot_string *p_self); - godot_char_string (*godot_string_ascii_extended)(const godot_string *p_self); - godot_char_string (*godot_string_utf8)(const godot_string *p_self); - godot_bool (*godot_string_parse_utf8)(godot_string *p_self, const char *p_utf8); - godot_bool (*godot_string_parse_utf8_with_len)(godot_string *p_self, const char *p_utf8, godot_int p_len); - godot_string (*godot_string_chars_to_utf8)(const char *p_utf8); - godot_string (*godot_string_chars_to_utf8_with_len)(const char *p_utf8, godot_int p_len); - uint32_t (*godot_string_hash)(const godot_string *p_self); - uint64_t (*godot_string_hash64)(const godot_string *p_self); - uint32_t (*godot_string_hash_chars)(const char *p_cstr); - uint32_t (*godot_string_hash_chars_with_len)(const char *p_cstr, godot_int p_len); - uint32_t (*godot_string_hash_utf8_chars)(const wchar_t *p_str); - uint32_t (*godot_string_hash_utf8_chars_with_len)(const wchar_t *p_str, godot_int p_len); - godot_pool_byte_array (*godot_string_md5_buffer)(const godot_string *p_self); - godot_string (*godot_string_md5_text)(const godot_string *p_self); - godot_pool_byte_array (*godot_string_sha256_buffer)(const godot_string *p_self); - godot_string (*godot_string_sha256_text)(const godot_string *p_self); - godot_bool (*godot_string_empty)(const godot_string *p_self); - godot_string (*godot_string_get_base_dir)(const godot_string *p_self); - godot_string (*godot_string_get_file)(const godot_string *p_self); - godot_string (*godot_string_humanize_size)(uint64_t p_size); - godot_bool (*godot_string_is_abs_path)(const godot_string *p_self); - godot_bool (*godot_string_is_rel_path)(const godot_string *p_self); - godot_bool (*godot_string_is_resource_file)(const godot_string *p_self); - godot_string (*godot_string_path_to)(const godot_string *p_self, const godot_string *p_path); - godot_string (*godot_string_path_to_file)(const godot_string *p_self, const godot_string *p_path); - godot_string (*godot_string_simplify_path)(const godot_string *p_self); - godot_string (*godot_string_c_escape)(const godot_string *p_self); - godot_string (*godot_string_c_escape_multiline)(const godot_string *p_self); - godot_string (*godot_string_c_unescape)(const godot_string *p_self); - godot_string (*godot_string_http_escape)(const godot_string *p_self); - godot_string (*godot_string_http_unescape)(const godot_string *p_self); - godot_string (*godot_string_json_escape)(const godot_string *p_self); - godot_string (*godot_string_word_wrap)(const godot_string *p_self, godot_int p_chars_per_line); - godot_string (*godot_string_xml_escape)(const godot_string *p_self); - godot_string (*godot_string_xml_escape_with_quotes)(const godot_string *p_self); - godot_string (*godot_string_xml_unescape)(const godot_string *p_self); - godot_string (*godot_string_percent_decode)(const godot_string *p_self); - godot_string (*godot_string_percent_encode)(const godot_string *p_self); - godot_bool (*godot_string_is_valid_float)(const godot_string *p_self); - godot_bool (*godot_string_is_valid_hex_number)(const godot_string *p_self, godot_bool p_with_prefix); - godot_bool (*godot_string_is_valid_html_color)(const godot_string *p_self); - godot_bool (*godot_string_is_valid_identifier)(const godot_string *p_self); - godot_bool (*godot_string_is_valid_integer)(const godot_string *p_self); - godot_bool (*godot_string_is_valid_ip_address)(const godot_string *p_self); - void (*godot_string_destroy)(godot_string *p_self); - void (*godot_string_name_new)(godot_string_name *r_dest, const godot_string *p_name); - void (*godot_string_name_new_data)(godot_string_name *r_dest, const char *p_name); - godot_string (*godot_string_name_get_name)(const godot_string_name *p_self); - uint32_t (*godot_string_name_get_hash)(const godot_string_name *p_self); - const void *(*godot_string_name_get_data_unique_pointer)(const godot_string_name *p_self); - godot_bool (*godot_string_name_operator_equal)(const godot_string_name *p_self, const godot_string_name *p_other); - godot_bool (*godot_string_name_operator_less)(const godot_string_name *p_self, const godot_string_name *p_other); - void (*godot_string_name_destroy)(godot_string_name *p_self); - void (*godot_object_destroy)(godot_object *p_o); - godot_object *(*godot_global_get_singleton)(const char *p_name); - godot_method_bind *(*godot_method_bind_get_method)(const char *p_classname, const char *p_methodname); - void (*godot_method_bind_ptrcall)(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret); - godot_variant (*godot_method_bind_call)(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error); - godot_class_constructor (*godot_get_class_constructor)(const char *p_classname); - godot_dictionary (*godot_get_global_constants)(); - void (*godot_register_native_call_type)(const char *call_type, native_call_cb p_callback); - void *(*godot_alloc)(int p_bytes); - void *(*godot_realloc)(void *p_ptr, int p_bytes); - void (*godot_free)(void *p_ptr); - void (*godot_print_error)(const char *p_description, const char *p_function, const char *p_file, int p_line); - void (*godot_print_warning)(const char *p_description, const char *p_function, const char *p_file, int p_line); - void (*godot_print)(const godot_string *p_message); -} godot_gdnative_core_api_struct; - -typedef struct godot_gdnative_core_1_1_api_struct { - unsigned int type; - godot_gdnative_api_version version; - const godot_gdnative_api_struct *next; - godot_int (*godot_color_to_abgr32)(const godot_color *p_self); - godot_int (*godot_color_to_abgr64)(const godot_color *p_self); - godot_int (*godot_color_to_argb64)(const godot_color *p_self); - godot_int (*godot_color_to_rgba64)(const godot_color *p_self); - godot_color (*godot_color_darkened)(const godot_color *p_self, const godot_real p_amount); - godot_color (*godot_color_from_hsv)(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a); - godot_color (*godot_color_lightened)(const godot_color *p_self, const godot_real p_amount); - godot_array (*godot_array_duplicate)(const godot_array *p_self, const godot_bool p_deep); - godot_variant (*godot_array_max)(const godot_array *p_self); - godot_variant (*godot_array_min)(const godot_array *p_self); - void (*godot_array_shuffle)(godot_array *p_self); - godot_basis (*godot_basis_slerp)(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t); - godot_variant (*godot_dictionary_get_with_default)(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); - bool (*godot_dictionary_erase_with_return)(godot_dictionary *p_self, const godot_variant *p_key); - godot_node_path (*godot_node_path_get_as_property_path)(const godot_node_path *p_self); - void (*godot_quat_set_axis_angle)(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle); - godot_rect2 (*godot_rect2_grow_individual)(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom); - godot_rect2 (*godot_rect2_grow_margin)(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by); - godot_rect2 (*godot_rect2_abs)(const godot_rect2 *p_self); - godot_string (*godot_string_dedent)(const godot_string *p_self); - godot_string (*godot_string_trim_prefix)(const godot_string *p_self, const godot_string *p_prefix); - godot_string (*godot_string_trim_suffix)(const godot_string *p_self, const godot_string *p_suffix); - godot_string (*godot_string_rstrip)(const godot_string *p_self, const godot_string *p_chars); - godot_pool_string_array (*godot_string_rsplit)(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit); - godot_quat (*godot_basis_get_quat)(const godot_basis *p_self); - void (*godot_basis_set_quat)(godot_basis *p_self, const godot_quat *p_quat); - void (*godot_basis_set_axis_angle_scale)(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale); - void (*godot_basis_set_euler_scale)(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale); - void (*godot_basis_set_quat_scale)(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale); - bool (*godot_is_instance_valid)(const godot_object *p_object); - void (*godot_quat_new_with_basis)(godot_quat *r_dest, const godot_basis *p_basis); - void (*godot_quat_new_with_euler)(godot_quat *r_dest, const godot_vector3 *p_euler); - void (*godot_transform_new_with_quat)(godot_transform *r_dest, const godot_quat *p_quat); - godot_string (*godot_variant_get_operator_name)(godot_variant_operator p_op); - void (*godot_variant_evaluate)(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid); -} godot_gdnative_core_1_1_api_struct; - -typedef struct godot_gdnative_core_1_2_api_struct { - unsigned int type; - godot_gdnative_api_version version; - const godot_gdnative_api_struct *next; - godot_dictionary (*godot_dictionary_duplicate)(const godot_dictionary *p_self, const godot_bool p_deep); - godot_vector3 (*godot_vector3_move_toward)(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta); - godot_vector2 (*godot_vector2_move_toward)(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta); - godot_int (*godot_string_count)(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); - godot_int (*godot_string_countn)(const godot_string *p_self, godot_string p_what, godot_int p_from, godot_int p_to); - godot_vector3 (*godot_vector3_direction_to)(const godot_vector3 *p_self, const godot_vector3 *p_to); - godot_vector2 (*godot_vector2_direction_to)(const godot_vector2 *p_self, const godot_vector2 *p_to); - godot_array (*godot_array_slice)(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep); - godot_bool (*godot_pool_byte_array_empty)(const godot_pool_byte_array *p_self); - godot_bool (*godot_pool_int_array_empty)(const godot_pool_int_array *p_self); - godot_bool (*godot_pool_real_array_empty)(const godot_pool_real_array *p_self); - godot_bool (*godot_pool_string_array_empty)(const godot_pool_string_array *p_self); - godot_bool (*godot_pool_vector2_array_empty)(const godot_pool_vector2_array *p_self); - godot_bool (*godot_pool_vector3_array_empty)(const godot_pool_vector3_array *p_self); - godot_bool (*godot_pool_color_array_empty)(const godot_pool_color_array *p_self); - void *(*godot_get_class_tag)(const godot_string_name *p_class); - godot_object *(*godot_object_cast_to)(const godot_object *p_object, void *p_class_tag); - godot_object *(*godot_instance_from_id)(godot_int p_instance_id); -} godot_gdnative_core_1_2_api_struct; - -// PluginScript -typedef void godot_pluginscript_instance_data; -typedef void godot_pluginscript_script_data; -typedef void godot_pluginscript_language_data; - -typedef struct godot_property_attributes { - godot_method_rpc_mode rset_type; - - godot_int type; - godot_property_hint hint; - godot_string hint_string; - godot_property_usage_flags usage; - godot_variant default_value; -} godot_property_attributes; - -typedef struct godot_pluginscript_instance_desc { - godot_pluginscript_instance_data *(*init)(godot_pluginscript_script_data *p_data, godot_object *p_owner); - void (*finish)(godot_pluginscript_instance_data *p_data); - godot_bool (*set_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, const godot_variant *p_value); - godot_bool (*get_prop)(godot_pluginscript_instance_data *p_data, const godot_string *p_name, godot_variant *r_ret); - godot_variant (*call_method)(godot_pluginscript_instance_data *p_data, const godot_string_name *p_method, const godot_variant **p_args, int p_argcount, godot_variant_call_error *r_error); - void (*notification)(godot_pluginscript_instance_data *p_data, int p_notification); - godot_method_rpc_mode (*get_rpc_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_method); - godot_method_rpc_mode (*get_rset_mode)(godot_pluginscript_instance_data *p_data, const godot_string *p_variable); - void (*refcount_incremented)(godot_pluginscript_instance_data *p_data); - bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die -} godot_pluginscript_instance_desc; - -typedef struct godot_pluginscript_script_manifest { - godot_pluginscript_script_data *data; - godot_string_name name; - godot_bool is_tool; - godot_string_name base; - godot_dictionary member_lines; - godot_array methods; - godot_array signals; - godot_array properties; -} godot_pluginscript_script_manifest; - -typedef struct godot_pluginscript_script_desc { - godot_pluginscript_script_manifest (*init)(godot_pluginscript_language_data *p_data, const godot_string *p_path, const godot_string *p_source, godot_error *r_error); - void (*finish)(godot_pluginscript_script_data *p_data); - godot_pluginscript_instance_desc instance_desc; -} godot_pluginscript_script_desc; - -typedef struct godot_pluginscript_profiling_data { - godot_string_name signature; - godot_int call_count; - godot_int total_time; // In microseconds - godot_int self_time; // In microseconds -} godot_pluginscript_profiling_data; - -typedef struct godot_pluginscript_language_desc { - const char *name; - const char *type; - const char *extension; - const char **recognized_extensions; // NULL terminated array - godot_pluginscript_language_data *(*init)(); - void (*finish)(godot_pluginscript_language_data *p_data); - const char **reserved_words; // NULL terminated array - const char **comment_delimiters; // NULL terminated array - const char **string_delimiters; // NULL terminated array - godot_bool has_named_classes; - godot_bool supports_builtin_mode; - godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); - godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions); - int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL - godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_pool_string_array *p_args); - godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); - void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); - void (*add_global_constant)(godot_pluginscript_language_data *p_data, const godot_string *p_variable, const godot_variant *p_value); - godot_string (*debug_get_error)(godot_pluginscript_language_data *p_data); - int (*debug_get_stack_level_count)(godot_pluginscript_language_data *p_data); - int (*debug_get_stack_level_line)(godot_pluginscript_language_data *p_data, int p_level); - godot_string (*debug_get_stack_level_function)(godot_pluginscript_language_data *p_data, int p_level); - godot_string (*debug_get_stack_level_source)(godot_pluginscript_language_data *p_data, int p_level); - void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); - godot_string (*debug_parse_stack_level_expression)(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth); - void (*get_public_functions)(godot_pluginscript_language_data *p_data, godot_array *r_functions); - void (*get_public_constants)(godot_pluginscript_language_data *p_data, godot_dictionary *r_constants); - void (*profiling_start)(godot_pluginscript_language_data *p_data); - void (*profiling_stop)(godot_pluginscript_language_data *p_data); - int (*profiling_get_accumulated_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); - int (*profiling_get_frame_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); - void (*profiling_frame)(godot_pluginscript_language_data *p_data); - godot_pluginscript_script_desc script_desc; -} godot_pluginscript_language_desc; - -// Global API pointer -const godot_gdnative_core_api_struct *hgdn_core_api; -const godot_gdnative_core_1_1_api_struct *hgdn_core_1_1_api; -const godot_gdnative_core_1_2_api_struct *hgdn_core_1_2_api; - -// Global PluginScript description and callbacks -void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); -godot_error (*lps_script_init_cb)(godot_pluginscript_script_manifest *data, const godot_string *path, const godot_string *source); -void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); -godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); -void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); -godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); -godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); -void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); -void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); - -void (*lps_get_template_source_code_cb)(const godot_string *class_name, const godot_string *base_class_name, godot_string *ret); -godot_bool (*lps_validate_cb)(const godot_string *script, int *line_error, int *col_error, godot_string *test_error, const godot_string *path, godot_pool_string_array *functions); -]] - -api = ffi.C.hgdn_core_api -api_1_1 = ffi.C.hgdn_core_1_1_api -api_1_2 = ffi.C.hgdn_core_1_2_api - diff --git a/src/godot_globals.lua b/src/godot_globals.lua deleted file mode 100644 index 0cb8b6f..0000000 --- a/src/godot_globals.lua +++ /dev/null @@ -1,194 +0,0 @@ -local function concat_gdvalues(a, b) - return api.godot_string_operator_plus(GD.str(a), GD.str(b)) -end - -GD = { - api = api, - api_1_1 = api_1_1, - -- godot_error - OK = ffi.C.GODOT_OK, - FAILED = ffi.C.GODOT_FAILED, - ERR_UNAVAILABLE = ffi.C.GODOT_ERR_UNAVAILABLE, - ERR_UNCONFIGURED = ffi.C.GODOT_ERR_UNCONFIGURED, - ERR_UNAUTHORIZED = ffi.C.GODOT_ERR_UNAUTHORIZED, - ERR_PARAMETER_RANGE_ERROR = ffi.C.GODOT_ERR_PARAMETER_RANGE_ERROR, - ERR_OUT_OF_MEMORY = ffi.C.GODOT_ERR_OUT_OF_MEMORY, - ERR_FILE_NOT_FOUND = ffi.C.GODOT_ERR_FILE_NOT_FOUND, - ERR_FILE_BAD_DRIVE = ffi.C.GODOT_ERR_FILE_BAD_DRIVE, - ERR_FILE_BAD_PATH = ffi.C.GODOT_ERR_FILE_BAD_PATH, - ERR_FILE_NO_PERMISSION = ffi.C.GODOT_ERR_FILE_NO_PERMISSION, - ERR_FILE_ALREADY_IN_USE = ffi.C.GODOT_ERR_FILE_ALREADY_IN_USE, - ERR_FILE_CANT_OPEN = ffi.C.GODOT_ERR_FILE_CANT_OPEN, - ERR_FILE_CANT_WRITE = ffi.C.GODOT_ERR_FILE_CANT_WRITE, - ERR_FILE_CANT_READ = ffi.C.GODOT_ERR_FILE_CANT_READ, - ERR_FILE_UNRECOGNIZED = ffi.C.GODOT_ERR_FILE_UNRECOGNIZED, - ERR_FILE_CORRUPT = ffi.C.GODOT_ERR_FILE_CORRUPT, - ERR_FILE_MISSING_DEPENDENCIES = ffi.C.GODOT_ERR_FILE_MISSING_DEPENDENCIES, - ERR_FILE_EOF = ffi.C.GODOT_ERR_FILE_EOF, - ERR_CANT_OPEN = ffi.C.GODOT_ERR_CANT_OPEN, - ERR_CANT_CREATE = ffi.C.GODOT_ERR_CANT_CREATE, - ERR_QUERY_FAILED = ffi.C.GODOT_ERR_QUERY_FAILED, - ERR_ALREADY_IN_USE = ffi.C.GODOT_ERR_ALREADY_IN_USE, - ERR_LOCKED = ffi.C.GODOT_ERR_LOCKED, - ERR_TIMEOUT = ffi.C.GODOT_ERR_TIMEOUT, - ERR_CANT_CONNECT = ffi.C.GODOT_ERR_CANT_CONNECT, - ERR_CANT_RESOLVE = ffi.C.GODOT_ERR_CANT_RESOLVE, - ERR_CONNECTION_ERROR = ffi.C.GODOT_ERR_CONNECTION_ERROR, - ERR_CANT_ACQUIRE_RESOURCE = ffi.C.GODOT_ERR_CANT_ACQUIRE_RESOURCE, - ERR_CANT_FORK = ffi.C.GODOT_ERR_CANT_FORK, - ERR_INVALID_DATA = ffi.C.GODOT_ERR_INVALID_DATA, - ERR_INVALID_PARAMETER = ffi.C.GODOT_ERR_INVALID_PARAMETER, - ERR_ALREADY_EXISTS = ffi.C.GODOT_ERR_ALREADY_EXISTS, - ERR_DOES_NOT_EXIST = ffi.C.GODOT_ERR_DOES_NOT_EXIST, - ERR_DATABASE_CANT_READ = ffi.C.GODOT_ERR_DATABASE_CANT_READ, - ERR_DATABASE_CANT_WRITE = ffi.C.GODOT_ERR_DATABASE_CANT_WRITE, - ERR_COMPILATION_FAILED = ffi.C.GODOT_ERR_COMPILATION_FAILED, - ERR_METHOD_NOT_FOUND = ffi.C.GODOT_ERR_METHOD_NOT_FOUND, - ERR_LINK_FAILED = ffi.C.GODOT_ERR_LINK_FAILED, - ERR_SCRIPT_FAILED = ffi.C.GODOT_ERR_SCRIPT_FAILED, - ERR_CYCLIC_LINK = ffi.C.GODOT_ERR_CYCLIC_LINK, - ERR_INVALID_DECLARATION = ffi.C.GODOT_ERR_INVALID_DECLARATION, - ERR_DUPLICATE_SYMBOL = ffi.C.GODOT_ERR_DUPLICATE_SYMBOL, - ERR_PARSE_ERROR = ffi.C.GODOT_ERR_PARSE_ERROR, - ERR_BUSY = ffi.C.GODOT_ERR_BUSY, - ERR_SKIP = ffi.C.GODOT_ERR_SKIP, - ERR_HELP = ffi.C.GODOT_ERR_HELP, - ERR_BUG = ffi.C.GODOT_ERR_BUG, - ERR_PRINTER_ON_FIRE = ffi.C.GODOT_ERR_PRINTER_ON_FIRE, - -- godot_variant_type - TYPE_NIL = ffi.C.GODOT_VARIANT_TYPE_NIL, - TYPE_BOOL = ffi.C.GODOT_VARIANT_TYPE_BOOL, - TYPE_INT = ffi.C.GODOT_VARIANT_TYPE_INT, - TYPE_REAL = ffi.C.GODOT_VARIANT_TYPE_REAL, - TYPE_STRING = ffi.C.GODOT_VARIANT_TYPE_STRING, - TYPE_VECTOR2 = ffi.C.GODOT_VARIANT_TYPE_VECTOR2, - TYPE_RECT2 = ffi.C.GODOT_VARIANT_TYPE_RECT2, - TYPE_VECTOR3 = ffi.C.GODOT_VARIANT_TYPE_VECTOR3, - TYPE_TRANSFORM2D = ffi.C.GODOT_VARIANT_TYPE_TRANSFORM2D, - TYPE_PLANE = ffi.C.GODOT_VARIANT_TYPE_PLANE, - TYPE_QUAT = ffi.C.GODOT_VARIANT_TYPE_QUAT, - TYPE_AABB = ffi.C.GODOT_VARIANT_TYPE_AABB, - TYPE_BASIS = ffi.C.GODOT_VARIANT_TYPE_BASIS, - TYPE_TRANSFORM = ffi.C.GODOT_VARIANT_TYPE_TRANSFORM, - TYPE_COLOR = ffi.C.GODOT_VARIANT_TYPE_COLOR, - TYPE_NODE_PATH = ffi.C.GODOT_VARIANT_TYPE_NODE_PATH, - TYPE_RID = ffi.C.GODOT_VARIANT_TYPE_RID, - TYPE_OBJECT = ffi.C.GODOT_VARIANT_TYPE_OBJECT, - TYPE_DICTIONARY = ffi.C.GODOT_VARIANT_TYPE_DICTIONARY, - TYPE_ARRAY = ffi.C.GODOT_VARIANT_TYPE_ARRAY, - TYPE_POOL_BYTE_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, - TYPE_POOL_INT_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_INT_ARRAY, - TYPE_POOL_REAL_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, - TYPE_POOL_STRING_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, - TYPE_POOL_VECTOR2_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, - TYPE_POOL_VECTOR3_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, - TYPE_POOL_COLOR_ARRAY = ffi.C.GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, - -- godot_variant_call_error_error - CALL_OK = ffi.C.GODOT_CALL_ERROR_CALL_OK, - CALL_ERROR_INVALID_METHOD = ffi.C.GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, - CALL_ERROR_INVALID_ARGUMENT = ffi.C.GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, - CALL_ERROR_TOO_MANY_ARGUMENTS = ffi.C.GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, - CALL_ERROR_TOO_FEW_ARGUMENTS = ffi.C.GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, - CALL_ERROR_INSTANCE_IS_NULL = ffi.C.GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, - -- godot_method_rpc_mode - RPC_MODE_DISABLED = ffi.C.GODOT_METHOD_RPC_MODE_DISABLED, - RPC_MODE_REMOTE = ffi.C.GODOT_METHOD_RPC_MODE_REMOTE, - RPC_MODE_MASTER = ffi.C.GODOT_METHOD_RPC_MODE_MASTER, - RPC_MODE_PUPPET = ffi.C.GODOT_METHOD_RPC_MODE_PUPPET, - RPC_MODE_SLAVE = ffi.C.GODOT_METHOD_RPC_MODE_SLAVE, - RPC_MODE_REMOTESYNC = ffi.C.GODOT_METHOD_RPC_MODE_REMOTESYNC, - RPC_MODE_SYNC = ffi.C.GODOT_METHOD_RPC_MODE_SYNC, - RPC_MODE_MASTERSYNC = ffi.C.GODOT_METHOD_RPC_MODE_MASTERSYNC, - RPC_MODE_PUPPETSYNC = ffi.C.GODOT_METHOD_RPC_MODE_PUPPETSYNC, - -- godot_property_hint - PROPERTY_HINT_NONE = ffi.C.GODOT_PROPERTY_HINT_NONE, - PROPERTY_HINT_RANGE = ffi.C.GODOT_PROPERTY_HINT_RANGE, - PROPERTY_HINT_EXP_RANGE = ffi.C.GODOT_PROPERTY_HINT_EXP_RANGE, - PROPERTY_HINT_ENUM = ffi.C.GODOT_PROPERTY_HINT_ENUM, - PROPERTY_HINT_EXP_EASING = ffi.C.GODOT_PROPERTY_HINT_EXP_EASING, - PROPERTY_HINT_LENGTH = ffi.C.GODOT_PROPERTY_HINT_LENGTH, - PROPERTY_HINT_SPRITE_FRAME = ffi.C.GODOT_PROPERTY_HINT_SPRITE_FRAME, - PROPERTY_HINT_KEY_ACCEL = ffi.C.GODOT_PROPERTY_HINT_KEY_ACCEL, - PROPERTY_HINT_FLAGS = ffi.C.GODOT_PROPERTY_HINT_FLAGS, - PROPERTY_HINT_LAYERS_2D_RENDER = ffi.C.GODOT_PROPERTY_HINT_LAYERS_2D_RENDER, - PROPERTY_HINT_LAYERS_2D_PHYSICS = ffi.C.GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS, - PROPERTY_HINT_LAYERS_3D_RENDER = ffi.C.GODOT_PROPERTY_HINT_LAYERS_3D_RENDER, - PROPERTY_HINT_LAYERS_3D_PHYSICS = ffi.C.GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS, - PROPERTY_HINT_FILE = ffi.C.GODOT_PROPERTY_HINT_FILE, - PROPERTY_HINT_DIR = ffi.C.GODOT_PROPERTY_HINT_DIR, - PROPERTY_HINT_GLOBAL_FILE = ffi.C.GODOT_PROPERTY_HINT_GLOBAL_FILE, - PROPERTY_HINT_GLOBAL_DIR = ffi.C.GODOT_PROPERTY_HINT_GLOBAL_DIR, - PROPERTY_HINT_RESOURCE_TYPE = ffi.C.GODOT_PROPERTY_HINT_RESOURCE_TYPE, - PROPERTY_HINT_MULTILINE_TEXT = ffi.C.GODOT_PROPERTY_HINT_MULTILINE_TEXT, - PROPERTY_HINT_PLACEHOLDER_TEXT = ffi.C.GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT, - PROPERTY_HINT_COLOR_NO_ALPHA = ffi.C.GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, - PROPERTY_HINT_IMAGE_COMPRESS_LOSSY = ffi.C.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY, - PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS = ffi.C.GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS, - PROPERTY_HINT_OBJECT_ID = ffi.C.GODOT_PROPERTY_HINT_OBJECT_ID, - PROPERTY_HINT_TYPE_STRING = ffi.C.GODOT_PROPERTY_HINT_TYPE_STRING, - PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE = ffi.C.GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, - PROPERTY_HINT_METHOD_OF_VARIANT_TYPE = ffi.C.GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, - PROPERTY_HINT_METHOD_OF_BASE_TYPE = ffi.C.GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, - PROPERTY_HINT_METHOD_OF_INSTANCE = ffi.C.GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, - PROPERTY_HINT_METHOD_OF_SCRIPT = ffi.C.GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, - PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE = ffi.C.GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, - PROPERTY_HINT_PROPERTY_OF_BASE_TYPE = ffi.C.GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, - PROPERTY_HINT_PROPERTY_OF_INSTANCE = ffi.C.GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, - PROPERTY_HINT_PROPERTY_OF_SCRIPT = ffi.C.GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, - -- godot_property_usage_flags - PROPERTY_USAGE_STORAGE = ffi.C.GODOT_PROPERTY_USAGE_STORAGE, - PROPERTY_USAGE_EDITOR = ffi.C.GODOT_PROPERTY_USAGE_EDITOR, - PROPERTY_USAGE_NETWORK = ffi.C.GODOT_PROPERTY_USAGE_NETWORK, - PROPERTY_USAGE_EDITOR_HELPER = ffi.C.GODOT_PROPERTY_USAGE_EDITOR_HELPER, - PROPERTY_USAGE_CHECKABLE = ffi.C.GODOT_PROPERTY_USAGE_CHECKABLE, - PROPERTY_USAGE_CHECKED = ffi.C.GODOT_PROPERTY_USAGE_CHECKED, - PROPERTY_USAGE_INTERNATIONALIZED = ffi.C.GODOT_PROPERTY_USAGE_INTERNATIONALIZED, - PROPERTY_USAGE_GROUP = ffi.C.GODOT_PROPERTY_USAGE_GROUP, - PROPERTY_USAGE_CATEGORY = ffi.C.GODOT_PROPERTY_USAGE_CATEGORY, - PROPERTY_USAGE_STORE_IF_NONZERO = ffi.C.GODOT_PROPERTY_USAGE_STORE_IF_NONZERO, - PROPERTY_USAGE_STORE_IF_NONONE = ffi.C.GODOT_PROPERTY_USAGE_STORE_IF_NONONE, - PROPERTY_USAGE_NO_INSTANCE_STATE = ffi.C.GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE, - PROPERTY_USAGE_RESTART_IF_CHANGED = ffi.C.GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED, - PROPERTY_USAGE_SCRIPT_VARIABLE = ffi.C.GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE, - PROPERTY_USAGE_STORE_IF_NULL = ffi.C.GODOT_PROPERTY_USAGE_STORE_IF_NULL, - PROPERTY_USAGE_ANIMATE_AS_TRIGGER = ffi.C.GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER, - PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = ffi.C.GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED, - PROPERTY_USAGE_DEFAULT = ffi.C.GODOT_PROPERTY_USAGE_DEFAULT, - PROPERTY_USAGE_DEFAULT_INTL = ffi.C.GODOT_PROPERTY_USAGE_DEFAULT_INTL, - PROPERTY_USAGE_NOEDITOR = ffi.C.GODOT_PROPERTY_USAGE_NOEDITOR, -} - -bool = ffi.typeof('godot_bool') -int = ffi.typeof('godot_int') -float = ffi.typeof('godot_real') - -if api_1_1 then - GD.is_instance_valid = api_1_1.godot_is_instance_valid -end - -function GD.str(value) - return api.godot_variant_as_string(Variant(value)) -end - -function GD.tostring(value) - return tostring(Variant(value)) -end - -function GD.print(...) - local message = PoolStringArray(...):join('\t') - api.godot_print(message) -end -_G.print = GD.print - -function GD.print_warning(...) - local info = debug.getinfo(2, 'nSl') - local message = tostring(PoolStringArray(...):join('\t')) - api.godot_print_warning(message, info.name, info.short_src, info.currentline) -end - -function GD.print_error(...) - local info = debug.getinfo(2, 'nSl') - local message = tostring(PoolStringArray(...):join('\t')) - api.godot_print_error(message, info.name, info.short_src, info.currentline) -end - diff --git a/src/godot_math.lua b/src/godot_math.lua deleted file mode 100644 index c7b7c3c..0000000 --- a/src/godot_math.lua +++ /dev/null @@ -1,90 +0,0 @@ -Vector2 = ffi.metatype('godot_vector2', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_vector2_variant, - varianttype = GD.TYPE_VECTOR2, - }, - __concat = concat_gdvalues, -}) - -Vector3 = ffi.metatype('godot_vector3', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_vector3_variant, - varianttype = GD.TYPE_VECTOR3, - }, - __concat = concat_gdvalues, -}) - -Vector4 = ffi.metatype('godot_vector4', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_color_variant, - varianttype = GD.TYPE_COLOR, - }, - __concat = concat_gdvalues, -}) -Color = Vector4 - -Rect2 = ffi.metatype('godot_rect2', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_rect2_variant, - varianttype = GD.TYPE_RECT2, - }, - __concat = concat_gdvalues, -}) - -Plane = ffi.metatype('godot_plane', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_plane_variant, - varianttype = GD.TYPE_PLANE, - }, - __concat = concat_gdvalues, -}) - -Quat = ffi.metatype('godot_quat', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_quat_variant, - varianttype = GD.TYPE_QUAT, - }, - __concat = concat_gdvalues, -}) - -Basis = ffi.metatype('godot_basis', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_basis_variant, - varianttype = GD.TYPE_BASIS, - }, - __concat = concat_gdvalues, -}) - -AABB = ffi.metatype('godot_aabb', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_aabb_variant, - varianttype = GD.TYPE_AABB, - }, - __concat = concat_gdvalues, -}) - -Transform2D = ffi.metatype('godot_transform2d', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_transform2d_variant, - varianttype = GD.TYPE_TRANSFORM2D, - }, - __concat = concat_gdvalues, -}) - -Transform = ffi.metatype('godot_transform', { - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_transform_variant, - varianttype = GD.TYPE_TRANSFORM, - }, - __concat = concat_gdvalues, -}) diff --git a/src/godot_misc.lua b/src/godot_misc.lua deleted file mode 100644 index 5abc2ae..0000000 --- a/src/godot_misc.lua +++ /dev/null @@ -1,121 +0,0 @@ -local node_path_methods = { - tovariant = ffi.C.hgdn_new_node_path_variant, - varianttype = GD.TYPE_NODE_PATH, -} -NodePath = ffi.metatype('godot_node_path', { - __new = function(mt, text_or_nodepath) - local self = ffi.new(mt) - if ffi.istype(mt, text_or_nodepath) then - api.godot_node_path_new_copy(self, text_or_nodepath) - elseif ffi.istype(String, text_or_nodepath) then - api.godot_node_path_new(self, text_or_nodepath) - else - api.godot_node_path_new(self, String(text_or_nodepath)) - end - return self - end, - __gc = api.godot_node_path_destroy, - __tostring = function(self) - return tostring(api.godot_node_path_as_string(self)) - end, - __index = node_path_methods, - __concat = concat_gdvalues, -}) - -RID = ffi.metatype('godot_rid', { - __new = function(mt, resource) - local self = ffi.new(mt) - if resource then - api.godot_rid_new_with_resource(self, resource) - else - api.godot_rid_new(self) - end - return self - end, - __tostring = GD.tostring, - __index = { - tovariant = ffi.C.hgdn_new_rid_variant, - varianttype = GD.TYPE_RID, - get_id = api.godot_rid_get_id, - }, - __concat = concat_gdvalues, - __eq = api.godot_rid_operator_equal, - __lt = api.godot_rid_operator_less, -}) - -local object_methods = { - tovariant = ffi.C.hgdn_new_object_variant, - varianttype = GD.TYPE_OBJECT, - pcall = function(self, method, ...) - if self:has_method() then - return true, self:call(method, ...) - else - return false - end - end, - add_user_signal = api.godot_method_bind_get_method('Object', 'add_user_signal'), - call = api.godot_method_bind_get_method('Object', 'call'), - call_deferred = api.godot_method_bind_get_method('Object', 'call_deferred'), - can_translate_messages = api.godot_method_bind_get_method('Object', 'can_translate_messages'), - connect = api.godot_method_bind_get_method('Object', 'connect'), - disconnect = api.godot_method_bind_get_method('Object', 'disconnect'), - emit_signal = api.godot_method_bind_get_method('Object', 'emit_signal'), - free = api.godot_method_bind_get_method('Object', 'free'), - get = api.godot_method_bind_get_method('Object', 'get'), - get_class = api.godot_method_bind_get_method('Object', 'get_class'), - get_incoming_connections = api.godot_method_bind_get_method('Object', 'get_incoming_connections'), - get_indexed = api.godot_method_bind_get_method('Object', 'get_indexed'), - get_instance_id = api.godot_method_bind_get_method('Object', 'get_instance_id'), - get_meta = api.godot_method_bind_get_method('Object', 'get_meta'), - get_meta_list = api.godot_method_bind_get_method('Object', 'get_meta_list'), - get_method_list = api.godot_method_bind_get_method('Object', 'get_method_list'), - get_property_list = api.godot_method_bind_get_method('Object', 'get_property_list'), - get_script = api.godot_method_bind_get_method('Object', 'get_script'), - get_signal_connection_list = api.godot_method_bind_get_method('Object', 'get_signal_connection_list'), - get_signal_list = api.godot_method_bind_get_method('Object', 'get_signal_list'), - has_meta = api.godot_method_bind_get_method('Object', 'has_meta'), - has_method = api.godot_method_bind_get_method('Object', 'has_method'), - has_signal = api.godot_method_bind_get_method('Object', 'has_signal'), - has_user_signal = api.godot_method_bind_get_method('Object', 'has_user_signal'), - is_blocking_signals = api.godot_method_bind_get_method('Object', 'is_blocking_signals'), - is_class = api.godot_method_bind_get_method('Object', 'is_class'), - is_connected = api.godot_method_bind_get_method('Object', 'is_connected'), - is_queued_for_deletion = api.godot_method_bind_get_method('Object', 'is_queued_for_deletion'), - notification = api.godot_method_bind_get_method('Object', 'notification'), - property_list_changed_notify = api.godot_method_bind_get_method('Object', 'property_list_changed_notify'), - remove_meta = api.godot_method_bind_get_method('Object', 'remove_meta'), - set = api.godot_method_bind_get_method('Object', 'set'), - set_block_signals = api.godot_method_bind_get_method('Object', 'set_block_signals'), - set_deferred = api.godot_method_bind_get_method('Object', 'set_deferred'), - set_indexed = api.godot_method_bind_get_method('Object', 'set_indexed'), - set_message_translation = api.godot_method_bind_get_method('Object', 'set_message_translation'), - set_meta = api.godot_method_bind_get_method('Object', 'set_meta'), - set_script = api.godot_method_bind_get_method('Object', 'set_script'), - to_string = api.godot_method_bind_get_method('Object', 'to_string'), - tr = api.godot_method_bind_get_method('Object', 'tr'), -} -Object = ffi.metatype('godot_object', { - __new = function(mt, init) - if ffi.istype(mt, init) then - return init - else - return init.__owner - end - end, - __tostring = GD.tostring, - __index = function(self, key) - if type(key) ~= 'string' then - return - end - local method = object_methods[key] - if method then - return method - end - if self:has_method(key) then - return MethodBindByName:new(key) - else - self:get(key) - end - end, - __concat = concat_gdvalues, -}) diff --git a/src/godot_pool_arrays.lua b/src/godot_pool_arrays.lua deleted file mode 100644 index ca97321..0000000 --- a/src/godot_pool_arrays.lua +++ /dev/null @@ -1,100 +0,0 @@ -local function register_pool_array(kind, element_ctype) - local name = 'Pool' .. kind:sub(1, 1):upper() .. kind:sub(2) .. 'Array' - local kind_type = 'pool_' .. kind .. '_array' - local ctype = 'godot_' .. kind_type - local godot_array_new_pool_array = 'godot_array_new_' .. kind_type - local godot_pool_array_new = ctype .. '_new' - local godot_pool_array_new_copy = ctype .. '_new_copy' - local godot_pool_array_new_with_array = ctype .. '_new_with_array' - - local methods = { - tovariant = ffi.C['hgdn_new_' .. kind_type .. '_variant'], - varianttype = GD['TYPE_POOL_' .. kind:upper() .. '_ARRAY'], - toarray = function(self) - local array = ffi.new(Array) - api[godot_array_new_pool_array](array, self) - return array - end, - get = api[ctype .. '_get'], - set = api[ctype .. '_set'], - append = api[ctype .. '_append'], - append_array = api[ctype .. '_append_array'], - insert = api[ctype .. '_insert'], - invert = api[ctype .. '_invert'], - push_back = api[ctype .. '_push_back'], - remove = api[ctype .. '_remove'], - resize = api[ctype .. '_resize'], - -- TODO: read/write - size = function(self) - return api[ctype .. '_size'](self) - end, - } - - if element_ctype == String then - methods.join = function(self, delimiter) - local result = String(self[0]) - delimiter = String(delimiter) - for i = 1, #self - 1 do - result = result .. delimiter .. self[i] - end - return result - end - end - - if api_1_2 then - methods.empty = api_1_2[ctype .. '_empty'] - end - - _G[name] = ffi.metatype(ctype, { - __new = function(mt, ...) - local self = ffi.new(mt) - local value = ... - if ffi.istype(mt, value) then - api[godot_pool_array_new_copy](self, value) - elseif ffi.istype(Array, value) then - api[godot_pool_array_new_with_array](self, value) - else - api[godot_pool_array_new](self) - local t = type(value) - for i = 1, select('#', ...) do - local v = select(i, ...) - self:append(element_ctype(v)) - end - end - return self - end, - __gc = api[ctype .. '_destroy'], - __tostring = GD.tostring, - __concat = concat_gdvalues, - __index = function(self, key) - local numeric_index = tonumber(key) - if numeric_index then - if numeric_index >= 0 and numeric_index < #self then - return methods.get(self, numeric_index) - end - else - return methods[key] - end - end, - __newindex = function(self, key, value) - key = assert(tonumber(key), "Array indices must be numeric") - if key == #self then - methods.append(self, value) - else - methods.set(self, key, value) - end - end, - __len = methods.size, - __ipairs = array_ipairs, - __pairs = array_ipairs, - }) -end - -register_pool_array('byte', ffi.typeof('uint8_t')) -register_pool_array('int', int) -register_pool_array('real', float) -register_pool_array('string', String) -register_pool_array('vector2', Vector2) -register_pool_array('vector3', Vector3) -register_pool_array('color', Color) - diff --git a/src/godot_string.lua b/src/godot_string.lua deleted file mode 100644 index 483710e..0000000 --- a/src/godot_string.lua +++ /dev/null @@ -1,86 +0,0 @@ -local CharString = ffi.metatype('godot_char_string', { - __gc = api.godot_char_string_destroy, - __tostring = function(self) - local ptr = api.godot_char_string_get_data(self) - return ffi.string(ptr, #self) - end, - __len = function(self) - return api.godot_char_string_length(self) - end, -}) - -local string_methods = { - tovariant = ffi.C.hgdn_new_string_variant, - varianttype = GD.TYPE_STRING, - length = function(self) - return api.godot_string_length(self) - end, - wide_str = api.godot_string_wide_str, - -- TODO: add the rest -} -String = ffi.metatype('godot_string', { - __new = function(mt, ...) - local text, length = ... - if select('#', ...) == 0 then - return api.godot_string_chars_to_utf8('') - elseif ffi.istype(mt, text) then - local self = ffi.new(mt) - api.godot_string_new_copy(self, text) - return self - elseif ffi.istype(StringName, text) then - return text:get_name() - elseif ffi.istype('char *', text) then - if length then - return api.godot_string_chars_to_utf8_with_len(text, length) - else - return api.godot_string_chars_to_utf8(text) - end - elseif ffi.istype('wchar_t *', text) then - local self = ffi.new(mt) - api.godot_string_new_with_wide_string(self, text, length or -1) - return self - elseif ffi.istype('wchar_t', text) or ffi.istype('char', text) then - return api.godot_string_chr(text) - else - text = tostring(text) - return api.godot_string_chars_to_utf8_with_len(text, length or #text) - end - end, - __gc = api.godot_string_destroy, - __tostring = function(self) - return tostring(api.godot_string_utf8(self)) - end, - __len = string_methods.length, - __index = string_methods, - __concat = concat_gdvalues, -}) - -local string_name_methods = { - tovariant = function(self) - return api.godot_string_name_get_name(self):tovariant() - end, - get_name = api.godot_string_name_get_name, - get_hash = api.godot_string_name_get_hash, - get_data_unique_pointer = api.godot_string_name_get_data_unique_pointer, -} -StringName = ffi.metatype('godot_string_name', { - __new = function(mt, text) - text = text or '' - local self = ffi.new(mt) - if ffi.istype(String, text) then - api.godot_string_name_new(self, text) - else - api.godot_string_name_new_data(self, text) - end - return self - end, - __gc = api.godot_string_name_destroy, - __tostring = function(self) - return tostring(self:get_name()) - end, - __len = function(self) - return #self:get_name() - end, - __index = string_name_methods, - __concat = concat_gdvalues, -}) diff --git a/src/godot_variant.lua b/src/godot_variant.lua deleted file mode 100644 index 4ffd678..0000000 --- a/src/godot_variant.lua +++ /dev/null @@ -1,202 +0,0 @@ -ffi.cdef[[ -godot_variant hgdn_new_nil_variant(); -godot_variant hgdn_new_bool_variant(const godot_bool value); -godot_variant hgdn_new_uint_variant(const uint64_t value); -godot_variant hgdn_new_int_variant(const int64_t value); -godot_variant hgdn_new_real_variant(const double value); -godot_variant hgdn_new_vector2_variant(const godot_vector2 value); -godot_variant hgdn_new_vector3_variant(const godot_vector3 value); -godot_variant hgdn_new_rect2_variant(const godot_rect2 value); -godot_variant hgdn_new_plane_variant(const godot_plane value); -godot_variant hgdn_new_quat_variant(const godot_quat value); -godot_variant hgdn_new_aabb_variant(const godot_aabb value); -godot_variant hgdn_new_basis_variant(const godot_basis value); -godot_variant hgdn_new_transform2d_variant(const godot_transform2d value); -godot_variant hgdn_new_transform_variant(const godot_transform value); -godot_variant hgdn_new_color_variant(const godot_color value); -godot_variant hgdn_new_node_path_variant(const godot_node_path *value); -godot_variant hgdn_new_rid_variant(const godot_rid *value); -godot_variant hgdn_new_object_variant(const godot_object *value); -godot_variant hgdn_new_string_variant(const godot_string *value); -godot_variant hgdn_new_cstring_variant(const char *value); -godot_variant hgdn_new_wide_string_variant(const wchar_t *value); -godot_variant hgdn_new_dictionary_variant(const godot_dictionary *value); -godot_variant hgdn_new_array_variant(const godot_array *value); -godot_variant hgdn_new_pool_byte_array_variant(const godot_pool_byte_array *value); -godot_variant hgdn_new_pool_int_array_variant(const godot_pool_int_array *value); -godot_variant hgdn_new_pool_real_array_variant(const godot_pool_real_array *value); -godot_variant hgdn_new_pool_vector2_array_variant(const godot_pool_vector2_array *value); -godot_variant hgdn_new_pool_vector3_array_variant(const godot_pool_vector3_array *value); -godot_variant hgdn_new_pool_color_array_variant(const godot_pool_color_array *value); -godot_variant hgdn_new_pool_string_array_variant(const godot_pool_string_array *value); -]] - -local function Object_gc(obj) - if obj:call('unreference') then - api.godot_object_destroy(obj) - end -end - -local methods = { - tovariant = function(self) - return self - end, - as_bool = api.godot_variant_as_bool, - as_uint = api.godot_variant_as_uint, - as_int = api.godot_variant_as_int, - as_real = api.godot_variant_as_real, - as_string = api.godot_variant_as_string, - as_vector2 = api.godot_variant_as_vector2, - as_rect2 = api.godot_variant_as_rect2, - as_vector3 = api.godot_variant_as_vector3, - as_transform2d = api.godot_variant_as_transform2d, - as_plane = api.godot_variant_as_plane, - as_quat = api.godot_variant_as_quat, - as_aabb = api.godot_variant_as_aabb, - as_basis = api.godot_variant_as_basis, - as_transform = api.godot_variant_as_transform, - as_color = api.godot_variant_as_color, - as_node_path = api.godot_variant_as_node_path, - as_rid = api.godot_variant_as_rid, - as_object = function(self) - local obj = api.godot_variant_as_object(self) - if obj ~= nil and obj:call('reference') then - obj = ffi.gc(obj, Object_gc) - end - return obj - end, - as_dictionary = api.godot_variant_as_dictionary, - as_array = api.godot_variant_as_array, - as_pool_byte_array = api.godot_variant_as_pool_byte_array, - as_pool_int_array = api.godot_variant_as_pool_int_array, - as_pool_real_array = api.godot_variant_as_pool_real_array, - as_pool_string_array = api.godot_variant_as_pool_string_array, - as_pool_vector2_array = api.godot_variant_as_pool_vector2_array, - as_pool_vector3_array = api.godot_variant_as_pool_vector3_array, - as_pool_color_array = api.godot_variant_as_pool_color_array, - get_type = api.godot_variant_get_type, - pcall = function(self, method, ...) - local argc = select('#', ...) - local argv = ffi.new(Variant_p_array, argc) - for i = 1, argc do - local arg = select(i, ...) - argv[i - 1] = Variant(arg) - end - local r_error = ffi.new(VariantCallError) - local value = api.godot_variant_call(self, String(method), ffi.cast(const_Variant_pp, argv), argc, r_error) - if r_error.error == GD.CALL_OK then - return true, value:unbox() - else - return false, r_error - end - end, - call = function(self, method, ...) - local success, value = self:pcall(method, ...) - if success then - return value - else - return nil - end - end, - has_method = function(self, method) - return api.godot_variant_has_method(self, String(method)) - end, - hash_compare = function(self, other) - return api.godot_variant_hash_compare(self, Variant(other)) - end, - booleanize = api.godot_variant_booleanize, - unbox = function(self) - local t = self:get_type() - if t == GD.TYPE_NIL then - return nil - elseif t == GD.TYPE_BOOL then - return api.godot_variant_as_bool(self) - elseif t == GD.TYPE_INT then - return tonumber(api.godot_variant_as_int(self)) - elseif t == GD.TYPE_REAL then - return tonumber(api.godot_variant_as_real(self)) - elseif t == GD.TYPE_STRING then - return api.godot_variant_as_string(self) - elseif t == GD.TYPE_VECTOR2 then - return api.godot_variant_as_vector2(self) - elseif t == GD.TYPE_RECT2 then - return api.godot_variant_as_rect2(self) - elseif t == GD.TYPE_VECTOR3 then - return api.godot_variant_as_vector3(self) - elseif t == GD.TYPE_TRANSFORM2D then - return api.godot_variant_as_transform2d(self) - elseif t == GD.TYPE_PLANE then - return api.godot_variant_as_plane(self) - elseif t == GD.TYPE_QUAT then - return api.godot_variant_as_quat(self) - elseif t == GD.TYPE_AABB then - return api.godot_variant_as_aabb(self) - elseif t == GD.TYPE_BASIS then - return api.godot_variant_as_basis(self) - elseif t == GD.TYPE_TRANSFORM then - return api.godot_variant_as_transform(self) - elseif t == GD.TYPE_COLOR then - return api.godot_variant_as_color(self) - elseif t == GD.TYPE_NODE_PATH then - return api.godot_variant_as_node_path(self) - elseif t == GD.TYPE_RID then - return api.godot_variant_as_rid(self) - elseif t == GD.TYPE_OBJECT then - return self:as_object() - elseif t == GD.TYPE_DICTIONARY then - return api.godot_variant_as_dictionary(self) - elseif t == GD.TYPE_ARRAY then - return api.godot_variant_as_array(self) - elseif t == GD.TYPE_POOL_BYTE_ARRAY then - return api.godot_variant_as_pool_byte_array(self) - elseif t == GD.TYPE_POOL_INT_ARRAY then - return api.godot_variant_as_pool_int_array(self) - elseif t == GD.TYPE_POOL_REAL_ARRAY then - return api.godot_variant_as_pool_real_array(self) - elseif t == GD.TYPE_POOL_STRING_ARRAY then - return api.godot_variant_as_pool_string_array(self) - elseif t == GD.TYPE_POOL_VECTOR2_ARRAY then - return api.godot_variant_as_pool_vector2_array(self) - elseif t == GD.TYPE_POOL_VECTOR3_ARRAY then - return api.godot_variant_as_pool_vector3_array(self) - elseif t == GD.TYPE_POOL_COLOR_ARRAY then - return api.godot_variant_as_pool_color_array(self) - end - end, -} - -Variant = ffi.metatype("godot_variant", { - __new = function(mt, value) - local t = type(value) - if t == 'boolean' then - return ffi.C.hgdn_new_bool_variant(value) - elseif t == 'string' or ffi.istype('char *', value) then - return ffi.C.hgdn_new_cstring_variant(value) - elseif ffi.istype(int, value) then - return ffi.C.hgdn_new_int_variant(value) - elseif t == 'number' or tonumber(value) then - return ffi.C.hgdn_new_real_variant(value) - elseif t == 'table' then - if value.tovariant then - return value:tovariant() - else - return ffi.C.hgdn_new_dictionary_variant(Dictionary(value)) - end - elseif t == 'cdata' and value.tovariant then - return value:tovariant() - end - return ffi.C.hgdn_new_nil_variant() - end, - __gc = api.godot_variant_destroy, - __tostring = function(self) - return tostring(self:as_string()) - end, - __concat = concat_gdvalues, - __index = methods, - __eq = function(a, b) - return api.godot_variant_operator_equal(Variant(a), Variant(b)) - end, - __lt = function(a, b) - return api.godot_variant_operator_less(Variant(a), Variant(b)) - end, -}) diff --git a/src/in_editor_callbacks.lua b/src/in_editor_callbacks.lua deleted file mode 100644 index 13a5b99..0000000 --- a/src/in_editor_callbacks.lua +++ /dev/null @@ -1,17 +0,0 @@ -if Engine:is_editor_hint() then - -- void (*lps_get_template_source_code_cb)(const godot_string *class_name, const godot_string *base_class_name, godot_string *ret) - ffi.C.lps_get_template_source_code_cb = wrap_callback(function(class_name, base_class_name, ret) - ret[0] = String('local ' .. class_name .. ' = {\n\textends = "' .. base_class_name .. '",\n}\n\nreturn ' .. class_name) - end) - - -- godot_bool (*lps_validate_cb)(const godot_string *script, int *line_error, int *col_error, godot_string *test_error, const godot_string *path, godot_pool_string_array *functions); - ffi.C.lps_validate_cb = wrap_callback(function(script, line_error, col_error, test_error, path, functions) - local f, err = loadstring(tostring(script), tostring(path)) - if not f then - local line, msg = err:match(":(%d+):%s*(.*)") - line_error[0] = tonumber(line) - test_error[0] = String(msg) - end - return f ~= nil - end) -end diff --git a/src/language_gdnative.c b/src/language_gdnative.c index 34d82b0..ff61695 100644 --- a/src/language_gdnative.c +++ b/src/language_gdnative.c @@ -1,169 +1,174 @@ +// HGDN already includes godot-headers +#include "hgdn.h" #include "lua.h" #include "lualib.h" #include "lauxlib.h" -#include "language_gdnative.h" +extern const char LUA_INIT_SCRIPT[]; -// Callbacks definition +// Callbacks to be implemented in Lua void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); -godot_error (*lps_script_init_cb)(godot_pluginscript_script_manifest *data, const godot_string *path, const godot_string *source); +// LuaJIT callbacks cannot return C aggregate types by value, so +// `manifest` will be created in C and passed by reference +// Ref: https://luajit.org/ext_ffi_semantics.html#callback +void (*lps_script_init_cb)(godot_pluginscript_script_manifest *manifest, const godot_string *path, const godot_string *source, godot_error *error); void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); +// Same caveat as `lps_script_init_cb` void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); -// Language functions -static void *lps_alloc(void *userdata, void *ptr, size_t osize, size_t nsize) { - if (nsize == 0) { - hgdn_free(ptr); - return NULL; - } - else { - return hgdn_realloc(ptr, nsize); - } -} - -static int lps_lua_touserdata(lua_State *L) { - const void *ptr = lua_topointer(L, 1); - lua_pushlightuserdata(L, (void *) ptr); - return 1; -} - -static godot_pluginscript_language_data *lps_language_init() { - lua_State *L = lua_newstate(&lps_alloc, NULL); - lua_register(L, "touserdata", &lps_lua_touserdata); - luaL_openlibs(L); - if (luaL_dostring(L, LUA_INIT_SCRIPT) != 0) { - const char *error_msg = lua_tostring(L, -1); - HGDN_PRINT_ERROR("Error running initialization script: %s", error_msg); - } - return L; -} - -static void lps_language_finish(godot_pluginscript_language_data *data) { - lua_State *L = (lua_State *) data; - lua_gc(L, LUA_GCCOLLECT, 0); - lua_close(L); -} - -static void lps_language_add_global_constant(godot_pluginscript_language_data *data, const godot_string *name, const godot_variant *value) { - lps_language_add_global_constant_cb(name, value); -} - -// Script manifest -static godot_pluginscript_script_manifest lps_script_init(godot_pluginscript_language_data *data, const godot_string *path, const godot_string *source, godot_error *error) { - godot_pluginscript_script_manifest manifest = {}; - manifest.data = data; - hgdn_core_api->godot_string_name_new_data(&manifest.name, ""); - hgdn_core_api->godot_string_name_new_data(&manifest.base, ""); - hgdn_core_api->godot_dictionary_new(&manifest.member_lines); - hgdn_core_api->godot_array_new(&manifest.methods); - hgdn_core_api->godot_array_new(&manifest.signals); - hgdn_core_api->godot_array_new(&manifest.properties); - - godot_error ret = lps_script_init_cb(&manifest, path, source); - if (error) { - *error = ret; - } - - return manifest; -} - -static void lps_script_finish(godot_pluginscript_script_data *data) { - lps_script_finish_cb(data); -} - - -// Instance -static godot_pluginscript_instance_data *lps_instance_init(godot_pluginscript_script_data *data, godot_object *owner) { - return lps_instance_init_cb(data, owner); -} - -static void lps_instance_finish(godot_pluginscript_instance_data *data) { - lps_instance_finish_cb(data); -} - -static godot_bool lps_instance_set_prop(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value) { - return lps_instance_set_prop_cb(data, name, value); -} - -static godot_bool lps_instance_get_prop(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret) { - return lps_instance_get_prop_cb(data, name, ret); -} - -static godot_variant lps_instance_call_method(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant_call_error *error) { - godot_variant var = hgdn_new_nil_variant(); - lps_instance_call_method_cb(data, method, args, argcount, &var, error); - return var; -} - -static void lps_instance_notification(godot_pluginscript_instance_data *data, int notification) { - lps_instance_notification_cb(data, notification); -} - -static godot_pluginscript_language_desc lps_language_desc = { - .name = "Lua", - .type = "Lua", - .extension = "lua", - .recognized_extensions = (const char *[]){ "lua", NULL }, - .init = &lps_language_init, - .finish = &lps_language_finish, - .reserved_words = (const char *[]){ - // Lua keywords - "and", "break", "do", "else", "elseif", "end", - "false", "for", "function", "goto", "if", "in", - "local", "nil", "not", "or", "repeat", "return", - "then", "true", "until", "while", - // Other remarkable identifiers - "self", "_G", "_VERSION", -#if LUA_VERSION_NUM >= 502 - "_ENV", -#endif - "bool", "int", "float", - NULL - }, - .comment_delimiters = (const char *[]){ "--", "--[[ ]]", NULL }, - .string_delimiters = (const char *[]){ "' '", "\" \"", "[[ ]]", "[=[ ]=]", NULL }, - .has_named_classes = false, - .supports_builtin_mode = false, - .add_global_constant = &lps_language_add_global_constant, - - .script_desc = { - .init = &lps_script_init, - .finish = &lps_script_finish, - .instance_desc = { - .init = &lps_instance_init, - .finish = &lps_instance_finish, - .set_prop = &lps_instance_set_prop, - .get_prop = &lps_instance_get_prop, - .call_method = &lps_instance_call_method, - .notification = &lps_instance_notification, - }, - }, +// lua_Alloc function: https://www.lua.org/manual/5.4/manual.html#lua_Alloc +// Use `hgdn_free` and `hgdn_realloc` to make memory requests +// go through Godot, so memory usage is tracked on debug builds +void *lps_alloc(void *userdata, void *ptr, size_t osize, size_t nsize) { + if (nsize == 0) { + hgdn_free(ptr); + return NULL; + } + else { + return hgdn_realloc(ptr, nsize); + } +} + +// Called when our language runtime will be initialized +godot_pluginscript_language_data *lps_language_init() { + lua_State *L = lua_newstate(&lps_alloc, NULL); + luaL_openlibs(L); // Load core Lua libraries + if (luaL_dostring(L, LUA_INIT_SCRIPT) != 0) { + const char *error_msg = lua_tostring(L, -1); + HGDN_PRINT_ERROR("Error running initialization script: %s", error_msg); + } + return L; +} + +// Called when our language runtime will be terminated +void lps_language_finish(godot_pluginscript_language_data *data) { + lua_close((lua_State *) data); +} + +// Called when Godot registers globals in the language, such as Autoload nodes +void lps_language_add_global_constant(godot_pluginscript_language_data *data, const godot_string *name, const godot_variant *value) { + lps_language_add_global_constant_cb(name, value); +} + +// Called when a Lua script is loaded, e.g.: const SomeScript = preload("res://some_script.lua") +godot_pluginscript_script_manifest lps_script_init(godot_pluginscript_language_data *data, const godot_string *path, const godot_string *source, godot_error *error) { + godot_pluginscript_script_manifest manifest = { + .data = NULL, + .is_tool = false, + }; + // All Godot objects must be initialized, or else our plugin SEGFAULTs + hgdn_core_api->godot_string_name_new_data(&manifest.name, ""); + hgdn_core_api->godot_string_name_new_data(&manifest.base, ""); + hgdn_core_api->godot_dictionary_new(&manifest.member_lines); + hgdn_core_api->godot_array_new(&manifest.methods); + hgdn_core_api->godot_array_new(&manifest.signals); + hgdn_core_api->godot_array_new(&manifest.properties); + + godot_error cb_error = GODOT_ERR_SCRIPT_FAILED; + lps_script_init_cb(&manifest, path, source, &cb_error); + if (error) { + *error = cb_error; + } + + return manifest; +} + +// Called when a Lua script is unloaded +void lps_script_finish(godot_pluginscript_script_data *data) { + lps_script_finish_cb(data); +} + +// Called when a Script Instance is being created, e.g.: var instance = SomeScript.new() +godot_pluginscript_instance_data *lps_instance_init(godot_pluginscript_script_data *data, godot_object *owner) { + return lps_instance_init_cb(data, owner); +} + +// Called when a Script Instance is being finalized +void lps_instance_finish(godot_pluginscript_instance_data *data) { + lps_instance_finish_cb(data); +} + +// Called when setting a property on an instance, e.g.: instance.prop = value +godot_bool lps_instance_set_prop(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value) { + return lps_instance_set_prop_cb(data, name, value); +} + +// Called when getting a property on an instance, e.g.: var value = instance.prop +godot_bool lps_instance_get_prop(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret) { + return lps_instance_get_prop_cb(data, name, ret); +} + +// Called when calling a method on an instance, e.g.: instance.method(args) +godot_variant lps_instance_call_method(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant_call_error *error) { + godot_variant var = hgdn_new_nil_variant(); + lps_instance_call_method_cb(data, method, args, argcount, &var, error); + return var; +} + +// Called when a notification is sent to instance +void lps_instance_notification(godot_pluginscript_instance_data *data, int notification) { + lps_instance_notification_cb(data, notification); +} + +// Declared as a global variable, because Godot needs the +// memory to be valid until our plugin is unloaded +godot_pluginscript_language_desc lps_language_desc = { + .name = "Lua", + .type = "Lua", + .extension = "lua", + .recognized_extensions = (const char *[]){ "lua", NULL }, + .reserved_words = (const char *[]){ + // Lua keywords + "and", "break", "do", "else", "elseif", "end", + "false", "for", "function", "goto", "if", "in", + "local", "nil", "not", "or", "repeat", "return", + "then", "true", "until", "while", + // Other important identifiers + "self", "_G", "_ENV", "_VERSION", + NULL + }, + .comment_delimiters = (const char *[]){ "--", "--[[ ]]", NULL }, + .string_delimiters = (const char *[]){ "' '", "\" \"", "[[ ]]", "[=[ ]=]", NULL }, + // Lua scripts don't care about the class name + .has_named_classes = false, + // Builtin scripts didn't work for me, so disable for now... + .supports_builtin_mode = false, + + // Callbacks + .init = &lps_language_init, + .finish = &lps_language_finish, + .add_global_constant = &lps_language_add_global_constant, + .script_desc = { + .init = &lps_script_init, + .finish = &lps_script_finish, + .instance_desc = { + .init = &lps_instance_init, + .finish = &lps_instance_finish, + .set_prop = &lps_instance_set_prop, + .get_prop = &lps_instance_get_prop, + .call_method = &lps_instance_call_method, + .notification = &lps_instance_notification, + }, + }, }; -// GDNative functions +// GDN_EXPORT makes sure our symbols are exported in the way Godot expects +// This is not needed, since symbols are exported by default, but it +// doesn't hurt being explicit about it GDN_EXPORT void godot_gdnative_init(godot_gdnative_init_options *options) { - hgdn_gdnative_init(options); - - if (!hgdn_pluginscript_api) { - HGDN_PRINT_ERROR("PluginScript is not supported!"); - return; - } - - if (options->in_editor) { - lps_register_in_editor_callbacks(&lps_language_desc); - } - - hgdn_pluginscript_api->godot_pluginscript_register_language(&lps_language_desc); + hgdn_gdnative_init(options); + hgdn_pluginscript_api->godot_pluginscript_register_language(&lps_language_desc); } GDN_EXPORT void godot_gdnative_terminate(godot_gdnative_terminate_options *options) { - hgdn_gdnative_terminate(options); + hgdn_gdnative_terminate(options); } GDN_EXPORT void godot_gdnative_singleton() { } + diff --git a/src/language_gdnative.h b/src/language_gdnative.h deleted file mode 100644 index 3cc13fa..0000000 --- a/src/language_gdnative.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __LPS_LANGUAGE_GDNATIVE_H__ -#define __LPS_LANGUAGE_GDNATIVE_H__ - -#include "hgdn.h" - -extern const char LUA_INIT_SCRIPT[]; - -// Language callbacks, to be patched in Lua via FFI -extern void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); -extern godot_error (*lps_script_init_cb)(godot_pluginscript_script_manifest *data, const godot_string *path, const godot_string *source); -extern void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); -extern godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); -extern void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); -extern godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); -extern godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); -extern void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); -extern void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); - -// In editor callbacks -void lps_register_in_editor_callbacks(godot_pluginscript_language_desc *desc); - -extern void (*lps_get_template_source_code_cb)(const godot_string *class_name, const godot_string *base_class_name, godot_string *ret); -extern godot_bool (*lps_validate_cb)(const godot_string *script, int *line_error, int *col_error, godot_string *test_error, const godot_string *path, godot_pool_string_array *functions); - -#endif diff --git a/src/language_in_editor_callbacks.c b/src/language_in_editor_callbacks.c deleted file mode 100644 index 97285f3..0000000 --- a/src/language_in_editor_callbacks.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "language_gdnative.h" - -void (*lps_get_template_source_code_cb)(const godot_string *class_name, const godot_string *base_class_name, godot_string *ret); -godot_bool (*lps_validate_cb)(const godot_string *script, int *line_error, int *col_error, godot_string *test_error, const godot_string *path, godot_pool_string_array *functions); - -godot_string lps_get_template_source_code(godot_pluginscript_language_data *data, const godot_string *class_name, const godot_string *base_class_name) { - godot_string ret; - lps_get_template_source_code_cb(class_name, base_class_name, &ret); - return ret; -} - -godot_bool lps_validate(godot_pluginscript_language_data *data, const godot_string *script, int *line_error, int *col_error, godot_string *test_error, const godot_string *path, godot_pool_string_array *functions) { - return lps_validate_cb(script, line_error, col_error, test_error, path, functions); -} - -void lps_register_in_editor_callbacks(godot_pluginscript_language_desc *desc) { - desc->get_template_source_code = &lps_get_template_source_code; - desc->validate = &lps_validate; -} - diff --git a/src/late_globals.lua b/src/late_globals.lua deleted file mode 100644 index f0f0acf..0000000 --- a/src/late_globals.lua +++ /dev/null @@ -1,31 +0,0 @@ -for k, v in pairs(api.godot_get_global_constants()) do - GD[tostring(k)] = v -end - -local Engine = api.godot_global_get_singleton("Engine") -setmetatable(_G, { - __index = function(self, key) - key = String(key) - if Engine:has_singleton(key) then - local singleton = Engine:get_singleton(key) - rawset(self, key, singleton) - return singleton - end - if ClassDB:class_exists(key) then - local cls = Class:new(key) - rawset(self, key, cls) - return cls - end - end, -}) - --- References are already got, just register them globally -_G.Engine = Engine -_G.ClassDB = ClassDB --- These classes are registered with a prepending "_" in ClassDB -File = Class:new("_File") -Directory = Class:new("_Directory") -Thread = Class:new("_Thread") -Mutex = Class:new("_Mutex") -Semaphore = Class:new("_Semaphore") - diff --git a/src/lps_callbacks.lua b/src/lps_callbacks.lua deleted file mode 100644 index 2978503..0000000 --- a/src/lps_callbacks.lua +++ /dev/null @@ -1,148 +0,0 @@ -local loadstring = loadstring or load -local unpack = table.unpack or unpack - -local lps_scripts = {} -local lps_instances = {} - -local function pointer_to_index(ptr) - return tonumber(ffi.cast('uintptr_t', ptr)) -end - -local function wrap_callback(f) - -- TODO: use `pcall` on debug only? - return function(...) - return select(2, xpcall(f, GD.print_error, ...)) - end -end - --- void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); -ffi.C.lps_language_add_global_constant_cb = wrap_callback(function(_data, name, value) - _G[tostring(name)] = value:unbox() -end) - --- godot_error (*lps_script_init_cb)(godot_pluginscript_script_manifest *data, const godot_string *path, const godot_string *source); -ffi.C.lps_script_init_cb = wrap_callback(function(manifest, path, source) - path = tostring(path) - source = tostring(source) - local script, err = loadstring(source, path) - if not script then - GD.print_error('Error parsing script: ' .. err) - return GD.ERR_PARSE_ERROR - end - local success, metadata = pcall(script) - if not success then - GD.print_error('Error loading script: ' .. metadata) - return GD.ERR_SCRIPT_FAILED - end - if type(metadata) ~= 'table' then - GD.print_error(path .. ': script must return a table') - return GD.ERR_SCRIPT_FAILED - end - local metadata_index = pointer_to_index(touserdata(metadata)) - lps_scripts[metadata_index] = metadata - for k, v in pairs(metadata) do - if k == 'class_name' then - manifest.name = StringName(v) - elseif k == 'tool' then - manifest.is_tool = bool(v) - elseif k == 'extends' then - manifest.base = StringName(v) - elseif type(v) == 'function' then - local method = method_to_dictionary(v) - method.name = String(k) - manifest.methods:append(method) - elseif is_signal(v) then - local sig = signal_to_dictionary(v) - sig.name = String(k) - manifest.signals:append(sig) - else - local prop, default_value = property_to_dictionary(v) - prop.name = String(k) - -- Maintain default value directly for __indexing - metadata[k] = default_value - manifest.properties:append(prop) - end - end - - if #manifest.name == 0 then - manifest.name = StringName("Reference") - end - - manifest.data = ffi.cast('void *', metadata_index) - return GD.OK -end) - --- void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); -ffi.C.lps_script_finish_cb = wrap_callback(function(data) - lps_scripts[pointer_to_index(data)] = nil -end) - --- godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); -ffi.C.lps_instance_init_cb = wrap_callback(function(script_data, owner) - local script = lps_scripts[pointer_to_index(script_data)] - local instance = setmetatable({ - __owner = owner, - __script = script, - }, Instance) - if script._init then - script._init(instance) - end - local instance_index = pointer_to_index(touserdata(instance)) - lps_instances[instance_index] = instance - return ffi.cast('void *', instance_index) -end) - --- void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); -ffi.C.lps_instance_finish_cb = wrap_callback(function(data) - lps_instances[pointer_to_index(data)] = nil -end) - --- godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); -ffi.C.lps_instance_set_prop_cb = wrap_callback(function(data, name, value) - local self = lps_instances[pointer_to_index(data)] - name = tostring(name) - local prop = self.__script[name] - if prop ~= nil then - self[name] = value:unbox() - return true - else - return false - end -end) - --- godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); -ffi.C.lps_instance_get_prop_cb = wrap_callback(function(data, name, ret) - local self = lps_instances[pointer_to_index(data)] - name = tostring(name) - local prop = self.__script[name] - if prop ~= nil then - ret[0] = Variant(self[name]) - return true - else - return false - end -end) - --- void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); -ffi.C.lps_instance_call_method_cb = wrap_callback(function(data, name, args, argcount, ret, err) - local self = lps_instances[pointer_to_index(data)] - name = tostring(name) - local method = self.__script[name] - if method ~= nil then - local args_table = {} - for i = 1, argcount do - args_table[i] = args[i - 1]:unbox() - end - local unboxed_ret = method(self, unpack(args_table)) - ret[0] = Variant(unboxed_ret) - err.error = GD.CALL_OK - else - err.error = GD.CALL_ERROR_INVALID_METHOD - end -end) - --- void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); -ffi.C.lps_instance_notification_cb = function(data, what) - local self = lps_instances[pointer_to_index(data)] - self:call("_notification", what) -end diff --git a/src/lps_class_metadata.lua b/src/lps_class_metadata.lua deleted file mode 100644 index e748bdb..0000000 --- a/src/lps_class_metadata.lua +++ /dev/null @@ -1,107 +0,0 @@ --- Map names and ctypes to godot_variant_type -local property_types = { - bool = GD.TYPE_BOOL, [bool] = GD.TYPE_BOOL, - int = GD.TYPE_INT, [int] = GD.TYPE_INT, - float = GD.TYPE_FLOAT, [float] = GD.TYPE_FLOAT, - String = GD.TYPE_STRING, [String] = GD.TYPE_STRING, - - Vector2 = GD.TYPE_VECTOR2, [Vector2] = GD.TYPE_VECTOR2, - Rect2 = GD.TYPE_RECT2, [Rect2] = GD.TYPE_RECT2, - Vector3 = GD.TYPE_VECTOR3, [Vector3] = GD.TYPE_VECTOR3, - Transform2D = GD.TYPE_TRANSFORM2D, [Transform2D] = GD.TYPE_TRANSFORM2D, - Plane = GD.TYPE_PLANE, [Plane] = GD.TYPE_PLANE, - Quat = GD.TYPE_QUAT, [Quat] = GD.TYPE_QUAT, - AABB = GD.TYPE_AABB, [AABB] = GD.TYPE_AABB, - Basis = GD.TYPE_BASIS, [Basis] = GD.TYPE_BASIS, - Transform = GD.TYPE_TRANSFORM, [Transform] = GD.TYPE_TRANSFORM, - - Color = GD.TYPE_COLOR, [Color] = GD.TYPE_COLOR, - NodePath = GD.TYPE_NODE_PATH, [NodePath] = GD.TYPE_NODE_PATH, - RID = GD.TYPE_RID, [RID] = GD.TYPE_RID, - Object = GD.TYPE_OBJECT, [Object] = GD.TYPE_OBJECT, - Dictionary = GD.TYPE_DICTIONARY, [Dictionary] = GD.TYPE_DICTIONARY, - Array = GD.TYPE_ARRAY, [Array] = GD.TYPE_ARRAY, - - PoolByteArray = GD.TYPE_POOL_BYTE_ARRAY, [PoolByteArray] = GD.TYPE_POOL_BYTE_ARRAY, - PoolIntArray = GD.TYPE_POOL_INT_ARRAY, [PoolIntArray] = GD.TYPE_POOL_INT_ARRAY, - PoolRealArray = GD.TYPE_POOL_REAL_ARRAY, [PoolRealArray] = GD.TYPE_POOL_REAL_ARRAY, - PoolStringArray = GD.TYPE_POOL_STRING_ARRAY, [PoolStringArray] = GD.TYPE_POOL_STRING_ARRAY, - PoolVector2Array = GD.TYPE_POOL_VECTOR2_ARRAY, [PoolVector2Array] = GD.TYPE_POOL_VECTOR2_ARRAY, - PoolVector3Array = GD.TYPE_POOL_VECTOR3_ARRAY, [PoolVector3Array] = GD.TYPE_POOL_VECTOR3_ARRAY, - PoolColorArray = GD.TYPE_POOL_COLOR_ARRAY, [PoolColorArray] = GD.TYPE_POOL_COLOR_ARRAY, -} - -local function get_property_type(value) - local t = type(value) - if t == 'boolean' then - return GD.TYPE_BOOL - elseif t == 'string' then - return GD.TYPE_STRING - elseif ffi.istype(int, value) then - return GD.TYPE_INT - elseif t == 'number' or tonumber(value) then - return GD.TYPE_REAL - elseif t == 'table' then - return GD.TYPE_DICTIONARY - elseif t == 'cdata' and value.varianttype then - return value.varianttype - end - return GD.TYPE_NIL -end - -local Property = {} - -local function is_property(value) - return getmetatable(value) == Property -end - -local function property_to_dictionary(prop) - local dict, default_value = Dictionary(), nil - if not is_property(prop) then - default_value = prop - dict.default_value = prop - dict.type = get_property_type(prop) - else - default_value = prop[1] or prop.default or prop.default_value - local explicit_type = prop[2] or prop.type - dict.type = property_types[explicit_type] or explicit_type or get_property_type(default_value) or GD.TYPE_NIL - end - dict.default_value = default_value - return dict, default_value -end - -function property(metadata) - if type(metadata) ~= 'table' then - metadata = { metadata } - end - return setmetatable(metadata, Property) -end - -function export(metadata) - local prop = property(metadata) - prop.export = true - return prop -end - -local Signal = {} - -local function is_signal(value) - return getmetatable(value) == Signal -end - -local function signal_to_dictionary(sig) - local dict = Dictionary() - dict.args = Array() - for i = 1, #sig do - dict.args:append(Dictionary{ name = String(sig[i]) }) - end - return dict -end - -function signal(...) - return setmetatable({ ... }, Signal) -end - -local function method_to_dictionary(f) - return Dictionary() -end diff --git a/src/lua_init_script.c b/src/lua_init_script.c deleted file mode 100644 index 6d72b47..0000000 --- a/src/lua_init_script.c +++ /dev/null @@ -1,18 +0,0 @@ -const char LUA_INIT_SCRIPT[] = -#include "godot_ffi.lua.h" -#include "godot_class.lua.h" -#include "godot_globals.lua.h" -#include "godot_variant.lua.h" -#include "godot_string.lua.h" -#include "godot_math.lua.h" -#include "godot_misc.lua.h" -#include "godot_dictionary.lua.h" -#include "godot_array.lua.h" -#include "godot_pool_arrays.lua.h" -#include "lps_class_metadata.lua.h" -#include "lps_callbacks.lua.h" -#include "late_globals.lua.h" - -#include "in_editor_callbacks.lua.h" -; - diff --git a/src/pluginscript_callbacks.lua b/src/pluginscript_callbacks.lua new file mode 100644 index 0000000..9a3e0c4 --- /dev/null +++ b/src/pluginscript_callbacks.lua @@ -0,0 +1,63 @@ +-- Error printing facility +local function print_error(message) + local info = debug.getinfo(2, 'nSl') + api.godot_print_error(message, info.name, info.short_src, info.currentline) +end + +-- All callbacks will be run in protected mode, to avoid errors in Lua +-- aborting the game/application +-- If an error is thrown, it will be printed in the output console +local function wrap_callback(f) + return function(...) + local success, result = xpcall(f, print_error, ...) + return result + end +end + +-- void (*lps_language_add_global_constant_cb)(const godot_string *name, const godot_variant *value); +ffi.C.lps_language_add_global_constant_cb = wrap_callback(function(name, value) + api.godot_print(String('TODO: add_global_constant')) +end) + +-- void (*lps_script_init_cb)(godot_pluginscript_script_manifest *manifest, const godot_string *path, const godot_string *source, godot_error *error); +ffi.C.lps_script_init_cb = wrap_callback(function(manifest, path, source, err) + api.godot_print(String('TODO: script_init ' .. path)) +end) + +-- void (*lps_script_finish_cb)(godot_pluginscript_script_data *data); +ffi.C.lps_script_finish_cb = wrap_callback(function(data) + api.godot_print(String('TODO: script_finish')) +end) + +-- godot_pluginscript_instance_data *(*lps_instance_init_cb)(godot_pluginscript_script_data *data, godot_object *owner); +ffi.C.lps_instance_init_cb = wrap_callback(function(script_data, owner) + api.godot_print(String('TODO: instance_init')) + return nil +end) + +-- void (*lps_instance_finish_cb)(godot_pluginscript_instance_data *data); +ffi.C.lps_instance_finish_cb = wrap_callback(function(data) + api.godot_print(String('TODO: instance_finish')) +end) + +-- godot_bool (*lps_instance_set_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, const godot_variant *value); +ffi.C.lps_instance_set_prop_cb = wrap_callback(function(data, name, value) + api.godot_print(String('TODO: instance_set_prop')) + return false +end) + +-- godot_bool (*lps_instance_get_prop_cb)(godot_pluginscript_instance_data *data, const godot_string *name, godot_variant *ret); +ffi.C.lps_instance_get_prop_cb = wrap_callback(function(data, name, ret) + api.godot_print(String('TODO: instance_get_prop')) + return false +end) + +-- void (*lps_instance_call_method_cb)(godot_pluginscript_instance_data *data, const godot_string_name *method, const godot_variant **args, int argcount, godot_variant *ret, godot_variant_call_error *error); +ffi.C.lps_instance_call_method_cb = wrap_callback(function(data, name, args, argcount, ret, err) + api.godot_print(String('TODO: instance_call_method')) +end) + +-- void (*lps_instance_notification_cb)(godot_pluginscript_instance_data *data, int notification); +ffi.C.lps_instance_notification_cb = wrap_callback(function(data, what) + api.godot_print(String('TODO: instance_notification')) +end) diff --git a/src/string.lua b/src/string.lua new file mode 100644 index 0000000..f7422cc --- /dev/null +++ b/src/string.lua @@ -0,0 +1,69 @@ +-- Notice that even `api` being declared as a local variable at +-- `src/ffi.lua`, since all files will get concatenated before run, we +-- can access it here + +-- String methods, taken from the GDNative API and adjusted to feel +-- more idiomatic to Lua, when necessary +local string_methods = { + -- Get the String length, in wide characters + length = api.godot_string_length, + -- Return the String as a Lua string, encoded as UTF-8 + utf8 = function(self) + -- `godot_string` holds wide characters, so we need to get a + -- character string, then create a Lua string from it + local char_string = api.godot_string_utf8(self) + local pointer = api.godot_char_string_get_data(char_string) + local length = api.godot_char_string_length(char_string) + local lua_string = ffi.string(pointer, length) + -- Just as in C, we need to destroy the objects we own + api.godot_char_string_destroy(char_string) + return lua_string + end, +} + +-- String metatype, used to construct instances of `godot_string` +-- Notice that we make this a global variable, so scripts can use it +-- right away +String = ffi.metatype('godot_string', { + -- Constructor method + -- Calling `String(value)` will create a string that holds the + -- contents of `value` after passing it through `tostring` + __new = function(metatype, value) + local self = ffi.new(metatype) + -- if `value` is another String, just create a copy + if ffi.istype(metatype, value) then + api.godot_string_new_copy(self, value) + -- general case + else + local str = tostring(value) + api.godot_string_parse_utf8_with_len(self, str, #str) + end + return self + end, + -- Destructor method + __gc = api.godot_string_destroy, + -- Setting `__index` to the methods table makes methods available + -- from instances, e.g.: `godot_string:length()` + __index = string_methods, + -- Length operation: `#godot_string` returns the String length + __len = function(self) + return string_methods.length(self) + end, + -- Calling `tostring(string)` will call this metamethod + __tostring = string_methods.utf8, + -- Concatenation operation: `godot_string .. godot_string` + -- will create a new String with both contents concatenated + __concat = function(a, b) + -- Converting `a` and `b` to Strings make expressions like + -- `42 .. some_godot_string .. " some Lua string "` possible + local str = api.godot_string_operator_plus(String(a), String(b)) + -- LuaJIT can't be sure if data returned from a C function must + -- be garbage-collected or not, since C APIs may require the + -- caller to clean the memory up or not. + -- Explicitly track the return in cases where we own the data, + -- such as this one: in the GDNative API, when a function + -- returns a struct/union and not a pointer, we own the data. + ffi.gc(str, api.godot_string_destroy) + return str + end, +}) diff --git a/src/test.lua b/src/test.lua new file mode 100644 index 0000000..0548205 --- /dev/null +++ b/src/test.lua @@ -0,0 +1,2 @@ +local message = String "Hello world from Lua! \\o/" +api.godot_print(message) diff --git a/xmake.lua b/xmake.lua index f8a9237..ce5574d 100644 --- a/xmake.lua +++ b/xmake.lua @@ -1,66 +1,77 @@ -if GD then return {} end - -option("use-luajit") - set_description("Use LuaJIT instead of vanilla Lua") - set_default(true) - set_showmenu(true) -option("system-lua") - set_description("Use Lua/LuaJIT system package, if available") - set_default(false) - set_showmenu(true) -option_end() - -local lua_or_jit = has_config("use-luajit") and "luajit" or "lua" -add_requires(lua_or_jit, { - system = has_config("system-lua") or false, - config = { - gc64 = true, - }, +-- xmake.lua +add_requires("luajit", { + -- Force xmake to build and embed LuaJIT, + -- instead of searching for it in the system + system = false, + -- Turn on LuaJIT's GC64 mode, enabling full memory range on 64-bit systems, + -- also allowing custom memory allocation functions to be hooked to Lua + config = { + gc64 = true, + }, }) --- Embed any file into a `#include`able .h file -rule("embed_header") - on_build_file(function(target, sourcefile, opt) - local target_file = path.join(get_config('buildir'), "include", path.filename(sourcefile) .. ".h") - if os.isfile(target_file) and os.mtime(target_file) > os.mtime(sourcefile) then - return - end +rule("generate_init_script") + -- The rule "generate_init_script" builds an object file + set_kind("object") + on_buildcmd_files(function(target, batchcmds, sourcebatch, opt) + -- Path for built Lua script: `build/init_script.lua` + local full_script_path = vformat("$(buildir)/init_script.lua") + -- Path for the C file with embedded script will be `build/init_script.c` + local script_c_path = vformat("$(buildir)/init_script.c") + -- This is how we add a new object file to a xmake target + local script_obj_path = target:objectfile(script_c_path) + table.insert(target:objectfiles(), script_obj_path) - cprint("${bright green}[%3d%%]:${clear} embed_header %s", opt.progress, sourcefile) - local header_contents = {} - for line in io.lines(sourcefile) do - local escaped_line = line:gsub('\\', '\\\\'):gsub('"', '\\"') - table.insert(header_contents, '"' .. escaped_line .. '\\n"') - end - header_contents = table.concat(header_contents, '\n') - io.writefile(target_file, header_contents) - end) + batchcmds:show_progress(opt.progress, "${color.build.object}embed.lua (%s)", table.concat(sourcebatch.sourcefiles, ', ')) + -- Execute `cat src/*.lua > build/init_script.lua` + batchcmds:execv("cat", sourcebatch.sourcefiles, { stdout = full_script_path }) + -- Execute `sed -e ↓SED_SCRIPT_BELOW↓ build/init_script.lua > build/init_script.c` + batchcmds:execv("sed", { "-e", [[ + # Escape backslashes (`s` substitutes content, `g` means change all occurrences in line) + s/\\/\\\\/g + # Escape quotes + s/"/\\"/g + # Add starting quote (`^` matches the begining of the line) + s/^/"/ + # Add ending newline and quote (`$` matches the end of the line) + s/$/\\n"/ + # Add C declaration lines: + # before first line (`i` inserts a line before `1`, the first line) + 1 i const char LUA_INIT_SCRIPT[] = + # and after last line (`a` appends a line after `$`, the last line) + $ a ; + ]], full_script_path }, { stdout = script_c_path }) + -- Finally, compile the generated C file + batchcmds:compile(script_c_path, script_obj_path) + -- The following informs xmake to only rebuild the + -- object file if source files are changed + batchcmds:add_depfiles(sourcebatch.sourcefiles) + batchcmds:set_depmtime(os.mtime(script_obj_path)) + end) rule_end() -target("embed_lua_files") - set_kind("object") - add_files("src/*.lua", { rule = "embed_header" }) -target("cat_init_script") - set_kind("phony") - set_default(false) - on_build(function(target) - local buildir = get_config('buildir') - local embedded_files = {} - for line in io.lines("src/lua_init_script.c") do - local m = line:match("#include%W*([^%.]+%.lua%.h)") - if m then - table.insert(embedded_files, io.readfile(path.join(buildir, "include", m))) - end - end - io.writefile(path.join(buildir, "include", "init_script.lua"), table.concat(embedded_files, '\n')) - end) target("lua_pluginscript") - set_kind("shared") - set_targetdir("$(buildir)") - set_prefixname("") - set_suffixname("_$(os)_$(arch)") - add_files("src/*.c") - add_deps("embed_lua_files") - add_includedirs("lib/godot-headers", "lib/high-level-gdnative", "$(buildir)/include") - add_packages(lua_or_jit) + set_kind("shared") + -- Set the output name to something easy to find like `build/lua_pluginscript_linux_x86_64.so` + set_targetdir("$(buildir)") + set_prefixname("") + set_suffixname("_$(os)_$(arch)") + -- Add "-I" flags for locating HGDN and godot-header files + add_includedirs("lib/godot-headers", "lib/high-level-gdnative") + -- src/hgdn.c, src/language_gdnative.c + add_files("src/*.c") + add_files( + -- Notice that the order is important! + -- First, FFI declarations + "src/ffi.lua", + -- Then String implementation + "src/string.lua", + -- Then PluginScript callbacks + "src/pluginscript_callbacks.lua", + -- Finally, our test code + "src/test.lua", + { rule = "generate_init_script" } + ) + -- Add "luajit" as dependency + add_packages("luajit") target_end()