-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2445449
commit cf0bd71
Showing
22 changed files
with
76 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
use crate::reinterpret_cast; | ||
|
||
use super::*; | ||
use crate::reinterpret_cast; | ||
|
||
/// A frustum in 3-space. | ||
#[repr(C)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
use proc_macro::TokenStream; | ||
|
||
use quote::quote; | ||
use syn::{parse_macro_input, parse_quote}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use super::*; | ||
|
||
pub struct Collider2D<'w> { | ||
collider_id: ColliderId, | ||
world: &'w dyn PhysicsWorld2D, | ||
} | ||
|
||
impl<'w> Collider2D<'w> { | ||
pub fn new_rectangle(world: &'w dyn PhysicsWorld2D) -> Self { | ||
Collider2D { | ||
world, | ||
collider_id: world | ||
.collider_create_rectangle(ColliderKind::Solid, Vec2::ZERO, Vec2::ONE) | ||
.unwrap(), | ||
} | ||
} | ||
|
||
pub fn new_circle(world: &'w dyn PhysicsWorld2D) -> Self { | ||
Collider2D { | ||
world, | ||
collider_id: world | ||
.collider_create_circle(ColliderKind::Solid, Vec2::ZERO, 1.0) | ||
.unwrap(), | ||
} | ||
} | ||
|
||
pub fn position(&self) -> Vec2 { | ||
self.world.collider_get_position(self.collider_id).unwrap() | ||
} | ||
|
||
pub fn set_position(&self, position: Vec2) { | ||
self.world.collider_set_position(self.collider_id, position).unwrap(); | ||
} | ||
|
||
pub fn rotation(&self) -> f32 { | ||
self.world.collider_get_rotation(self.collider_id).unwrap() | ||
} | ||
|
||
pub fn set_rotation(&self, rotation: f32) { | ||
self.world.collider_set_rotation(self.collider_id, rotation).unwrap(); | ||
} | ||
|
||
pub fn scale(&self) -> Vec2 { | ||
self.world.collider_get_scale(self.collider_id).unwrap() | ||
} | ||
|
||
pub fn set_scale(&self, scale: Vec2) { | ||
self.world.collider_set_scale(self.collider_id, scale).unwrap(); | ||
} | ||
} | ||
|
||
impl<'w> Drop for Collider2D<'w> { | ||
fn drop(&mut self) { | ||
self.world.collider_delete(self.collider_id).unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters