Skip to content

Commit

Permalink
exposed rendering type
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelselleck authored and warfaj committed Feb 13, 2024
1 parent 7ef9dd2 commit a4e560b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions pax-engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub extern crate pax_macro;
pub use pax_macro::*;

pub use pax_runtime::api;
pub use pax_runtime::rendering;

pub use pax_runtime::api::log;
pub use pax_runtime::api::serde;
Expand Down
39 changes: 35 additions & 4 deletions pax-runtime/src/rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::any::Any;
use std::cell::RefCell;

use std::iter;
use std::ops::Mul;
use std::ops::{Add, Div, Mul, Sub};
use std::rc::Rc;

use crate::api::{CommonProperties, RenderContext};
Expand Down Expand Up @@ -33,10 +33,41 @@ pub struct InstantiationArgs {
pub component_type_id: String,
}

#[derive(Copy, Clone)]
#[derive(Copy, Clone, Default)]
pub struct Point2D {
x: f64,
y: f64,
pub x: f64,
pub y: f64,
}

impl Add<Point2D> for Point2D {
type Output = Point2D;

fn add(self, rhs: Point2D) -> Self::Output {
Self::Output {
x: self.x + rhs.x,
y: self.y + rhs.y,
}
}
}

impl Sub<Point2D> for Point2D {
type Output = Point2D;
fn sub(self, rhs: Point2D) -> Self::Output {
Self::Output {
x: self.x - rhs.x,
y: self.y - rhs.y,
}
}
}

impl Div<f64> for Point2D {
type Output = Point2D;
fn div(self, rhs: f64) -> Self::Output {
Self::Output {
x: self.x / rhs,
y: self.y / rhs,
}
}
}

impl Point2D {
Expand Down

0 comments on commit a4e560b

Please sign in to comment.