-
-
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
363e082
commit 8638309
Showing
13 changed files
with
845 additions
and
1,887 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 2D, not 3D | ||
|
||
In 2D physics-space, rendering-space, and screen-space are basically the same thing. We can hand-wave away translations | ||
therein and all the complexities of visualizing information about a 3D volume in 2D screen-space. | ||
|
||
2D simulation space was selected mainly because it simplifies visualizations of information like gravitational potential | ||
over large areas and it makes the use of compute shaders simpler as well. For example, offloading those gravity field | ||
calculations to the GPU with a shader and then recovering that information back on the CPU later. |
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
Empty file.
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,5 @@ | ||
//! Color palette | ||
use bevy::color::Color; | ||
|
||
pub const BEVY_GRAY: Color = Color::srgb(0.157, 0.157, 0.157); | ||
pub const TERMINAL_GREEN: Color = Color::hsl(118.882, 0.535, 0.109); |
Empty file.
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,11 @@ | ||
use bevy::prelude::*; | ||
use bevy_pancam::{PanCam, PanCamPlugin}; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_plugins(PanCamPlugin::default()); | ||
app.add_systems(Startup, init_camera); | ||
} | ||
|
||
fn init_camera(mut commands: Commands) { | ||
commands.spawn((Camera2dBundle::default(), PanCam::default())); | ||
} |
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,19 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_picking::prelude::*; | ||
|
||
pub struct CursorPlugin; | ||
|
||
impl Plugin for CursorPlugin { | ||
fn build(&self, app: &mut App) { | ||
let debug_level: DebugPickingMode; | ||
#[cfg(not(feature = "dev"))] | ||
{ | ||
debug_level = DebugPickingMode::Disabled; | ||
} | ||
#[cfg(feature = "dev")] | ||
{ | ||
debug_level = DebugPickingMode::Normal; | ||
} | ||
app.add_plugins(DefaultPickingPlugins).insert_resource(debug_level); | ||
} | ||
} |
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,28 @@ | ||
mod camera; | ||
mod cursor; | ||
mod shell; | ||
|
||
use bevy::{app::PluginGroupBuilder, prelude::*}; | ||
|
||
pub struct UserInterfacePlugins; | ||
|
||
impl PluginGroup for UserInterfacePlugins { | ||
fn build(self) -> PluginGroupBuilder { | ||
PluginGroupBuilder::start::<Self>() | ||
.add(bevy_egui::EguiPlugin) | ||
.add(camera::plugin) | ||
.add(shell::plugin) | ||
.add(DebugExtrasPlugin) | ||
} | ||
} | ||
|
||
/// Optionally adds more debug utility interfaces to the UI | ||
struct DebugExtrasPlugin; | ||
|
||
impl Plugin for DebugExtrasPlugin { | ||
fn build(&self, app: &mut App) { | ||
|
||
#[cfg(feature = "dev")] | ||
app.add_plugins(bevy_inspector_egui::quick::WorldInspectorPlugin::default()); | ||
} | ||
} |
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,22 @@ | ||
use bevy::prelude::*; | ||
use bevy_egui::{egui, EguiContexts}; | ||
|
||
/// The main Ui that contains everything else. This should be just Egui sugar that triggers events handled elsewhere. | ||
pub(super) fn plugin(app: &mut App) { | ||
app.add_systems(Update, update_shell); | ||
} | ||
|
||
fn update_shell(mut egui_ctx: EguiContexts, time: Res<Time>) { | ||
let ctx = egui_ctx.ctx_mut(); | ||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { | ||
egui::menu::bar(ui, |ui| { | ||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { | ||
egui::warn_if_debug_build(ui); | ||
ui.label(format!( | ||
"Elapsed Time: {:.2} seconds", | ||
time.elapsed_seconds() | ||
)); | ||
}); | ||
}); | ||
}); | ||
} |