change rb api
This commit is contained in:
parent
900d1579ee
commit
78eca45723
3 changed files with 6 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
|||
Vec3 = Bevy::Vec3
|
||||
|
||||
def test_func
|
||||
rust_func(Vec3.new(1.5, 2.5, -3.5))
|
||||
rust_func(Bevy::Vec3.new(1.5, 2.5, -3.5))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
def test_func(vec3)
|
||||
raise unless vec3.is_a?(Vec3) # TODO: BevyScriptum::Vec3 and add example how to include it globally like Sinatra does
|
||||
raise unless vec3.is_a?(Bevy::Vec3) # TODO: BevyScriptum::Vec3 and add example how to include it globally like Sinatra does
|
||||
raise unless vec3.x == 1.5
|
||||
raise unless vec3.y == 2.5
|
||||
raise unless vec3.z == -3.5
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ impl TryConvert for BevyEntity {
|
|||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[magnus::wrap(class = "Vec3")]
|
||||
#[magnus::wrap(class = "Bevy::Vec3")]
|
||||
pub struct BevyVec3(pub Vec3);
|
||||
|
||||
impl BevyVec3 {
|
||||
|
|
@ -229,7 +229,7 @@ impl Default for RubyRuntime {
|
|||
let promise = module.define_class("Promise", ruby.class_object())?;
|
||||
promise.define_method("and_then", magnus::method!(then, 0))?;
|
||||
|
||||
let vec3 = ruby.define_class("Vec3", ruby.class_object())?;
|
||||
let vec3 = module.define_class("Vec3", ruby.class_object())?;
|
||||
vec3.define_singleton_method("new", function!(BevyVec3::new, 3))?;
|
||||
vec3.define_method("x", method!(BevyVec3::x, 0))?;
|
||||
vec3.define_method("y", method!(BevyVec3::y, 0))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue