-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
136: Virtual function dispatch r=Bromeon a=Mercerenies See #134. This MR replaces `GodotExt` with a new trait for each built-in Godot class. The trait is the name of the Godot class followed by the word "Virtual". So, for instance, a Rust class that extends `Node2D` would implement the trait called `godot::engine::Node2DVirtual`. This trait contains all of the virtual methods belonging to `Node2D` and its ancestors, as well as a few special-cased methods that used to be on `GodotExt` (`init`, `to_string`, and `register_class`). All methods are optional. Any unimplemented methods call `unimplemented!()` on the Rust side and never get registered as virtual methods on the Godot side. Internally, `ImplementsGodotExt` has been split out into `ImplementsGodotVirtual` (which *only* contains real Godot virtual methods), `GodotToString`, and `GodotRegisterClass`. All of these are automatically implemented when you implement the `ClassNameVirtual` trait, and *only* the ones that you actually define are implemented (so, for example, `GodotToString` is only implemented if you actually define a `to_string` function in your trait `impl`). The user never sees any of this. From the user's perspective, the expectation *used* to be "define an inherent impl and implement `GodotExt`". Now the expectation is "define an inherent impl and implement `ClassNameVirtual` for your class". The tests and dodge-the-creeps example have been updated to reflect these changes. Co-authored-by: Silvio Mayolo <mercerenies@comcast.net>
- Loading branch information
Showing
19 changed files
with
459 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.