Fix engine creation
This commit is contained in:
parent
b90a81bcc5
commit
7253251e9d
4 changed files with 15 additions and 28 deletions
|
@ -168,21 +168,13 @@ impl Engine {
|
||||||
|
|
||||||
let asset_manager = AssetManager::new(&engine_settings)?;
|
let asset_manager = AssetManager::new(&engine_settings)?;
|
||||||
|
|
||||||
if let Some(mut gui_info) = create_info.gui_info {
|
let gui_handler = GuiHandler::new(create_info.gui_info, &context)?;
|
||||||
if let Font::Path(path) = &mut gui_info.font {
|
|
||||||
path.set_prefix(&create_info.resource_base_path);
|
|
||||||
}
|
|
||||||
gui_info.resource_directory.assume_prefix_free();
|
|
||||||
|
|
||||||
let gui_handler = GuiHandler::new(gui_info, &context)?;
|
|
||||||
|
|
||||||
let gui_post_process = Arc::new(GuiPostProcess(gui_handler.clone()));
|
let gui_post_process = Arc::new(GuiPostProcess(gui_handler.clone()));
|
||||||
context
|
context
|
||||||
.render_core()
|
.render_core()
|
||||||
.add_post_processing_routine(gui_post_process.clone());
|
.add_post_processing_routine(gui_post_process.clone());
|
||||||
|
|
||||||
world.resources.insert(gui_handler);
|
world.resources.insert(gui_handler);
|
||||||
}
|
|
||||||
|
|
||||||
// default keyboard navigation
|
// default keyboard navigation
|
||||||
let mut direction_mapping = HashMap::new();
|
let mut direction_mapping = HashMap::new();
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub struct EngineCreateInfo<'a> {
|
||||||
pub vulkan_debug_info: VulkanDebugInfo,
|
pub vulkan_debug_info: VulkanDebugInfo,
|
||||||
pub volume_info: HashMap<String, f32>,
|
pub volume_info: HashMap<String, f32>,
|
||||||
|
|
||||||
pub gui_info: Option<GuiHandlerCreateInfo<'a>>,
|
pub gui_info: GuiHandlerCreateInfo<'a>,
|
||||||
|
|
||||||
pub enable_backtrace: bool,
|
pub enable_backtrace: bool,
|
||||||
pub enable_mouse: bool,
|
pub enable_mouse: bool,
|
||||||
|
@ -60,7 +60,7 @@ impl<'a> Default for EngineCreateInfo<'a> {
|
||||||
renderdoc: false,
|
renderdoc: false,
|
||||||
},
|
},
|
||||||
volume_info: HashMap::new(),
|
volume_info: HashMap::new(),
|
||||||
gui_info: None,
|
gui_info: GuiHandlerCreateInfo::new(),
|
||||||
enable_backtrace: true,
|
enable_backtrace: true,
|
||||||
enable_mouse: true,
|
enable_mouse: true,
|
||||||
enable_keyboard: true,
|
enable_keyboard: true,
|
||||||
|
|
|
@ -10,3 +10,4 @@ assetpath = { workspace = true }
|
||||||
destructure_traitobject = { workspace = true }
|
destructure_traitobject = { workspace = true }
|
||||||
|
|
||||||
engine = { path = "../engine" }
|
engine = { path = "../engine" }
|
||||||
|
ecs = { path = "../ecs" }
|
||||||
|
|
|
@ -31,7 +31,7 @@ use std::ops::IndexMut;
|
||||||
|
|
||||||
use cgmath::Rad;
|
use cgmath::Rad;
|
||||||
|
|
||||||
use cgmath::{vec2, InnerSpace, Vector2, Vector3, Zero};
|
use cgmath::{InnerSpace, Vector2, Vector3, Zero, vec2};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum MapObjectType {
|
pub enum MapObjectType {
|
||||||
|
@ -110,13 +110,7 @@ impl Map {
|
||||||
self.async_db.dispatch()
|
self.async_db.dispatch()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_height(
|
pub fn add_height(&self, x: u32, y: u32, height: f32, world: &mut World) -> Result<()> {
|
||||||
&self,
|
|
||||||
x: u32,
|
|
||||||
y: u32,
|
|
||||||
height: f32,
|
|
||||||
scene: &mut impl SceneEntities,
|
|
||||||
) -> Result<()> {
|
|
||||||
let mut data = self.data.write().unwrap();
|
let mut data = self.data.write().unwrap();
|
||||||
|
|
||||||
data.add_height(x, y, height, &self.async_db)?;
|
data.add_height(x, y, height, &self.async_db)?;
|
||||||
|
@ -713,7 +707,7 @@ impl Map {
|
||||||
return Err(anyhow::Error::msg(format!(
|
return Err(anyhow::Error::msg(format!(
|
||||||
"Map: Could not find index ({}) in height map",
|
"Map: Could not find index ({}) in height map",
|
||||||
index
|
index
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -739,7 +733,7 @@ impl Map {
|
||||||
return Err(anyhow::Error::msg(format!(
|
return Err(anyhow::Error::msg(format!(
|
||||||
"Map: Image ({}) could not be found",
|
"Map: Image ({}) could not be found",
|
||||||
texture.name
|
texture.name
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -769,7 +763,7 @@ impl Map {
|
||||||
return Err(anyhow::Error::msg(format!(
|
return Err(anyhow::Error::msg(format!(
|
||||||
"Map: Index ({}) of tiles map could not be found",
|
"Map: Index ({}) of tiles map could not be found",
|
||||||
i
|
i
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -779,7 +773,7 @@ impl Map {
|
||||||
return Err(anyhow::Error::msg(format!(
|
return Err(anyhow::Error::msg(format!(
|
||||||
"Map: Texture with id ({}) of textures_info could not be found",
|
"Map: Texture with id ({}) of textures_info could not be found",
|
||||||
texture_id
|
texture_id
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue