Go to file
wrenge cd57c03761 bhl static struct methods 2023-10-13 16:50:00 +03:00
src remove debug 2023-10-12 12:02:52 +03:00
tpl bhl static struct methods 2023-10-13 16:50:00 +03:00
.gitignore Adding README and ignores file 2022-12-03 17:18:25 +03:00
README.md Изменил(а) на 'README.md' 2023-04-26 16:04:23 +03:00
composer.json Bumping deps 2023-08-16 14:32:26 +03:00

README.md

This package is used for code generation of bhl2 bindings for C# using Twig templates

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
  @bhl_native_class:Vector2 @bhl_custom_rw

  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

Usage example:

$twig = \bhl_bind\get_twig();
$meta = \bhl_bind\prepare_meta($meta);

file_put_contents('autobind.cs', 
  $twig->render("codegen_autobind.twig", 
    [
     'imports' => ['UnityEngine'], 
     'register_class' => 'BHL_AutoBindings',
     'meta' => $meta
    ]
  )
);