-
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
0 parents
commit 25569d7
Showing
52 changed files
with
1,596 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- "*" # Push events to every tag not containing / | ||
workflow_dispatch: | ||
|
||
name: Publish | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 && cargo publish --token ${CRATES_TOKEN} | ||
env: | ||
CRATES_TOKEN: ${{secrets.CRATES_TOKEN}} |
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,2 @@ | ||
/target | ||
Cargo.lock |
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,31 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## 0.4.13 (2024-06-15) | ||
|
||
### Commit Statistics | ||
|
||
<csr-read-only-do-not-edit/> | ||
|
||
- 5 commits contributed to the release over the course of 7 calendar days. | ||
- 0 commits were understood as [conventional](https://www.conventionalcommits.org). | ||
- 0 issues like '(#ID)' were seen in commit messages | ||
|
||
### Commit Details | ||
|
||
<csr-read-only-do-not-edit/> | ||
|
||
<details><summary>view details</summary> | ||
|
||
* **Uncategorized** | ||
- Changelog update ([`b1e2ed8`](https://github.com/Jasper-J-R/DreamLighters/commit/b1e2ed8f0f45068d69f2abc7491ec215ff74b62e)) | ||
- Changelog update ([`65ed17a`](https://github.com/Jasper-J-R/DreamLighters/commit/65ed17aaa6b53a10a2b6b5a53a68d5ee529b0f12)) | ||
- Changelog update ([`f79d1f6`](https://github.com/Jasper-J-R/DreamLighters/commit/f79d1f65c57049608cfb309697a57ec7ca3f8120)) | ||
- Merge fixes ([`b19a364`](https://github.com/Jasper-J-R/DreamLighters/commit/b19a364a6c8fc3115229b2f2cccd616580ea81bc)) | ||
- Workspace prep ([`c56a2ba`](https://github.com/Jasper-J-R/DreamLighters/commit/c56a2bad76a16f31195fcd27f12f7bced2189479)) | ||
</details> | ||
|
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 @@ | ||
[package] | ||
name = "bevy-basic-ui" | ||
version = "0.5.13" | ||
description = "A small manager for menus and huds" | ||
repository = "https://github.com/KyleWinston/bevy-ui" | ||
license = "MIT OR Apache-2.0" | ||
edition = "2021" | ||
publish = true | ||
|
||
keywords = ["bevy", "menus", "ui"] | ||
# exclude = ["/examples"] | ||
|
||
[dependencies] | ||
serde = "1.0.99" | ||
bevy = { version = "0.14.0", default-features = false, features = [ | ||
"bevy_core_pipeline", | ||
"bevy_sprite", | ||
"bevy_state", | ||
"bevy_winit", | ||
"multi_threaded", | ||
"bevy_text", | ||
"png", | ||
] } | ||
bevy-settings = "0.6.0" | ||
bevy_third_person_camera = "0.1.11" | ||
bevy_common_assets = { version = "0.11.0", features = ["toml"] } | ||
async-executor = "1.12.0" | ||
bevy_lunex = "0.2.2" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,10 @@ | ||
categories = [ | ||
{ name = 'control settings', contents = [ | ||
{ tag = "Vertical Mouse Sensitivity", value = 20 }, | ||
{ tag = "Horizontal Mouse Sensitivity", value = 20 }, | ||
] }, | ||
{ name = 'hud settings', contents = [ | ||
{ tag = "Hide Hotbar When Unfocused", value = 1 }, | ||
{ tag = "Toggle Sprint", value = 0 }, | ||
] } | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
use bevy::prelude::*; | ||
use bevy_basic_ui::prelude::*; | ||
|
||
fn main() { | ||
App::new() | ||
.init_state::<UiState>() | ||
.init_state::<SimulationState>() | ||
.add_plugins(( | ||
DefaultPlugins, | ||
UiScreensPlugin { | ||
title: "Test".to_string(), | ||
}, | ||
)) | ||
.run(); | ||
} |
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::*; | ||
|
||
#[derive(Component, Clone)] | ||
pub struct Ui3d; | ||
|
||
#[derive(Component, Clone)] | ||
pub struct Quit; | ||
|
||
#[derive(Component)] | ||
pub struct UiMainRootNode; | ||
|
||
#[derive(Component)] | ||
pub struct UiFooterRootNode; | ||
|
||
#[derive(Component, Clone)] | ||
pub struct MainCam; | ||
|
||
#[derive(Component)] | ||
pub struct SettingsButton; |
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,7 @@ | ||
use bevy::prelude::*; | ||
|
||
#[derive(Component)] | ||
pub struct Hud; | ||
|
||
#[derive(Component)] | ||
pub struct UiDisplay; |
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,15 @@ | ||
use bevy::prelude::*; | ||
use bevy_lunex::UiSystems; | ||
use systems::build_hud; | ||
|
||
|
||
pub mod components; | ||
pub mod systems; | ||
|
||
pub struct HudPlugin; | ||
|
||
impl Plugin for HudPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_systems(PreUpdate, build_hud.before(UiSystems::Compute)); | ||
} | ||
} |
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,127 @@ | ||
use bevy::{ | ||
core_pipeline::fxaa::Fxaa, | ||
pbr::ScreenSpaceReflectionsBundle, | ||
prelude::*, | ||
render::render_resource::{ | ||
Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, | ||
}, | ||
window::PrimaryWindow, | ||
}; | ||
use bevy_lunex::{ | ||
prelude::{MainUi, Pickable, Rl, Scaling, UiNodeTreeInitTrait, UiTree}, | ||
Base, MovableByCamera, PackageLayout, PickingPortal, UiImage2dBundle, UiLayout, UiLink, | ||
UiTreeBundle, | ||
}; | ||
use bevy_third_person_camera::{ThirdPersonCamera, Zoom}; | ||
|
||
use super::components::{Hud, UiDisplay}; | ||
use crate::components::MainCam; | ||
|
||
pub fn build_hud( | ||
mut commands: Commands, | ||
asset_server: Res<AssetServer>, | ||
primary_window: Query<&Window, With<PrimaryWindow>>, | ||
query: Query<Entity, Added<Hud>>, | ||
) { | ||
for route_entity in &query { | ||
if let Ok(window) = primary_window.get_single() { | ||
let (env_pth, env_suffix) = ("images/environment_maps/pisa_", "_rgb9e5_zstd.ktx2"); | ||
let resolution = &window.resolution; | ||
let w_size = (resolution.width(), resolution.height()); | ||
let size = Extent3d { | ||
width: w_size.0 as u32, | ||
height: w_size.1 as u32, | ||
..default() | ||
}; | ||
|
||
let mut image = Image { | ||
texture_descriptor: TextureDescriptor { | ||
label: None, | ||
size, | ||
dimension: TextureDimension::D2, | ||
format: TextureFormat::Bgra8UnormSrgb, | ||
mip_level_count: 1, | ||
sample_count: 1, | ||
usage: TextureUsages::TEXTURE_BINDING | ||
| TextureUsages::COPY_DST | ||
| TextureUsages::RENDER_ATTACHMENT, | ||
view_formats: &[], | ||
}, | ||
..default() | ||
}; | ||
|
||
// Spawn the route | ||
commands | ||
.entity(route_entity) | ||
.insert(SpatialBundle::default()) | ||
.with_children(|route| { | ||
image.resize(size); | ||
let render_image = asset_server.add(image); | ||
//player_slot | ||
route | ||
.spawn((SpatialBundle::default(), MainCam)) | ||
.with_children(|route| { | ||
// Spawn 3D camera | ||
route.spawn(( | ||
Camera3dBundle { | ||
camera: Camera { | ||
order: -1, | ||
target: render_image.clone().into(), | ||
clear_color: ClearColorConfig::Default, | ||
..default() | ||
}, | ||
projection: Projection::Perspective(PerspectiveProjection { | ||
fov: 60.0_f32.to_radians(), | ||
..default() | ||
}), | ||
..default() | ||
}, | ||
VisibilityBundle::default(), | ||
ThirdPersonCamera { | ||
aim_enabled: true, | ||
aim_speed: 6.0, | ||
aim_zoom: 0.7, | ||
zoom: Zoom::new(5.5, 10.0), | ||
sensitivity: Vec2::splat(4.0), | ||
..default() | ||
}, | ||
ScreenSpaceReflectionsBundle::default(), | ||
Fxaa::default(), | ||
EnvironmentMapLight { | ||
diffuse_map: asset_server | ||
.load(env_pth.to_string() + "diffuse" + env_suffix), | ||
specular_map: asset_server | ||
.load(env_pth.to_string() + "specular" + env_suffix), | ||
intensity: 400.0, | ||
}, | ||
)); | ||
}); | ||
// Spawn the background | ||
route | ||
.spawn(( | ||
UiTreeBundle::<MainUi>::from(UiTree::new("HUD")), | ||
UiLayout::window().size(Rl(w_size)).pack::<Base>(), | ||
MovableByCamera, | ||
UiDisplay, | ||
)) | ||
.with_children(|ui| { | ||
// Spawn 3D camera view | ||
ui.spawn(( | ||
UiLink::<MainUi>::path("Camera"), | ||
UiLayout::window().size(Rl(100.0)).pack::<Base>(), // Make this resizable | ||
UiImage2dBundle::from(render_image), | ||
PickingPortal, | ||
)); | ||
ui.spawn(( | ||
UiLink::<MainUi>::path("Camera/Hud"), | ||
UiLayout::solid() | ||
.size(Rl(100.0)) | ||
.scaling(Scaling::Fit) | ||
.pack::<Base>(), | ||
Pickable::IGNORE, | ||
)); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
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,74 @@ | ||
use bevy::prelude::*; | ||
use bevy_lunex::{UiGenericPlugin, UiPlugin}; | ||
use bevy_third_person_camera::ThirdPersonCameraPlugin; | ||
use components::Ui3d; | ||
use hud::HudPlugin; | ||
use loading::LoadingPlugin; | ||
use main_menu::MainMenuPlugin; | ||
use pause::PausePlugin; | ||
use prelude::*; | ||
use resources::GameTitle; | ||
use settings::SettingsUiPlugin; | ||
use splash::SplashPlugin; | ||
use systems::{exit, init_ui_cam}; | ||
use widgets::WidgetPlugins; | ||
|
||
pub mod prelude { | ||
use bevy::{prelude::Component, reflect::Reflect, state::state::States}; | ||
|
||
#[derive(Default, States, Debug, Reflect, Hash, Eq, PartialEq, Clone)] | ||
pub enum SimulationState { | ||
#[default] | ||
Running, | ||
Paused, | ||
} | ||
|
||
#[derive(Default, States, Component, Reflect, Debug, Hash, Eq, PartialEq, Clone)] | ||
pub enum UiState { | ||
MainMenu, | ||
Loading, | ||
Settings, | ||
Hud, | ||
#[default] | ||
Splash, | ||
Debug, | ||
} | ||
#[derive(Clone)] | ||
pub struct UiScreensPlugin { | ||
pub title: String, | ||
} | ||
} | ||
|
||
pub mod components; | ||
pub mod hud; | ||
pub mod loading; | ||
pub mod main_menu; | ||
pub mod pause; | ||
pub mod resources; | ||
pub mod settings; | ||
pub mod splash; | ||
pub mod styles; | ||
pub mod systems; | ||
pub mod widgets; | ||
|
||
impl Plugin for UiScreensPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.insert_resource(GameTitle(self.title.clone())) | ||
.add_plugins(( | ||
ThirdPersonCameraPlugin, | ||
MainMenuPlugin, | ||
PausePlugin, | ||
SettingsUiPlugin, | ||
SplashPlugin, | ||
HudPlugin, | ||
WidgetPlugins, | ||
UiPlugin, | ||
LoadingPlugin, | ||
UiGenericPlugin::<Ui3d>::new(), | ||
)) | ||
.init_state::<SimulationState>() | ||
.init_state::<UiState>() | ||
.add_systems(Startup, init_ui_cam) | ||
.add_systems(Update, exit); | ||
} | ||
} |
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,4 @@ | ||
use bevy::prelude::*; | ||
|
||
#[derive(Component)] | ||
pub struct Loading(pub Option<String>); |
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,26 @@ | ||
use bevy::prelude::*; | ||
use bevy_lunex::UiSystems; | ||
use components::Loading; | ||
use systems::build_loading; | ||
|
||
use crate::UiState; | ||
|
||
pub mod components; | ||
mod styles; | ||
mod systems; | ||
|
||
pub struct LoadingPlugin; | ||
|
||
impl Plugin for LoadingPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_systems(PreUpdate, build_loading.before(UiSystems::Compute)); | ||
app.add_systems( | ||
OnExit(UiState::Loading), | ||
|mut commands: Commands, load_q: Query<Entity, With<Loading>>| { | ||
if let Ok(load) = load_q.get_single() { | ||
commands.entity(load).despawn_recursive(); | ||
} | ||
}, | ||
); | ||
} | ||
} |
Oops, something went wrong.