This repository was archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Dec 12, 2022. It is now read-only.
Consider automatically adding code documentation from Godot #7
Copy link
Copy link
Open
Labels
bindgencore-apidocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
It should be possible to automatically add doc strings to the generated code
/// Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately.
/// If the other body is a KinematicBody2D or RigidBody2D, it will also be affected by the motion of the other body. You can use this
/// to make moving and rotating platforms, or to make nodes push other nodes.
///
/// This method should be used in Node._physics_process() (or in a method called by Node._physics_process()), as it uses the physics
/// step's delta value automatically in calculations. Otherwise, the simulation will run at an incorrect speed.
///
/// linear_velocity is the velocity vector in pixels per second. Unlike in move_and_collide(), you should not multiply it by delta — the
/// physics engine handles applying the velocity.
///
/// ....
pub fn moveAndSlide(self: *const Self, arg_linear_velocity: *const godot.Vector2, arg_up_direction: *const godot.Vector2, arg_stop_on_slope: bool, arg_max_slides: i32, arg_floor_max_angle: f32, arg_infinite_inertia: bool) !godot.Vector2 {
if (mbind_move_and_slide == null) {
mbind_move_and_slide = try api.createMethod("KinematicBody2D", "move_and_slide");
}
var result: ?*anyopaque = null;
var args: [6]?*const anyopaque = []?*const anyopaque {
@ptrCast(*const anyopaque, arg_linear_velocity),
@ptrCast(*const anyopaque, arg_up_direction),
@ptrCast(*const anyopaque, *arg_stop_on_slope),
@ptrCast(*const anyopaque, *arg_max_slides),
@ptrCast(*const anyopaque, *arg_floor_max_angle),
@ptrCast(*const anyopaque, *arg_infinite_inertia),
};
var cargs: ?*?*const anyopaque = &args[0];
const base = @ptrCast(*c_api.godot_object, @alignCast(@alignOf(*c_api.godot_object), self.base));
_ = api.core.?.godot_method_bind_ptrcall.?(mbind_move_and_slide, base, cargs, result);
return @ptrCast(*godot.Vector2, @alignCast(@alignOf(&godot.Vector2), result)).*;
}This might be useful down the line for autocompletion tools.
Maybe just pasting gdscript documentation isn't as useful though and this needs to do some format magic.
Metadata
Metadata
Assignees
Labels
bindgencore-apidocumentationImprovements or additions to documentationImprovements or additions to documentation