Skip to content

Commit

Permalink
Update to bevy 0.8 (#6)
Browse files Browse the repository at this point in the history
* Init update to bevy 0.8

* Fix window close bug

* Try center positioning

* Fix checks

* Update image lib

* Update to newest egui_winit_vulkano

* New version 0.6
  • Loading branch information
hakolao authored Aug 2, 2022
1 parent 26b9411 commit af09246
Show file tree
Hide file tree
Showing 9 changed files with 695 additions and 341 deletions.
728 changes: 484 additions & 244 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_vulkano"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["Okko Hakola <okkohakola@gmail.com>"]
description = "Vulkano Backend for Bevy"
Expand All @@ -20,14 +20,14 @@ gui = ["egui_winit_vulkano"]
vulkano = "0.30.0"
vulkano-util = "0.30.0"
vulkano-shaders = "0.30.0"
egui_winit_vulkano = { version = "0.18", optional = true }
egui_winit_vulkano = { version = "0.19", optional = true }
winit = "0.26.0"
image = "0.23.14"
image = "0.24.3"
approx = "0.5.1"
raw-window-handle = "0.4"

[dependencies.bevy]
version = "0.7.0"
version = "0.8.0"
default-features = false
features = []

Expand Down
21 changes: 12 additions & 9 deletions examples/circle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ mod render_pass;
mod render_system_plugin;

use bevy::{
app::PluginGroupBuilder, input::system::exit_on_esc_system, prelude::*, window::WindowMode,
app::PluginGroupBuilder,
prelude::*,
window::{close_on_esc, WindowMode},
};
use bevy_vulkano::{VulkanoWinitConfig, VulkanoWinitPlugin};
use vulkano::device::Features;
Expand All @@ -16,16 +18,17 @@ pub struct PluginBundle;
impl PluginGroup for PluginBundle {
fn build(&mut self, group: &mut PluginGroupBuilder) {
// Minimum plugins for the demo
group.add(bevy::log::LogPlugin::default());
group.add(bevy::core::CorePlugin::default());
group.add(bevy::diagnostic::DiagnosticsPlugin::default());
group.add(bevy::diagnostic::FrameTimeDiagnosticsPlugin::default());
group.add(bevy::input::InputPlugin::default());
group.add(bevy::log::LogPlugin);
group.add(bevy::core::CorePlugin);
group.add(bevy::time::TimePlugin);
group.add(bevy::diagnostic::DiagnosticsPlugin);
group.add(bevy::diagnostic::FrameTimeDiagnosticsPlugin);
group.add(bevy::input::InputPlugin);
// Don't add default bevy plugins or WinitPlugin. This owns "core loop" (runner).
// Bevy winit and render should be excluded
group.add(VulkanoWinitPlugin::default());
group.add(VulkanoWinitPlugin);
// See `MainRenderPlugin` how rendering is orchestrated
group.add(MainRenderPlugin::default());
group.add(MainRenderPlugin);
}
}

Expand All @@ -51,6 +54,6 @@ fn main() {
..WindowDescriptor::default()
})
.add_plugins(PluginBundle)
.add_system(exit_on_esc_system)
.add_system(close_on_esc)
.run();
}
15 changes: 8 additions & 7 deletions examples/game_of_life/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ mod place_over_frame;

use bevy::{
app::PluginGroupBuilder,
core::FixedTimestep,
input::system::exit_on_esc_system,
prelude::*,
window::{WindowId, WindowMode},
time::FixedTimestep,
window::{close_on_esc, WindowId, WindowMode},
};
use bevy_vulkano::{BevyVulkanoWindows, VulkanoWinitConfig, VulkanoWinitPlugin};
use vulkano::image::ImageAccess;
Expand All @@ -22,11 +21,12 @@ impl PluginGroup for PluginBundle {
fn build(&mut self, group: &mut PluginGroupBuilder) {
// Minimum plugins for the demo
// Core needed for fixed time steps
group.add(bevy::core::CorePlugin::default());
group.add(bevy::input::InputPlugin::default());
group.add(bevy::core::CorePlugin);
group.add(bevy::input::InputPlugin);
group.add(bevy::time::TimePlugin);
// Don't add default bevy plugins or WinitPlugin. This owns "core loop" (runner).
// Bevy winit and render should be excluded
group.add(VulkanoWinitPlugin::default());
group.add(VulkanoWinitPlugin);
}
}

Expand All @@ -40,11 +40,12 @@ fn main() {
present_mode: bevy::window::PresentMode::Immediate,
resizable: true,
mode: WindowMode::Windowed,
position: WindowPosition::Centered(MonitorSelection::Primary),
..WindowDescriptor::default()
})
.add_plugins(PluginBundle)
.add_startup_system(create_pipelines)
.add_system(exit_on_esc_system)
.add_system(close_on_esc)
.add_system(draw_life_system)
.add_system(update_window_title_system)
.add_system_set_to_stage(
Expand Down
9 changes: 5 additions & 4 deletions examples/multi_window_gui/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#[cfg(feature = "example_has_gui")]
use bevy::window::close_on_esc;
#[cfg(feature = "example_has_gui")]
use bevy::{
app::PluginGroupBuilder,
input::system::exit_on_esc_system,
prelude::*,
window::{CreateWindow, WindowId, WindowMode},
};
Expand All @@ -17,10 +18,10 @@ pub struct PluginBundle;
impl PluginGroup for PluginBundle {
fn build(&mut self, group: &mut PluginGroupBuilder) {
// Minimum plugins for the demo
group.add(bevy::input::InputPlugin::default());
group.add(bevy::input::InputPlugin);
// Don't add default bevy plugins or WinitPlugin. This owns "core loop" (runner).
// Bevy winit and render should be excluded
group.add(VulkanoWinitPlugin::default());
group.add(VulkanoWinitPlugin);
}
}

Expand Down Expand Up @@ -51,7 +52,7 @@ fn main() {
..WindowDescriptor::default()
})
.add_plugins(PluginBundle)
.add_system(exit_on_esc_system)
.add_system(close_on_esc)
.add_startup_system(create_new_window_system)
.add_system(create_new_window_on_space_system)
.add_system_set_to_stage(
Expand Down
11 changes: 6 additions & 5 deletions examples/windowless_compute/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{app::AppExit, prelude::*};
use bevy::{app::AppExit, prelude::*, window::WindowSettings};
use bevy_vulkano::{VulkanoWinitConfig, VulkanoWinitPlugin};
use vulkano::{
buffer::{BufferUsage, CpuAccessibleBuffer},
Expand All @@ -14,12 +14,13 @@ use vulkano_util::context::VulkanoContext;

fn main() {
App::new()
.insert_non_send_resource(VulkanoWinitConfig {
// No window...
.insert_resource(WindowSettings {
// No window
add_primary_window: false,
..VulkanoWinitConfig::default()
..WindowSettings::default()
})
.add_plugin(VulkanoWinitPlugin::default())
.insert_non_send_resource(VulkanoWinitConfig::default())
.add_plugin(VulkanoWinitPlugin)
.add_startup_system(run_compute_shader_once_then_exit)
.run();
}
Expand Down
8 changes: 4 additions & 4 deletions src/converters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy::{
keyboard::{KeyCode, KeyboardInput},
mouse::MouseButton,
touch::{ForceTouch, TouchInput, TouchPhase},
ElementState,
ButtonState,
},
math::Vec2,
window::CursorIcon,
Expand All @@ -17,10 +17,10 @@ pub fn convert_keyboard_input(keyboard_input: &winit::event::KeyboardInput) -> K
}
}

pub fn convert_element_state(element_state: winit::event::ElementState) -> ElementState {
pub fn convert_element_state(element_state: winit::event::ElementState) -> ButtonState {
match element_state {
winit::event::ElementState::Pressed => ElementState::Pressed,
winit::event::ElementState::Released => ElementState::Released,
winit::event::ElementState::Pressed => ButtonState::Pressed,
winit::event::ElementState::Released => ButtonState::Released,
}
}

Expand Down
Loading

0 comments on commit af09246

Please sign in to comment.