Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2,688 changes: 1,234 additions & 1,454 deletions Cargo.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn get_bones_input(
key_events: keyboard_events
.iter()
.map(|event| bones::KeyboardEvent {
scan_code: event.scan_code,
scan_code: bones::Set(event.scan_code),
key_code: event.key_code.map(|x| x.into_bones()).into(),
button_state: event.state.into_bones(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl BonesImageIds {
bevy_egui_textures: &mut bevy_egui::EguiUserTextures,
) {
for entry in bones_assets.store.asset_ids.iter() {
let handle = entry.key();
let handle: &bones::UntypedHandle = entry.key();
let cid = entry.value();
let mut asset = bones_assets.store.assets.get_mut(cid).unwrap();
if let Ok(image) = asset.data.try_cast_mut::<bones::Image>() {
Expand Down Expand Up @@ -77,7 +77,8 @@ impl BonesImageIds {
if let bones::Image::Data(data) = taken_image {
let handle = bevy_images.add(Image::from_dynamic(data, true));
let egui_texture = bevy_egui_textures.add_image(handle.clone());
bones_egui_textures.insert(bones_handle, egui_texture);
// Broke when updating bones egui to 0.30
//bones_egui_textures.insert(bones_handle, egui_texture);
map.insert(*next_id, handle);
*image = bones::Image::External(*next_id);
*next_id += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pub fn setup_egui(world: &mut World) {
};

// Insert the egui context as a shared resource
game.insert_shared_resource(bones::EguiCtx(ctx.clone()));
// Broke when updating bones egui to 0.30
//game.insert_shared_resource(bones::EguiCtx(ctx.clone()));

if let Some(bones_assets) = &game.asset_server() {
update_egui_fonts(&ctx, bones_assets);
Expand All @@ -34,7 +35,8 @@ pub fn egui_input_hook(
if let Some(hook) = game.shared_resource_cell::<bones::EguiInputHook>() {
let hook = hook.borrow().unwrap();
let mut egui_input = egui_query.get_single_mut().unwrap();
(hook.0)(&mut game, &mut egui_input);
// Broke when updating bones egui to 0.30
//(hook.0)(&mut game, &mut egui_input);
}
}

Expand All @@ -57,6 +59,7 @@ pub fn update_egui_fonts(ctx: &bevy_egui::egui::Context, bones_assets: &bones::A
let mut fonts = egui::FontDefinitions::default();

for entry in bones_assets.store.assets.iter() {
/*Broke when updating bones egui to 0.30
let asset = entry.value();
if let Ok(font) = asset.try_cast_ref::<bones::Font>() {
let previous = fonts
Expand All @@ -75,6 +78,7 @@ pub fn update_egui_fonts(ctx: &bevy_egui::egui::Context, bones_assets: &bones::A
.or_default()
.push(font.family_name.to_string());
}
*/
}

ctx.set_fonts(fonts);
Expand Down
2 changes: 1 addition & 1 deletion demos/asset_packs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ publish = false

[dependencies]
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
bones_wgpu_renderer = { path = "../../framework_crates/bones_wgpu_renderer" }
6 changes: 3 additions & 3 deletions demos/asset_packs/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bones_bevy_renderer::BonesBevyRenderer;
use bones_wgpu_renderer::BonesWgpuRenderer;
use bones_framework::prelude::*;

//
Expand Down Expand Up @@ -55,7 +55,7 @@ fn main() {
.add_system_to_stage(Update, menu_system);
});

BonesBevyRenderer::new(game).app().run();
BonesWgpuRenderer::new(game).run();
}

/// System to render the home menu.
Expand All @@ -65,7 +65,7 @@ fn menu_system(
all_packs: AllPacksData<GameMeta, PackMeta>,
) {
egui::CentralPanel::default()
.frame(egui::Frame::none().outer_margin(egui::Margin::same(32.0)))
.frame(egui::Frame::new().outer_margin(egui::epaint::Marginf::same(32.0)))
.show(&egui_ctx, |ui| {
// Use the title that has been loaded from the asset
ui.heading(&core_meta.title);
Expand Down
2 changes: 1 addition & 1 deletion demos/assets_minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ publish = false

[dependencies]
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
bones_wgpu_renderer = { path = "../../framework_crates/bones_wgpu_renderer" }
9 changes: 3 additions & 6 deletions demos/assets_minimal/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bones_bevy_renderer::BonesBevyRenderer;
use bones_wgpu_renderer::BonesWgpuRenderer;
use bones_framework::prelude::*;

//
Expand Down Expand Up @@ -44,10 +44,7 @@ fn main() {
// Add our menu system to the update stage
.add_system_to_stage(Update, menu_system);

// Finalize session and register with game sessions.
menu_session_builder.finish_and_add(&mut game.sessions);

BonesBevyRenderer::new(game).app().run();
BonesWgpuRenderer::new(game).run();
}

/// System to render the home menu.
Expand All @@ -57,7 +54,7 @@ fn menu_system(
meta: Root<GameMeta>,
) {
egui::CentralPanel::default()
.frame(egui::Frame::none())
.frame(egui::Frame::new())
.show(&egui_ctx, |ui| {
// Use the title that has been loaded from the asset
ui.heading(&meta.title);
Expand Down
2 changes: 1 addition & 1 deletion demos/features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ publish = false

[dependencies]
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
bones_wgpu_renderer = { path = "../../framework_crates/bones_wgpu_renderer" }
16 changes: 8 additions & 8 deletions demos/features/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::too_many_arguments)]

use bones_bevy_renderer::{bevy::diagnostic::LogDiagnosticsPlugin, BonesBevyRenderer};
use bones_wgpu_renderer::BonesWgpuRenderer;
use bones_framework::prelude::*;

/// Create our root asset type.
Expand Down Expand Up @@ -91,7 +91,7 @@ fn main() {
PersistedTextData::register_schema();

// Create a bones bevy renderer from our bones game
let mut renderer = BonesBevyRenderer::new(create_game());
let mut renderer = BonesWgpuRenderer::new(create_game());
// Set the app namespace which will be used by the renderer to decide where to put
// persistent storage files.
renderer.app_namespace = (
Expand All @@ -101,9 +101,9 @@ fn main() {
);
// Get a bevy app for running our game
renderer
.app()
//.app()
// We can add our own bevy plugins now
.add_plugins(LogDiagnosticsPlugin::default())
//.add_plugins(LogDiagnosticsPlugin::default())
// And run the bevy app
.run()
}
Expand Down Expand Up @@ -181,7 +181,7 @@ fn menu_system(

// Render the menu.
egui::CentralPanel::default()
.frame(egui::Frame::none())
.frame(egui::Frame::new())
.show(&ctx, |ui| {
BorderedFrame::new(&meta.menu_border).show(ui, |ui| {
ui.vertical_centered(|ui| {
Expand Down Expand Up @@ -317,7 +317,7 @@ fn move_sprite(
ctx: Res<EguiCtx>,
) {
egui::CentralPanel::default()
.frame(egui::Frame::none())
.frame(egui::Frame::new())
.show(&ctx, |ui| {
ui.label("Press left and right arrow keys to move sprite");
});
Expand Down Expand Up @@ -453,7 +453,7 @@ fn audio_demo_ui(
assets: Res<AssetServer>,
) {
egui::CentralPanel::default()
.frame(egui::Frame::none())
.frame(egui::Frame::new())
.show(&ctx, |ui| {
ui.vertical_centered(|ui| {
ui.add_space(50.0);
Expand Down Expand Up @@ -538,7 +538,7 @@ fn back_to_menu_ui(
localization: Localization<GameMeta>,
) {
egui::TopBottomPanel::bottom("back-to-menu")
.frame(egui::Frame::none())
.frame(egui::Frame::new())
.show_separator_line(false)
.show(&ctx, |ui| {
ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| {
Expand Down
2 changes: 1 addition & 1 deletion demos/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ publish = false

[dependencies]
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
bones_wgpu_renderer = { path = "../../framework_crates/bones_wgpu_renderer" }
4 changes: 2 additions & 2 deletions demos/hello_world/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bones_bevy_renderer::BonesBevyRenderer;
use bones_wgpu_renderer::BonesWgpuRenderer;
use bones_framework::prelude::*;

fn main() {
Expand All @@ -19,7 +19,7 @@ fn main() {
.add_system_to_stage(Update, menu_system);
});

BonesBevyRenderer::new(game).app().run();
BonesWgpuRenderer::new(game).run();
}

/// System to render the home menu.
Expand Down
10 changes: 10 additions & 0 deletions demos/hello_world_wgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "demo_hello_world_wgpu"
edition.workspace = true
version.workspace = true
license.workspace = true
publish = false

[dependencies]
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_wgpu_renderer = { path = "../../framework_crates/bones_wgpu_renderer" }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions demos/hello_world_wgpu/assets/atlas/fishy-body.atlas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image: ./fishy-body.png
tile_size: [96, 80]
columns: 14
rows: 7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions demos/hello_world_wgpu/assets/game.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is our root asset file, which corresponds to our `GameMeta` struct.

title: Assets Minimal
sprite: ./sprite/fractal.png
sprite2: ./sprite/example.png
atlas: ./atlas/fishy-body.atlas.yaml
3 changes: 3 additions & 0 deletions demos/hello_world_wgpu/assets/pack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This is the core asset pack file. It's only job is to specify
# the path to the root asset.
root: ./game.yaml
Binary file added demos/hello_world_wgpu/assets/sprite/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/hello_world_wgpu/assets/sprite/fractal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading