diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..f0d2fc9 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,33 @@ +# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below. + +# NOTE: For maximum performance, build using a nightly compiler +# If you are using rust stable, remove the "-Zshare-generics=y" below. + +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-Clink-arg=-fuse-ld=mold", "-Zshare-generics=y"] + +# NOTE: you must install [Mach-O LLD Port](https://lld.llvm.org/MachO/index.html) on mac. you can easily do this by installing llvm which includes lld with the "brew" package manager: +# `brew install llvm` +[target.x86_64-apple-darwin] +rustflags = [ + "-C", + "link-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld", + "-Zshare-generics=y", +] + +[target.aarch64-apple-darwin] +rustflags = [ + "-C", + "link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld", + "-Zshare-generics=y", +] + +[target.x86_64-pc-windows-msvc] +linker = "rust-lld.exe" +rustflags = ["-Zshare-generics=n"] + +# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only' +# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains. +#[profile.dev] +#debug = 1 diff --git a/assets/emoticons.png b/assets/emoticons.png new file mode 100644 index 0000000..63f0126 Binary files /dev/null and b/assets/emoticons.png differ diff --git a/assets/game.png b/assets/game.png new file mode 100644 index 0000000..750e09b Binary files /dev/null and b/assets/game.png differ diff --git a/assets/generic_clear.png b/assets/generic_clear.png new file mode 100644 index 0000000..9d347d0 Binary files /dev/null and b/assets/generic_clear.png differ diff --git a/assets/generic_unhookable_0.7.png b/assets/generic_unhookable_0.7.png new file mode 100644 index 0000000..d7ba290 Binary files /dev/null and b/assets/generic_unhookable_0.7.png differ diff --git a/assets/particles.png b/assets/particles.png new file mode 100644 index 0000000..0f3cd17 Binary files /dev/null and b/assets/particles.png differ diff --git a/assets/skins/coala_bluekitty.png b/assets/skins/coala_bluekitty.png new file mode 100644 index 0000000..7aae439 Binary files /dev/null and b/assets/skins/coala_bluekitty.png differ diff --git a/assets/skins/default.png b/assets/skins/default.png new file mode 100644 index 0000000..f167dde Binary files /dev/null and b/assets/skins/default.png differ diff --git a/src/entity.rs b/src/entity.rs deleted file mode 100644 index 26a6fc8..0000000 --- a/src/entity.rs +++ /dev/null @@ -1 +0,0 @@ -use bevy::prelude::*; diff --git a/src/main.rs b/src/main.rs index 3189de0..cebe712 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,19 +1,27 @@ use bevy::prelude::*; use bevy_inspector_egui::quick::WorldInspectorPlugin; +use physics::Velocity; -pub mod entity; +pub mod physics; pub mod player; +pub mod tee; fn main() { App::new() + .register_type::() .add_plugins(DefaultPlugins) .add_plugin(WorldInspectorPlugin::new()) + .add_startup_system(general_setup) .add_startup_system(player::add_player) + .add_system(player::player_input.before(physics::move_system)) + .add_system(player::player_mouse.before(physics::move_system)) + .add_system(physics::move_system) .run(); } -fn print_position_system(query: Query<&Transform>) { - for transform in &query { - println!("position: {:?}", transform.translation); - } +#[derive(Component)] +pub struct MainCamera; + +fn general_setup(mut commands: Commands, server: Res) { + commands.spawn((Camera2dBundle::default(), MainCamera)); } diff --git a/src/physics.rs b/src/physics.rs new file mode 100644 index 0000000..53750f7 --- /dev/null +++ b/src/physics.rs @@ -0,0 +1,27 @@ +use bevy::prelude::*; + +#[derive(Debug, Reflect, Component, Default, Clone)] +pub struct Velocity { + pub vel: Vec2, + pub speed: f32, +} + +impl Velocity { + pub fn new(speed: f32) -> Self { + Self { + speed, + ..Default::default() + } + } +} + +#[derive(Component)] +pub struct BoundingBox { + pub rect: Rect, +} + +pub fn move_system(mut query: Query<(&Velocity, &mut Transform)>, time: Res