Rename GUI Layout to Layout System

This commit is contained in:
Keavon Chambers 2020-06-10 14:01:50 -07:00
parent 559833be8e
commit f32f39d5a6
4 changed files with 10 additions and 8 deletions

View file

@ -3,7 +3,7 @@ use crate::window_events;
use crate::pipeline::Pipeline;
use crate::texture::Texture;
use crate::resource_cache::ResourceCache;
use crate::gui_layout::GuiLayout;
use crate::layout_system::LayoutSystem;
use crate::gui_node::GuiNode;
use winit::event::*;
use winit::event_loop::*;
@ -70,7 +70,7 @@ impl Application {
// Data structure maintaining the user interface
let gui_rect_pipeline = Pipeline::new(
&device, swap_chain_descriptor.format, Vec::new(), &mut shader_cache, ("shaders/shader.vert", "shaders/shader.frag")
&device, swap_chain_descriptor.format, Vec::new(), &mut shader_cache, ("shaders/shader.vert", "shaders/shader.frag"),
);
pipeline_cache.set("gui_rect", gui_rect_pipeline);
@ -79,7 +79,7 @@ impl Application {
let gui_root = rctree::Node::new(gui_root_data);
// Main window in the XML layout language
let mut main_window_layout = GuiLayout::new();
let mut main_window_layout = LayoutSystem::new();
main_window_layout.load_layout("window", "main");
Self {

0
src/layout_dom_node.rs Normal file
View file

View file

@ -5,13 +5,14 @@ use crate::layout_abstract_syntax::*;
use crate::layout_attribute_parser::*;
use crate::resource_cache::ResourceCache;
pub struct GuiLayout {
pub struct LayoutSystem {
// pub dom_tree: rctree::Node<
pub loaded_layouts: ResourceCache<rctree::Node<LayoutAbstractNode>>,
attribute_parser: AttributeParser,
}
impl GuiLayout {
pub fn new() -> GuiLayout {
impl LayoutSystem {
pub fn new() -> LayoutSystem {
Self {
loaded_layouts: ResourceCache::new(),
attribute_parser: AttributeParser::new(),
@ -19,7 +20,7 @@ impl GuiLayout {
}
pub fn load_layout(&mut self, namespace: &str, name: &str) {
// Load and parse the XML layout
// Load and parse the requested XML layout
let xml_path = self.layout_xml_path(namespace, name);
let window_main = self.parse_xml_file(&xml_path[..]).unwrap();

View file

@ -9,10 +9,11 @@ mod draw_command;
mod gui_node;
mod gui_attributes;
mod window_events;
mod gui_layout;
mod layout_system;
mod layout_abstract_types;
mod layout_abstract_syntax;
mod layout_attribute_parser;
mod layout_dom_node;
use application::Application;
use winit::event_loop::EventLoop;