Skip to content

Commit

Permalink
fix more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll committed Nov 6, 2024
1 parent d170060 commit 8f93389
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 233 deletions.
1 change: 0 additions & 1 deletion crates/bevy_script_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ bevy = { workspace = true, default-features = false, features = [
"bevy_sprite",
"file_watcher",
"multi_threaded",
"bevy_reflect",
] }
uuid = "1.10"
bevy_mod_scripting_core = { workspace = true }
Expand Down
155 changes: 78 additions & 77 deletions crates/bevy_script_api/src/providers/bevy_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ use bevy_script_api::{
#[proxy(
derive(),
remote = "bevy::input::gamepad::Gamepad",
functions[r#"
/// Returns the USB vendor ID as assigned by the USB-IF, if available.
functions[
// r#"
// /// Returns the USB vendor ID as assigned by the USB-IF, if available.
#[lua(kind = "Method")]
fn vendor_id(&self) -> std::option::Option<u16>;
// #[lua(kind = "Method")]
// fn vendor_id(&self) -> std::option::Option<u16>;
"#,
r#"
/// Returns the USB product ID as assigned by the [vendor], if available.
/// [vendor]: Self::vendor_id
// "#,
// r#"
// /// Returns the USB product ID as assigned by the [vendor], if available.
// /// [vendor]: Self::vendor_id
#[lua(kind = "Method")]
fn product_id(&self) -> std::option::Option<u16>;
// #[lua(kind = "Method")]
// fn product_id(&self) -> std::option::Option<u16>;
"#,
// "#,
r#"
/// Returns the left stick as a [`Vec2`]
Expand All @@ -49,37 +50,37 @@ use bevy_script_api::{
fn dpad(&self) -> bevy::math::Vec2;
"#,
r#"
/// Returns `true` if the [`GamepadButton`] has been pressed.
// r#"
// /// Returns `true` if the [`GamepadButton`] has been pressed.
#[lua(kind = "Method")]
fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool;
// #[lua(kind = "Method")]
// fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool;
"#,
r#"
/// Returns `true` if the [`GamepadButton`] has been pressed during the current frame.
/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`].
// "#,
// r#"
// /// Returns `true` if the [`GamepadButton`] has been pressed during the current frame.
// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`].
#[lua(kind = "Method")]
fn just_pressed(
&self,
#[proxy]
button_type: bevy::input::gamepad::GamepadButton,
) -> bool;
// #[lua(kind = "Method")]
// fn just_pressed(
// &self,
// #[proxy]
// button_type: bevy::input::gamepad::GamepadButton,
// ) -> bool;
"#,
r#"
/// Returns `true` if the [`GamepadButton`] has been released during the current frame.
/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`].
// "#,
// r#"
// /// Returns `true` if the [`GamepadButton`] has been released during the current frame.
// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`].
#[lua(kind = "Method")]
fn just_released(
&self,
#[proxy]
button_type: bevy::input::gamepad::GamepadButton,
) -> bool;
// #[lua(kind = "Method")]
// fn just_released(
// &self,
// #[proxy]
// button_type: bevy::input::gamepad::GamepadButton,
// ) -> bool;
"#,
// "#,
r#"
#[lua(kind="MetaMethod", metamethod="ToString")]
fn index(&self) -> String {
Expand Down Expand Up @@ -824,45 +825,45 @@ fn index(&self) -> String {
"#]
)]
struct GamepadEvent {}
#[derive(bevy_mod_scripting_lua_derive::LuaProxy)]
#[proxy(
derive(clone),
remote = "bevy::input::gamepad::GamepadInfo",
functions[r#"
#[lua(
as_trait = "std::cmp::PartialEq",
kind = "MetaFunction",
composite = "eq",
metamethod = "Eq",
)]
fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool;
"#,
r#"
#[lua(as_trait = "std::cmp::Eq", kind = "Method")]
fn assert_receiver_is_total_eq(&self) -> ();
"#,
r#"
#[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
fn clone(&self) -> bevy::input::gamepad::GamepadInfo;
"#,
r#"
#[lua(kind="MetaMethod", metamethod="ToString")]
fn index(&self) -> String {
format!("{:?}", _self)
}
"#]
)]
struct GamepadInfo {
name: std::string::String,
vendor_id: std::option::Option<u16>,
product_id: std::option::Option<u16>,
}
// #[derive(bevy_mod_scripting_lua_derive::LuaProxy)]
// #[proxy(
// derive(clone),
// remote = "bevy::input::gamepad::GamepadInfo",
// functions[r#"

// #[lua(
// as_trait = "std::cmp::PartialEq",
// kind = "MetaFunction",
// composite = "eq",
// metamethod = "Eq",
// )]
// fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool;

// "#,
// r#"

// #[lua(as_trait = "std::cmp::Eq", kind = "Method")]
// fn assert_receiver_is_total_eq(&self) -> ();

// "#,
// r#"

// #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
// fn clone(&self) -> bevy::input::gamepad::GamepadInfo;

// "#,
// r#"
// #[lua(kind="MetaMethod", metamethod="ToString")]
// fn index(&self) -> String {
// format!("{:?}", _self)
// }
// "#]
// )]
// struct GamepadInfo {
// name: std::string::String,
// vendor_id: std::option::Option<u16>,
// product_id: std::option::Option<u16>,
// }
#[derive(bevy_mod_scripting_lua_derive::LuaProxy)]
#[proxy(
derive(clone),
Expand Down Expand Up @@ -1818,7 +1819,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider {
>,
>()
.process_type::<LuaGamepadEvent>()
.process_type::<LuaGamepadInfo>()
// .process_type::<LuaGamepadInfo>()
.process_type::<LuaGamepadInput>()
.process_type::<LuaGamepadRumbleRequest>()
.process_type::<LuaRawGamepadAxisChangedEvent>()
Expand Down Expand Up @@ -1898,7 +1899,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider {
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadConnection>();
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadConnectionEvent>();
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadEvent>();
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadInfo>();
// app.register_foreign_lua_type::<bevy::input::gamepad::GamepadInfo>();
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadInput>();
app.register_foreign_lua_type::<bevy::input::gamepad::GamepadRumbleRequest>();
app.register_foreign_lua_type::<
Expand Down
20 changes: 10 additions & 10 deletions crates/bevy_script_api/src/providers/bevy_math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2829,13 +2829,13 @@ struct Capsule2d {
fn sagitta(&self) -> f32;
"#,
r#"
/// Returns the area of this sector
// r#"
// /// Returns the area of this sector
#[lua(kind = "Method")]
fn area(&self) -> f32;
// #[lua(kind = "Method")]
// fn area(&self) -> f32;
"#,
// "#,
r#"
#[lua(kind="MetaMethod", metamethod="ToString")]
fn index(&self) -> String {
Expand Down Expand Up @@ -2946,13 +2946,13 @@ struct CircularSector {
fn sagitta(&self) -> f32;
"#,
r#"
/// Returns the area of this segment
// r#"
// /// Returns the area of this segment
#[lua(kind = "Method")]
fn area(&self) -> f32;
// #[lua(kind = "Method")]
// fn area(&self) -> f32;
"#,
// "#,
r#"
#[lua(
Expand Down
Loading

0 comments on commit 8f93389

Please sign in to comment.