Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to use wrenpp to bind foreign hierarchies? #16

Open
heretique opened this issue Jun 21, 2018 · 2 comments
Open

[Question] How to use wrenpp to bind foreign hierarchies? #16

heretique opened this issue Jun 21, 2018 · 2 comments

Comments

@heretique
Copy link

Hi, i'm using wrenpp an a toy game engine and I came to a use case where I'm a bit stuck. Suppose I have a base Node class and a Spatial class that inherits Node. Since in wren it is not possible to subclass a foreign class, in wrenpp I have to bind all the specific base class methods for each derived class each time.
What would be the best approach to automate this in wrenpp?

@Nelarius
Copy link
Owner

It sure would be nice if subclasses could inherit foreign classes in Wren 🤔

Wren++ doesn't really help you in that regard, unfortunately! I would probably just dump the base class bindings in a function, which would be parametrized based on module and class name. At least the purpose of the code would be clear:

bind_node_impl(vm, "spatial_node", "SpatialNode");
bind_node_impl(vm, "ui_node", "UiNode");
// etc...

This isn't optimum, since you can't freely extend the hierarchy in Wren without modifying C++ 😞

@Nelarius
Copy link
Owner

I would actually be curious about how the guy behind the Luxe engine has worked around this problem, since the engine also uses Wren heavily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants