Go to file
Pavel Shevaev b8aaaeb141 Обновить CHANGELOG.md 2024-12-18 18:34:50 +03:00
.gitea/workflows Добавить .gitea/workflows/build_composer.yaml 2024-02-13 15:05:46 +03:00
src Splitting one huge output autobind file to many files presumed to be stored under non VCS directory 2024-12-17 20:00:45 +03:00
tpl A bit minimizing codegen output for types setup 2024-12-17 22:27:09 +03:00
.gitignore Adding README and ignores file 2022-12-03 17:18:25 +03:00
CHANGELOG.md Обновить CHANGELOG.md 2024-12-18 18:34:50 +03:00
README.md Обновить README.md 2024-11-21 14:30:41 +03:00
composer.json Initial introduction of plugins, removing ECS related stuff 2023-10-23 11:21:35 +03:00

README.md

This package is used for code generation of BHL 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:

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

file_put_contents('autobind.cs', 
  \bhl_bind\codegen(null, $meta,
    [
     'imports' => ['UnityEngine'], 
     'register_class' => 'BHL_AutoBindings',
    ]
  )
);