createInstance method

  1. @override
Future<ThermionEntity> createInstance(
  1. ThermionEntity entity
)
override

Create a new instance of entity.

Implementation

@override
Future<ThermionEntity> createInstance(ThermionEntity entity) async {
  final result = _module.ccall(
      "create_instance",
      "int",
      ["void*".toJS, "int".toJS].toJS,
      [_sceneManager!, entity.toJS].toJS,
      null) as JSNumber;
  if (result.toDartInt == -1) {
    throw Exception("Failed to create instance of entity ${entity}");
  }
  return result.toDartInt;
}