pr47/std47/
math.rs

1use pr47_codegen::pr47_function_bind;
2use xjbutil::void::Void;
3
4use crate::data::traits::StaticBase;
5
6pub struct Vec2(f64, f64);
7pub struct Vec3(f64, f64, f64);
8pub struct Vec4(f64, f64, f64, f64);
9
10impl StaticBase<Vec2> for Void {
11    fn type_name() -> String { "std.math.Vec2".to_string() }
12}
13
14impl StaticBase<Vec3> for Void {
15    fn type_name() -> String { "std.math.Vec3".to_string() }
16}
17
18impl StaticBase<Vec4> for Void {
19    fn type_name() -> String { "std.math.Vec4".to_string() }
20}
21
22#[pr47_function_bind(local)]
23pub fn vec2_new(x: f64, y: f64) -> Vec2 { Vec2(x, y) }
24
25#[pr47_function_bind(local)]
26pub fn vec3_new(x: f64, y: f64, z: f64) -> Vec3 { Vec3(x, y, z) }
27
28#[pr47_function_bind(local)]
29pub fn vec4_new(x: f64, y: f64, z: f64, t: f64) -> Vec4 { Vec4(x, y, z, t) }