Skip to content

Commit

Permalink
WIP: start editor
Browse files Browse the repository at this point in the history
  • Loading branch information
sim82 committed Dec 31, 2023
1 parent 07756c5 commit 8c60ffa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bevy = { version = "0.12"}
bevy_rapier2d = { version = "0.23", features = ["serde-serialize"] }
bevy-inspector-egui = { version = "0.21", optional = true }
# bevy_prototype_debug_lines = "0.12"
# bevy_mouse_tracking_plugin = "0.6"
bevy_mouse_tracking_plugin = "0.7"
bevy_egui = "0.23"
hexagon_tiles = "0.1"
bevy_prototype_lyon = "0.10"
Expand Down
5 changes: 3 additions & 2 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use bevy::{
core_pipeline::{bloom::BloomSettings, tonemapping::Tonemapping},
prelude::*,
};
use bevy_mouse_tracking_plugin::{mouse_pos::InitMouseTracking, MainCamera};
// use bevy_mouse_tracking_plugin::prelude::*;

#[derive(Component, Default)]
Expand All @@ -21,8 +22,8 @@ fn setup_camera_system(mut commands: Commands) {
// BloomSettings::SCREEN_BLUR,
BloomSettings::default(),
))
// .add(InitMouseTracking)
;
.add(InitMouseTracking)
.insert(MainCamera);
}

fn track_camera_system(
Expand Down
13 changes: 13 additions & 0 deletions src/edit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use bevy::prelude::*;
use bevy_mouse_tracking_plugin::{MousePos, MousePosWorld};

fn mouse_input_system(mouse_pos: Res<MousePosWorld>) {
info!("mouse pos: {:?}", mouse_pos);
}

pub struct EditPlugin;
impl Plugin for EditPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Update, mouse_input_system);
}
}
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use bevy::{
prelude::*,
};
use bevy_egui::EguiPlugin;
use bevy_mouse_tracking_plugin::mouse_pos::MousePosPlugin;
// use bevy_prototype_debug_lines::DebugLinesPlugin;
use bevy_prototype_lyon::plugin::ShapePlugin;
use clap::Parser;
Expand All @@ -16,9 +17,9 @@ use hexagon_tiles::{
use menu::MenuState;

use crate::{
debug_ui::DebugUiPlugin, game::GamePlugin, hexton::HextonPlugin, menu::MenuPlugin,
particle::ParticlePlugin, player::PlayerPlugin, portal::PortalPlugin, prelude::*,
ship::ShipPlugin, state::StatePlugin, weapon::WeaponPlugin,
debug_ui::DebugUiPlugin, edit::EditPlugin, game::GamePlugin, hexton::HextonPlugin,
menu::MenuPlugin, particle::ParticlePlugin, player::PlayerPlugin, portal::PortalPlugin,
prelude::*, ship::ShipPlugin, state::StatePlugin, weapon::WeaponPlugin,
};

pub mod collision;
Expand Down Expand Up @@ -72,6 +73,7 @@ pub mod collision_groups {
pub const LEVEL: Group = Group::GROUP_3;
}
pub mod debug_ui;
pub mod edit;
pub mod game;
pub mod menu;
pub mod player;
Expand Down Expand Up @@ -203,6 +205,7 @@ impl PluginGroup for DefaultPlugins {
.add(DefaultPlugin)
// bevy_rapier plugins
.add(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0))
.add(MousePosPlugin)
.add(input::InputPlugin)
.add(droid::DroidPlugin)
.add(droid::ai::AiPlugin)
Expand All @@ -220,7 +223,8 @@ impl PluginGroup for DefaultPlugins {
.add(MenuPlugin)
.add(GamePlugin)
.add(PlayerPlugin)
.add(StatePlugin);
.add(StatePlugin)
.add(EditPlugin);

// egui plugins
#[cfg(feature = "inspector")]
Expand Down

0 comments on commit 8c60ffa

Please sign in to comment.