2022-12-03 17:18:25 +03:00
|
|
|
This package is used for code generation of bhl2 bindings for C# using Twig templates
|
2022-12-05 10:08:23 +03:00
|
|
|
|
2022-12-30 14:52:39 +03:00
|
|
|
Here the example of bindings declaration:
|
|
|
|
|
|
|
|
func Debug(
|
|
|
|
@bhl_native_prefix:BitGames.Logs.Log.Debug(..)
|
|
|
|
msg : string
|
|
|
|
)
|
|
|
|
|
|
|
|
func Error(
|
|
|
|
@bhl_native_prefix:BitGames.Logs.Log.Error(..)
|
|
|
|
msg : string
|
|
|
|
)
|
|
|
|
|
|
|
|
func Time(
|
|
|
|
@bhl_native_prefix:Time.time
|
|
|
|
) : float
|
|
|
|
|
|
|
|
struct Vector2
|
2023-04-06 01:04:07 +03:00
|
|
|
@bhl_native_class:Vector2 @bhl_custom_rw
|
2022-12-30 14:52:39 +03:00
|
|
|
|
|
|
|
x : float
|
|
|
|
y : float
|
|
|
|
|
|
|
|
magnitude : float @bhl_set:0
|
|
|
|
sqrMagnitude : float @bhl_set:0
|
|
|
|
normalized : Vector2 @bhl_set:0
|
|
|
|
|
|
|
|
func Mult(
|
|
|
|
@bhl_bin_op:"*" @bhl_static
|
|
|
|
self : Vector2
|
|
|
|
v : float
|
|
|
|
) : Vector2
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2022-12-05 10:08:23 +03:00
|
|
|
Usage example:
|
|
|
|
|
2022-12-15 20:54:54 +03:00
|
|
|
$twig = \bhl_bind\get_twig();
|
|
|
|
$meta = \bhl_bind\prepare_meta($meta);
|
|
|
|
|
2022-12-05 10:08:23 +03:00
|
|
|
file_put_contents('autobind.cs',
|
2022-12-15 00:43:54 +03:00
|
|
|
$twig->render("codegen_autobind.twig",
|
2022-12-15 20:54:54 +03:00
|
|
|
[
|
|
|
|
'imports' => ['UnityEngine'],
|
2023-04-26 16:04:23 +03:00
|
|
|
'register_class' => 'BHL_AutoBindings',
|
2022-12-15 20:54:54 +03:00
|
|
|
'meta' => $meta
|
|
|
|
]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|