Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated bracket-bevy to Bevy 0.11.0 #342

Open
wants to merge 49 commits into
base: bevy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
606ae6c
Derive Debug trait for enums used in fastnoise module
AndreasHempel Feb 10, 2022
0bb5980
Added ability for the user to enable or disable the mouse cursor when…
Apr 30, 2022
02ec8db
Merge branch 'window-improvements' of https://github.com/IAmSegfault/…
thebracket Aug 1, 2022
4a59ecf
Merge branch 'IAmSegfault-window-improvements'
thebracket Aug 1, 2022
95fc60a
Merge branch 'noise/add-debug-derive' of https://github.com/AndreasHe…
thebracket Aug 1, 2022
adb7a1c
Merge branch 'AndreasHempel-noise/add-debug-derive'
thebracket Aug 1, 2022
f75d041
Cargo fmt run on everything.
thebracket Aug 1, 2022
71b8b3a
Improve bracket-color documentation.
thebracket Aug 1, 2022
3ab871d
Fix WGPU spin sleeper
thebracket Aug 1, 2022
6a8e091
Revert winit bump; going above 0.26 breaks wgpu support.
thebracket Aug 1, 2022
83273b5
Roll back glutin also, for winit compatibility.
thebracket Aug 1, 2022
10f2b9d
Better documentation for bracket-embedding.
thebracket Aug 1, 2022
d607395
Clippy and docs for embedding
thebracket Aug 1, 2022
b554132
Starting on docs for bracket-geometry
thebracket Aug 2, 2022
669c6b5
remove duplicate parellel function
bayou-brogrammer Aug 6, 2022
e9b0be1
remove unused function
bayou-brogrammer Aug 6, 2022
a561549
add point to bevy component ecs
bayou-brogrammer Aug 6, 2022
6a41cdb
#255 #278 (thanks for patchfx) Correctly clears fancy/flexible consol…
thebracket Aug 10, 2022
2c074c4
Remove duplicate call to post scanlines processing (#285)
patchfx Aug 10, 2022
34ba812
Get SpriteConsole's sprite sheet when rendering sprite (#287)
bilowik Aug 10, 2022
ee72146
properly clear screen (#297)
bayou-brogrammer Oct 4, 2022
9cd209e
Fix tiles incrementing each frame (#295)
patchfx Oct 4, 2022
0660ce8
Add new bresenham iterator that yield end point (#292)
indubitablement2 Oct 4, 2022
564bd03
Add option to set screen resize (#291)
nedondev Oct 4, 2022
ab957c2
re-export color mods separately (#289)
funnisimo Oct 4, 2022
d38e5dc
Merge branch 'threaded-fix' of https://github.com/lecoqjacob/bracket-…
thebracket Oct 4, 2022
e20430b
Merge branch 'lecoqjacob-threaded-fix'
thebracket Oct 4, 2022
690f32a
Merge branch 'bevy_point' of https://github.com/lecoqjacob/bracket-li…
thebracket Oct 4, 2022
fbfcb63
Merge branch 'lecoqjacob-bevy_point'
thebracket Oct 4, 2022
e195fe1
Update Criterion dependency version in random.
thebracket Oct 4, 2022
cb27aca
Update crossterm to 0.25 in bracket-geometry
thebracket Oct 4, 2022
5a43d9e
Update crossterm for bracket-noise
thebracket Oct 4, 2022
ac42fc2
Fix up dependency versions in bracket-pathfinding. Fix the a-star cal…
thebracket Oct 4, 2022
880579b
Update to latest Glutin, including the various type changes it required.
thebracket Oct 4, 2022
02bc1be
Update bracket-terminal dependencies
thebracket Oct 4, 2022
bb6cc1f
Update internal version numbers ready for a release (once we've finis…
thebracket Oct 4, 2022
ef27da0
Add example referencing issue #296 - not seeing tearing on my system?
thebracket Oct 4, 2022
c72aabd
Disable incremental linking due to Windows build issues.
thebracket Oct 4, 2022
095fbd4
Update to Rust 2021
thebracket Oct 4, 2022
51973d5
Embed fonts inside the embedding crate, to avoid cross-crate paths
thebracket Oct 4, 2022
99f48fe
Update readme
thebracket Oct 4, 2022
f94c86e
Add embedding readme
thebracket Oct 4, 2022
15ec23a
Add rex readme
thebracket Oct 4, 2022
4e44276
Change color conversion to linear RGBA rather than sRGBA. Bracket ter…
thebracket Oct 7, 2022
851f6f0
#301 Fixes wasm32-unknown-unknown build
thebracket Oct 8, 2022
0a7fcbc
Minimum required to get bracket_bevy compiling without error/warning …
thebracket Nov 15, 2022
0d2d5e6
#318 - This solves the Wayland crash on my system. More testing requi…
thebracket Jan 10, 2023
e5854d1
Updated to Bevy 0.10.1
IAmSegfault Jun 2, 2023
c21365b
Updated bracket-bevy to Bevy 0.11.0
IAmSegfault Aug 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Cargo.lock
**/wasm_help/staging
.vscode/launch.json
manual/book/*
dependency_order.md
33 changes: 12 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "bracket-lib"
version = "0.8.2"
version = "0.8.7"
authors = ["Herbert Wolverson <[email protected]>"]
edition = "2018"
edition = "2021"
publish = true
description = "Meta-crate holding the entirety of bracket-lib (and exposing it). Use this for the full roguelike toolkit experience."
homepage = "https://github.com/thebracket/bracket-lib"
Expand All @@ -23,9 +23,11 @@ exclude = [
"screenshots"
]
resolver = "2" # Enables the new Cargo resolution engine
incremental = false # Causing issues with Windows builds

[features]
default = [ "opengl" ]
bevy = ["bracket-geometry/bevy"]
specs = [ "bracket-geometry/specs" ]
serde = [ "bracket-color/serde", "bracket-geometry/serde", "bracket-random/serde" ]
threaded = [ "bracket-pathfinding/threaded" ]
Expand All @@ -35,13 +37,13 @@ crossterm = [ "bracket-terminal/cross_term" ]
webgpu = [ "bracket-terminal/webgpu" ]

[dependencies]
bracket-algorithm-traits = { path = "./bracket-algorithm-traits", version = "~0.8.2" }
bracket-color = { path = "./bracket-color", version = "~0.8.2", features = [ "palette" ] }
bracket-geometry = { path = "./bracket-geometry", version = "~0.8.2" }
bracket-noise = { path = "./bracket-noise", version = "~0.8.2" }
bracket-pathfinding = { path = "./bracket-pathfinding", version = "~0.8.2" }
bracket-random = { path = "./bracket-random", version = "~0.8.2", features = [ "parsing" ] }
bracket-terminal = { path = "./bracket-terminal", version = "~0.8.2", default-features = false }
bracket-algorithm-traits = { path = "./bracket-algorithm-traits", version = "~0.8" }
bracket-color = { path = "./bracket-color", version = "~0.8", features = [ "palette" ] }
bracket-geometry = { path = "./bracket-geometry", version = "~0.8" }
bracket-noise = { path = "./bracket-noise", version = "~0.8" }
bracket-pathfinding = { path = "./bracket-pathfinding", version = "~0.8" }
bracket-random = { path = "./bracket-random", version = "~0.8", features = [ "parsing" ] }
bracket-terminal = { path = "./bracket-terminal", version = "~0.8", default-features = false }

[workspace]
members = [
Expand All @@ -55,16 +57,5 @@ members = [
"rltk",
"bracket-rex",
"bracket-embedding",
"bracket-bevy"
"bracket-bevy",
]

# Comment this out for releases
#[patch.crates-io]
#bracket-algorithm-traits = { path = "bracket-algorithm-traits/" }
#bracket-color = { path = "bracket-color/" }
#bracket-geometry = { path = "bracket-geometry/" }
#bracket-noise = { path = "bracket-noise/" }
#bracket-pathfinding = { path = "bracket-pathfinding/" }
#bracket-random = { path = "bracket-random/" }
#bracket-terminal = { path = "bracket-terminal/" }
#rltk = { path = "rltk/" }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In your `Cargo.toml` file, include:

```toml
[dependencies]
bracket-lib = "0.7"
bracket-lib = "~0.8"
```

## Feature Flags
Expand Down
6 changes: 3 additions & 3 deletions bracket-algorithm-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "bracket-algorithm-traits"
version = "0.8.2"
version = "0.8.7"
authors = ["Herbert Wolverson <[email protected]>"]
edition = "2018"
edition = "2021"
publish = true
description = "Traits required for the bracket-* crates. Adapt your maps to the traits with Algorithm2D, Algorithm3D and BaseMap."
homepage = "https://github.com/thebracket/bracket-lib"
Expand All @@ -15,5 +15,5 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bracket-geometry = { path = "../bracket-geometry", version = "~0.8.2" }
bracket-geometry = { path = "../bracket-geometry", version = "~0.8" }
smallvec = "~1"
11 changes: 6 additions & 5 deletions bracket-bevy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bracket-bevy"
version = "0.9.0"
version = "0.11.0"
edition = "2021"
authors = ["Herbert Wolverson <[email protected]>"]
publish = true
Expand All @@ -13,13 +13,14 @@ categories = ["game-engines", "graphics"]
license = "MIT"

[dependencies]
bevy = "0.8"

bevy = "0.11.0"
parking_lot = "0.12"
lazy_static = "1.4"
bracket-random = { path = "../bracket-random" }
bracket-color = { path = "../bracket-color", features = [ "bevy" ] }
bracket-geometry = { path = "../bracket-geometry", version = "~0.8.3" }
bracket-geometry = { path = "../bracket-geometry", version = "~0.8", features = [ "bevy" ] }

[dev-dependencies]
bracket-pathfinding = { path = "../bracket-pathfinding", version = "~0.8.4" }
bracket-noise = { path = "../bracket-noise", version = "~0.8.2" }
bracket-pathfinding = { path = "../bracket-pathfinding", version = "~0.8" }
bracket-noise = { path = "../bracket-noise", version = "~0.8" }
1 change: 1 addition & 0 deletions bracket-bevy/examples/bevy_a_star_mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum Mode {
Moving,
}

#[derive(Resource)]
struct State {
map: Vec<TileType>,
player_position: usize,
Expand Down
4 changes: 2 additions & 2 deletions bracket-bevy/examples/bevy_alpha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ fn tick(ctx: Res<BracketContext>, mut state: Local<State>) {
ctx.set_active_console(0);
ctx.cls();
state.totc.print_sub_rect(
Rect::with_size(0, 0, 79, 49),
Rect::with_exact(0, 0, 79, 49),
bracket_bevy::prelude::Rect::with_size(0, 0, 79, 49),
bracket_bevy::prelude::Rect::with_exact(0, 0, 79, 49),
0,
&ctx,
);
Expand Down
4 changes: 2 additions & 2 deletions bracket-bevy/examples/bevy_colorfont.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ impl Default for TickResource {
fn tick(ctx: Res<BracketContext>, tale_of_two_cities: Local<TickResource>) {
ctx.cls();
tale_of_two_cities.0.print_sub_rect(
Rect::with_size(0, 0, 79, 25),
Rect::with_exact(0, 0, 79, 25),
bracket_bevy::prelude::Rect::with_size(0, 0, 79, 25),
bracket_bevy::prelude::Rect::with_exact(0, 0, 79, 25),
0,
&ctx,
);
Expand Down
1 change: 1 addition & 0 deletions bracket-bevy/examples/bevy_hello_terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn main() {
.run();
}

#[derive(Resource)]
struct State {
y: i32,
going_down: bool,
Expand Down
8 changes: 4 additions & 4 deletions bracket-bevy/examples/bevy_roguelike_tutorial_4/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn setup(mut commands: Commands, rng: Res<RandomNumbers>) {
let (player_x, player_y) = rooms[0].center();
commands.insert_resource(map);
commands
.spawn()
.spawn_empty()
.insert(Position {
x: player_x,
y: player_y,
Expand All @@ -40,7 +40,7 @@ fn setup(mut commands: Commands, rng: Res<RandomNumbers>) {

fn tick(
ctx: Res<BracketContext>,
map: Res<Vec<TileType>>,
map: Res<Map>,
keyboard: Res<Input<KeyCode>>,
mut queries: ParamSet<(
Query<&mut Position, With<Player>>,
Expand All @@ -54,13 +54,13 @@ fn tick(
let mut player_query = queries.p0();
let mut pos = player_query.single_mut();
let destination_idx = xy_idx(pos.x + delta.0, pos.y + delta.1);
if map[destination_idx] != TileType::Wall {
if map.0[destination_idx] != TileType::Wall {
pos.x = min(79, max(0, pos.x + delta.0));
pos.y = min(49, max(0, pos.y + delta.1));
}
}

draw_map(&map, &ctx);
draw_map(&map.0, &ctx);
for (pos, render) in queries.p1().iter() {
ctx.set(pos.x, pos.y, render.fg, render.bg, render.glyph);
}
Expand Down
8 changes: 6 additions & 2 deletions bracket-bevy/examples/bevy_roguelike_tutorial_4/map.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::rect::Rect;
use bevy::prelude::Resource;
use bracket_bevy::{
prelude::{to_cp437, RGB},
BracketContext, RandomNumbers,
Expand All @@ -11,6 +12,9 @@ pub enum TileType {
Floor,
}

#[derive(Resource)]
pub struct Map(pub Vec<TileType>);

pub fn xy_idx(x: i32, y: i32) -> usize {
(y as usize * 80) + x as usize
}
Expand Down Expand Up @@ -70,7 +74,7 @@ fn apply_vertical_tunnel(map: &mut [TileType], y1: i32, y2: i32, x: i32) {

/// Makes a new map using the algorithm from http://rogueliketutorials.com/tutorials/tcod/part-3/
/// This gives a handful of random rooms and corridors joining them together.
pub fn new_map_rooms_and_corridors(rng: &RandomNumbers) -> (Vec<Rect>, Vec<TileType>) {
pub fn new_map_rooms_and_corridors(rng: &RandomNumbers) -> (Vec<Rect>, Map) {
let mut map = vec![TileType::Wall; 80 * 50];

let mut rooms: Vec<Rect> = Vec::new();
Expand Down Expand Up @@ -109,7 +113,7 @@ pub fn new_map_rooms_and_corridors(rng: &RandomNumbers) -> (Vec<Rect>, Vec<TileT
}
}

(rooms, map)
(rooms, Map(map))
}

pub fn draw_map(map: &[TileType], ctx: &BracketContext) {
Expand Down
1 change: 1 addition & 0 deletions bracket-bevy/examples/bevy_tiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum TileType {
Floor,
}

#[derive(Resource)]
struct State {
map: Vec<TileType>,
player_position: usize,
Expand Down
1 change: 1 addition & 0 deletions bracket-bevy/examples/bevy_two_layers_two_fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fn main() {
.run();
}

#[derive(Resource)]
struct Bouncer(i32);

fn tick(ctx: Res<BracketContext>, mut bouncer: ResMut<Bouncer>) {
Expand Down
1 change: 1 addition & 0 deletions bracket-bevy/examples/bevy_walking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum TileType {
Floor,
}

#[derive(Resource)]
struct State {
map: Vec<TileType>,
visited: Vec<bool>,
Expand Down
49 changes: 23 additions & 26 deletions bracket-bevy/src/builder/bterm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use crate::{
apply_all_batches, default_gutter_size, replace_meshes, update_mouse_position,
update_timing, window_resize, ScreenScaler,
},
load_terminals, update_consoles, RandomNumbers, TerminalBuilderFont, TerminalLayer, fix_images,
fix_images, load_terminals, update_consoles, RandomNumbers, TerminalBuilderFont, TerminalLayer,
};
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::{CoreStage, Plugin, SystemStage},

prelude::{Plugin, Resource, Msaa, Startup, PostUpdate, PreUpdate, First},

utils::HashMap,
};
use bracket_color::prelude::RGBA;
Expand All @@ -19,7 +21,7 @@ pub enum TerminalScalingMode {
ResizeTerminals,
}

#[derive(Clone)]
#[derive(Clone, Resource)]
pub struct BTermBuilder {
pub(crate) fonts: Vec<TerminalBuilderFont>,
pub(crate) layers: Vec<TerminalLayer>,
Expand Down Expand Up @@ -176,37 +178,32 @@ impl BTermBuilder {

impl Plugin for BTermBuilder {
fn build(&self, app: &mut bevy::prelude::App) {
app.insert_resource(bevy::prelude::Msaa { samples: 1 });
if self.with_diagnostics {
app.add_plugin(FrameTimeDiagnosticsPlugin);
app.insert_resource(Msaa::Off);

if self.with_diagnostics {
app.add_plugins(FrameTimeDiagnosticsPlugin);
}
if self.log_diagnostics {
app.add_plugin(LogDiagnosticsPlugin::default());
app.add_plugins(LogDiagnosticsPlugin::default());
}
app.insert_resource(self.clone());
app.insert_resource(ScreenScaler::new(self.gutter));
app.add_startup_system(load_terminals);
app.add_systems(Startup, load_terminals);
if self.with_diagnostics {
app.add_stage_before(
CoreStage::Update,
"bracket_term_diagnostics",
SystemStage::single_threaded(),
);
app.add_system(update_timing);
app.add_system(update_mouse_position);
app.add_systems(First, update_timing);
app.add_systems(PreUpdate,update_mouse_position);
}
app.add_stage_after(
CoreStage::Update,
"bracket_term_update",
SystemStage::single_threaded(),
);
if self.auto_apply_batches {
app.add_system(apply_all_batches);

if self.auto_apply_batches {
app.add_systems(PostUpdate, apply_all_batches);
}
app.add_system(update_consoles);
app.add_system(replace_meshes);
app.add_system(window_resize);
app.add_system(fix_images);

//update_schedule_label
app.add_systems(PostUpdate, update_consoles);
app.add_systems(PostUpdate, replace_meshes);
app.add_systems(PostUpdate, window_resize);
app.add_systems(PostUpdate,fix_images);

if self.with_random_number_generator {
app.insert_resource(RandomNumbers::new());
}
Expand Down
25 changes: 15 additions & 10 deletions bracket-bevy/src/builder/image_fixer.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
use bevy::{prelude::*, render::{texture::ImageSampler, render_resource::SamplerDescriptor}};
use bevy::{
prelude::*,
render::{render_resource::SamplerDescriptor, texture::ImageSampler},
};

pub(crate) struct ImagesToLoad (pub(crate) Vec<HandleUntyped>);
#[derive(Resource)]
pub(crate) struct ImagesToLoad(pub(crate) Vec<HandleUntyped>);

pub(crate) fn fix_images(
mut fonts: ResMut<ImagesToLoad>,
mut images: ResMut<Assets<Image>>,
) {
pub(crate) fn fix_images(mut fonts: ResMut<ImagesToLoad>, mut images: ResMut<Assets<Image>>) {
if fonts.0.is_empty() {
return;
}

for (handle, img) in images.iter_mut() {
let mut to_remove = Vec::new();
if let Some(i) = fonts.0.iter().enumerate().find(|(_i, h)| h.id == handle) {
img.sampler_descriptor = ImageSampler::Descriptor(SamplerDescriptor{

if let Some(i) = fonts.0.iter().enumerate().find(|(_i, h)| h.id() == handle) {
img.sampler_descriptor = ImageSampler::Descriptor(SamplerDescriptor {

label: Some("LeaveItAlone"),
address_mode_u: bevy::render::render_resource::AddressMode::ClampToEdge,
address_mode_v: bevy::render::render_resource::AddressMode::ClampToEdge,
Expand All @@ -25,6 +28,8 @@ pub(crate) fn fix_images(
});
to_remove.push(i.0);
}
to_remove.iter().for_each(|i| { fonts.0.remove(*i); });
to_remove.iter().for_each(|i| {
fonts.0.remove(*i);
});
}
}
}
6 changes: 4 additions & 2 deletions bracket-bevy/src/builder/loader_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use crate::{
TerminalLayer,
};
use bevy::{
prelude::{AssetServer, Assets, Camera2dBundle, Commands, Component, Mesh, Res, ResMut, HandleUntyped},
prelude::{
AssetServer, Assets, Camera2dBundle, Commands, Component, HandleUntyped, Mesh, Res, ResMut,
},
sprite::ColorMaterial,
};

Expand All @@ -21,7 +23,7 @@ pub(crate) fn load_terminals(
) {
if context.with_ortho_camera {
commands
.spawn_bundle(Camera2dBundle::default())
.spawn(Camera2dBundle::default())
.insert(BracketCamera);
}

Expand Down
Loading