GithubHelp home page GithubHelp logo

godot_dart's People

Contributors

fuzzybinary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot_dart's Issues

Support default arguments in generated code

Support default arguments for the generated API using named arguments in Dart.

This will diverge from Godot / GDScript which uses positional default arguments but I'm okay with that.

Replace vtable binding hack

Pending godotengine/godot#63275 we need to get rid of the generated template metaprogramming that's used for virtual function calls. We're limited to a total of 512 distinct functions, which is likely not enough for larger project.

Replace all instances of GDString and StringName with Dart Strings

While it might be useful for Extensions to make a distinction between Godot String and StringName, GDScript doesn't, or at least converts between the string types transparently.

The generated API could should do the same, and GDString and StringName should really only be used by internal classes. Everything external should take Dart strings if possible.

Fix generation for indexers

The code currently generated for Indexers doesn't work. In Array I hack replaced it with:

Variant operator [](int index) {
    Variant ret = Variant();
    final getter = gde.interface.ref.variant_get_indexed.asFunction<
        void Function(Pointer<Void>, int, Pointer<Void>, Pointer<Uint8>,
            Pointer<Uint8>)>(isLeaf: true);
    using((arena) {
      final valid = arena.allocate<Uint8>(sizeOf<Uint8>());
      final oob = arena.allocate<Uint8>(sizeOf<Uint8>());
      getter(nativePtr.cast(), index, ret.nativePtr.cast(), valid, oob);
      if (oob.value != 0) {
        throw RangeError.index(index, this);
      }
    });

    return ret;
  }

This should probably serve as the template for both indexed getters and setters for now, even though it doesn't take advantage of ptr calls. We can revisit ptr call support for these at a later date.

Support vararg calls for BuiltinType

Vararg methods cannot be called with Ptr calls in Godot, and attempting to get them returns a null address for the function (which obviously crashes).

For Built In types, this means using variant_call instead.

The generated code should take this into account (and while we're there, vararg funcitons should take a List<Variant> as their paraemter list, defaulted to [])

Support vararg for Engine classes

Vararg methods cannot be called with Ptr calls in Godot, and attempting to get them returns a null address for the function (which obviously crashes).

This should work okay for Engine classes which are already not using ptr calls, but the generated code have the funcitons take a List as their paraemter list, defaulted to [], and make sure this is passed as the arguments to the vararg function

Use ptr calls for Packed array types

Packed arrays can use Ptr calls to get variables more efficiently than converting to Variants. It will need some specific for certain types though.

Simplify methods the currently take TypeInfo as a parameter

Dart doesn't support "static inheritance," but we can fake it by assuming all Godot classes have a static member sTypeInfo and use gde.dartBindings.getGodotTypeInfo(T) to get it (see [src/dart/lib/godot_dart_extensions.dart] for an example).

This could simplify many functions that currently take both a generic paramet and a TypeInfo argument (cast being the main one)

Reimplement certain Builtin types in Dart

godot-cpp doesn't generate a lot of the builtin types, especially the math heavy ones, as going back and forth through the Godot calling system would be cumbersome. Instead, they re-implement them in C++

We should take a similar approach in Dart, only copying values out to opaque memory when needed. The classes that should get this treatment are:

  • aabb
  • basis
  • color
  • plane
  • projection
  • quaternion
  • rect2
  • rect2i
  • transform2d
  • transform3d
  • vector2
  • vector2i
  • vector3
  • vector3i
  • vector4
  • vector4i

This will also allow us to simplify their interfaces, including allowing default parameters for constructors instead of using named constructors for everything but the default.

Fix Dictionary keyed getters

The logic for Dictionary's keyed getters is likely wrong and needs to be fixed.

We should also support keyed getters on other types that support them (if there are any.)

Fix __engine_binding_reference_callback

From what I can tell, __engine_binding_reference_callback is used to let the bindings know that an object is being referenced or dereferenced. It is supposed to return true if the the object can die (meaning the binding is no longer holding onto references of it) and false otherwise.

For expediency, I have it return false always which means certain Ref counted objects are leaking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.