First vulkan init working
This commit is contained in:
parent
6639f0bb1e
commit
99be029ff8
4 changed files with 36 additions and 28 deletions
|
@ -1,7 +1,9 @@
|
|||
use vulkan_context::VulkanContext;
|
||||
use window_render_context::WindowRenderContext;
|
||||
|
||||
use bevy_app::App;
|
||||
use bevy_app::{App, Plugin};
|
||||
|
||||
use super::window::raw_handle::WindowWrapper;
|
||||
|
||||
mod utils;
|
||||
mod vulkan_context;
|
||||
|
@ -13,16 +15,20 @@ pub enum VulkanError {
|
|||
FailedToCreateVulkanContext,
|
||||
}
|
||||
|
||||
pub struct Vulkan;
|
||||
pub struct VulkanPlugin;
|
||||
|
||||
impl Vulkan {
|
||||
pub fn new(app: &mut App) -> Result<(), VulkanError> {
|
||||
impl Plugin for VulkanPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
let vulkan_context = VulkanContext::from(app as &App);
|
||||
app.world_mut().insert_resource(vulkan_context);
|
||||
}
|
||||
|
||||
fn ready(&self, app: &App) -> bool {
|
||||
app.world().get_resource::<WindowWrapper>().is_some()
|
||||
}
|
||||
|
||||
fn finish(&self, app: &mut App) {
|
||||
let window_render_context = WindowRenderContext::from(app as &App);
|
||||
app.world_mut().insert_resource(window_render_context);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue