Skip to content

Commit

Permalink
Fixing readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhuagh committed Feb 9, 2018
1 parent 89bffc6 commit 8b544e2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 61 deletions.
59 changes: 0 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,5 @@
Physics library for use in Specs, using cgmath and collision-rs.

# Example

```rust
extern crate cgmath;
extern crate rhusics;
extern crate shrev;
extern crate specs;

use cgmath::{Point2, Rad, Rotation2, Transform};
use shrev::EventChannel;
use specs::{RunNow, World};

use rhusics::ecs::collide::prelude2d::{register_collision, BasicCollisionSystem2, BodyPose2,
BroadBruteForce2, CollisionMode, CollisionShape2,
CollisionStrategy, ContactEvent2, GJK2, Rectangle};

pub fn main() {
let mut world = World::new();
register_collision::<f32, BodyPose2<f32>, ()>(&mut world);

let mut reader_1 = world
.write_resource::<EventChannel<ContactEvent2<f32>>>()
.register_reader();

world
.create_entity()
.with(CollisionShape2::<f32, BodyPose2<f32>, ()>::new_simple(
CollisionStrategy::FullResolution,
CollisionMode::Discrete,
Rectangle::new(10., 10.).into(),
))
.with(BodyPose2::<f32>::one());

world
.create_entity()
.with(CollisionShape2::<f32, BodyPose2<f32>, ()>::new_simple(
CollisionStrategy::FullResolution,
CollisionMode::Discrete,
Rectangle::new(10., 10.).into(),
))
.with(BodyPose2::new(
Point2::new(3., 2.),
Rotation2::from_angle(Rad(0.)),
));

let mut system = BasicCollisionSystem2::<f32, BodyPose2<f32>, ()>::new()
.with_broad_phase(BroadBruteForce2::default())
.with_narrow_phase(GJK2::new());
system.run_now(&world.res);
println!(
"Contacts: {:?}",
world
.read_resource::<EventChannel<ContactEvent2<f32>>>()
.read(&mut reader_1)
.collect::<Vec<_>>()
);
}
```

# Features:

* Has support for all primitives in collision-rs
Expand Down
2 changes: 1 addition & 1 deletion rhusics-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://github.com/rustgd/rhusics.git"

license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://docs.rs/rhusics"
documentation = "https://docs.rs/rhusics-core"
description = "Physics library for use with `specs`"

keywords = ["gamedev", "cgmath", "specs", "physics"]
Expand Down
2 changes: 1 addition & 1 deletion rhusics-ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://github.com/rustgd/rhusics.git"

license = "MIT OR Apache-2.0"
readme = "README.md"
documentation = "https://docs.rs/rhusics"
documentation = "https://docs.rs/rhusics-ecs"
description = "Physics library for use with `specs`"

keywords = ["gamedev", "cgmath", "specs", "physics"]
Expand Down

0 comments on commit 8b544e2

Please sign in to comment.