From 426cbd9c3c4197df3b4a7957401b2444d9f3d2ae Mon Sep 17 00:00:00 2001 From: timokoesters Date: Thu, 25 Apr 2019 14:20:35 +0200 Subject: [PATCH] Start work on image_ids! and asset loading Former-commit-id: 1e86e627f8ec6a146aa59558da50658beaad91c6 --- common/src/assets/mod.rs | 50 ------ common/src/lib.rs | 1 - voxygen/src/assets/ids.rs | 190 +++++++++++++++++++++ voxygen/src/assets/mod.rs | 50 ++++++ voxygen/src/hud/mod.rs | 340 ++++---------------------------------- voxygen/src/main.rs | 1 + voxygen/src/ui/mod.rs | 1 + 7 files changed, 271 insertions(+), 362 deletions(-) delete mode 100644 common/src/assets/mod.rs create mode 100644 voxygen/src/assets/ids.rs create mode 100644 voxygen/src/assets/mod.rs diff --git a/common/src/assets/mod.rs b/common/src/assets/mod.rs deleted file mode 100644 index c5e2ea2eec..0000000000 --- a/common/src/assets/mod.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::env; -use std::fs; -use std::fs::File; -use std::io; -use std::io::prelude::*; - -fn try_load(name: &str) -> Option { - let basepaths = [ - // if it's stupid and it works.., - "assets".to_string(), - "../../assets".to_string(), - "../assets".to_string(), /* optimizations */ - [env!("CARGO_MANIFEST_DIR"), "/assets"].concat(), - [env!("CARGO_MANIFEST_DIR"), "/../../assets"].concat(), - [env!("CARGO_MANIFEST_DIR"), "/../assets"].concat(), - "../../../assets".to_string(), - [env!("CARGO_MANIFEST_DIR"), "/../../../assets"].concat(), - ]; - for bp in &basepaths { - let filename = [bp, name].concat(); - match File::open(&filename) { - Ok(f) => { - debug!("loading {} succedeed", filename); - return Some(f); - } - Err(e) => { - debug!("loading {} did not work with error: {}", filename, e); - } - }; - } - return None; -} - -pub fn load(name: &str) -> Result, ()> { - return match try_load(name) { - Some(mut f) => { - let mut content: Vec = vec![]; - f.read_to_end(&mut content); - info!("loaded asset successful: {}", name); - Ok(content) - } - None => { - warn!( - "Loading asset failed, wanted to load {} but could not load it, check debug log!", - name - ); - Err(()) - } - }; -} diff --git a/common/src/lib.rs b/common/src/lib.rs index 9b8331e0ed..dbfbcd5acf 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -10,7 +10,6 @@ extern crate serde_derive; #[macro_use] extern crate log; -pub mod assets; pub mod clock; pub mod comp; pub mod figure; diff --git a/voxygen/src/assets/ids.rs b/voxygen/src/assets/ids.rs new file mode 100644 index 0000000000..238d3076fb --- /dev/null +++ b/voxygen/src/assets/ids.rs @@ -0,0 +1,190 @@ +use super::Asset; + +use crate::ui::{Ui, Graphic}; + +use common::figure::Segment; + +use dot_vox::DotVoxData; +use image::DynamicImage; +use conrod_core::image::Id as ImgId; + +pub trait UiId where Self: std::marker::Sized { + fn to_ui_asset(self, ui: &mut Ui) -> ImgId; +} + +impl UiId for DynamicImage { + fn to_ui_asset(self, ui: &mut Ui) -> ImgId { + ui.new_graphic(Graphic::Image(self)) + } +} + +impl UiId for DotVoxData { + fn to_ui_asset(self, ui: &mut Ui) -> ImgId { + ui.new_graphic(Graphic::Voxel(Segment::from(self))) + } +} + +/// This macro will automatically load all specified assets, get the corresponding ImgIds and +/// create a struct with all of them +/// +/// Example usage: +/// ``` +/// image_ids! { +/// struct Voxs { +/// button1: "filename1.vox", +/// button2: "filename2.vox", +/// } +/// struct Voxs { +/// background: "background.png", +/// } +/// } +/// ``` +macro_rules! image_ids { + ($(pub struct<$T:ty> $Ids:ident { $( $name:ident: $file:expr ), *$(,)? } )*) => { + $( + pub struct $Ids { + $( $name: ImgId, )* + } + + impl $Ids { + pub fn load(ui: &mut Ui) -> Result { + Ok(Self { + $( $name: Id::to_ui_asset(<$T>::load($file)?, ui), )* + }) + } + } + )* + }; +} + +image_ids! { + pub struct Voxs { + // Bag + bag_contents: "element/frames/bag.vox", + inv_grid: "element/frames/inv_grid.vox", + inv_slot: "element/buttons/inv_slot.vox", + + // Buttons + settings: "element/buttons/settings.vox", + settings_hover: "element/buttons/settings_hover.vox", + settings_press: "element/buttons/settings_press.vox", + + social_button: "element/buttons/social.vox", + social_hover: "element/buttons/social_hover.vox", + social_press: "element/buttons/social_press.vox", + + map_button: "element/buttons/map.vox", + map_hover: "element/buttons/map_hover.vox", + map_press: "element/buttons/map_press.vox", + + spellbook_button: "element/buttons/spellbook.vox", + spellbook_hover: "element/buttons/spellbook_hover.vox", + spellbook_press: "element/buttons/spellbook_press.vox", + + character_button: "element/buttons/character.vox", + character_hover: "element/buttons/character_hover.vox", + character_press: "element/buttons/character_press.vox", + + qlog_button: "element/buttons/qlog.vox", + qlog_hover: "element/buttons/qlog_hover.vox", + qlog_press: "element/buttons/qlog_press.vox", + + close_button: "element/buttons/x.vox", + close_button_hover: "element/buttons/x_hover.vox", + close_button_press: "element/buttons/x_press.vox", + + // Esc menu + fireplace: "element/misc_bg/fireplace.vox", + button_dark: "element/buttons/button_dark.vox", + + // Minimap + mmap_frame: "element/frames/mmap.vox", + window_frame: "element/frames/window2.vox", + map_frame_l: "element/frames/map_l.vox", + map_frame_r: "element/frames/map_r.vox", + } + + pub struct Imgs { + // Bag + bag: "element/buttons/bag/closed.png", + bag_hover: "element/buttons/bag/closed_hover.png", + bag_press: "element/buttons/bag/closed_press.png", + bag_open: "element/buttons/bag/open.png", + bag_open_hover: "element/buttons/bag/open_hover.png", + bag_open_press: "element/buttons/bag/open_press.png", + + // Buttons + mmap_button: "element/buttons/border.png", + mmap_button_hover: "element/buttons/border_mo.png", + mmap_button_press: "element/buttons/border_press.png", + mmap_button_open: "element/buttons/border_pressed.png", + + // Esc-Menu + esc_bg: "element/frames/menu.png", + button_dark_hover: "element/buttons/button_dark_hover.png", + button_dark_press: "element/buttons/button_dark_press.png", + + // MiniMap + mmap_frame_bg: "element/misc_bg/mmap_bg.png", + + // Skillbar Module + sb_grid: "element/skill_bar/sbar_grid.png", + sb_grid_bg: "element/skill_bar/sbar_grid_bg.png", + l_click: "element/skill_bar/l.png", + r_click: "element/skill_bar/r.png", + mana_bar: "element/skill_bar/mana_bar.png", + health_bar: "element/skill_bar/health_bar.png", + xp_bar: "element/skill_bar/xp_bar.png", + + // Missing: Buff Frame Animation (.gif ?!) (we could do animation in ui.maintain(), or in shader?) + window_frame_2: "element/frames/window_2.png", + + // Settings Window + settings_bg: "element/frames/settings.png", + settings_icon: "element/icons/settings.png", + settings_button_mo: "element/buttons/blue_mo.png", + check: "element/buttons/check/no.png", + check_mo: "element/buttons/check/no_mo.png", + check_press: "element/buttons/check/press.png", + check_checked: "element/buttons/check/yes.png", + check_checked_mo: "element/buttons/check/yes_mo.png", + slider: "element/slider/track.png", + slider_indicator: "element/slider/indicator.png", + //button_blank: ui.new_graphic(ui::Graphic::Blank), + button_blue_mo: "element/buttons/blue_mo.png", + button_blue_press: "element/buttons/blue_press.png", + + // Window BG + window_bg: "element/misc_bg/window_bg.png", + + // Social Window + social_bg: "element/misc_bg/small_bg.png", + social_icon: "element/icons/social.png", + + // Map Window + map_bg: "element/misc_bg/small_bg.png", + map_icon: "element/icons/map.png", + + // Spell Book Window + spellbook_bg: "element/misc_bg/small_bg.png", + spellbook_icon: "element/icons/spellbook.png", + + // Char Window + charwindow: "element/misc_bg/charwindow.png", + charwindow_icon: "element/icons/charwindow.png", + charwindow_tab_bg: "element/frames/tab.png", + charwindow_tab: "element/buttons/tab.png", + charwindow_expbar: "element/misc_bg/small_bg.png", + progress_frame: "element/frames/progress_bar.png", + progress: "element/misc_bg/progress.png", + + // Quest-Log Window + questlog_bg: "element/misc_bg/small_bg.png", + questlog_icon: "element/icons/questlog.png", + + // Chat-Arrows + chat_arrow: "element/buttons/arrow/chat_arrow.png", + chat_arrow_mo: "element/buttons/arrow/chat_arrow_mo.png", + chat_arrow_press: "element/buttons/arrow/chat_arrow_press.png", + } +} diff --git a/voxygen/src/assets/mod.rs b/voxygen/src/assets/mod.rs new file mode 100644 index 0000000000..667392edcb --- /dev/null +++ b/voxygen/src/assets/mod.rs @@ -0,0 +1,50 @@ +pub mod ids; + +use conrod_core::widget::image::Image; + +use crate::ui::Ui; +use crate::ui::Graphic; + +use dot_vox::DotVoxData; +use image::DynamicImage; + +use std::env; +use std::fs; +use std::io; +use std::io::prelude::*; +use std::fs::File; + +fn read_from_path(path: &str) -> Result, std::io::Error> { + let path_slash = path.replace(".", "/"); + let path_slash_toml = [env!("CARGO_MANIFEST_DIR"), &path_slash, ".toml"].concat(); + println!("{}", path_slash_toml); + + let mut content = Vec::new(); + File::open(path_slash_toml)?.read_to_end(&mut content); + Ok(content) +} + +pub trait Asset where Self: std::marker::Sized { + fn load(path: &str) -> Result; +} + +impl Asset for DynamicImage { + fn load(path: &str) -> Result { + let image = image::load_from_memory( + &read_from_path(path)? + ).unwrap(); + + Ok(image) + } +} + +impl Asset for DotVoxData { + fn load(path: &str) -> Result { + let dot_vox = dot_vox::load_bytes( + &read_from_path(path)? + ).unwrap(); + + Ok(dot_vox) + } +} + diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 9beae93afe..ec4f098cd3 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -7,7 +7,8 @@ use crate::{ window::{Event as WinEvent, Key, Window}, GlobalState, }; -use common::{assets, figure::Segment}; + +use common::figure::Segment; use conrod_core::{ color, @@ -23,11 +24,13 @@ widget_ids! { bag_space_add, inventorytest_button, inventorytest_button_label, + // Debug debug_bg, debug_button, debug_button_label, fps_counter, + // Game Version version, @@ -56,10 +59,12 @@ widget_ids! { qlog_button_bg, bag_text, mmap_button, - //help + + // Help help, help_bg, - //ESC-Menu + + // ESC-Menu esc_bg, fireplace, menu_button_1, @@ -67,11 +72,13 @@ widget_ids! { menu_button_3, menu_button_4, menu_button_5, - //Mini-Map + + // Mini-Map mmap_frame, mmap_frame_bg, mmap_location, - //Action-Bar + + // Action-Bar xp_bar, l_click, r_click, @@ -84,17 +91,20 @@ widget_ids! { xp_bar_progress, health_bar_color, mana_bar_color, + // Level Display level_text, next_level_text, - //Window Frames + + // Window Frames window_frame_0, window_frame_1, window_frame_2, window_frame_3, window_frame_4, window_frame_5, - //0 Settings-Window + + // 0 Settings-Window settings_bg, settings_content, settings_icon, @@ -106,7 +116,8 @@ widget_ids! { settings_scrollbar, controls_text, controls_controls, - //Contents + + // Contents button_help, button_help2, show_help_label, @@ -116,13 +127,15 @@ widget_ids! { gameplay, controls, rectangle, - //1 Social + + // 1 Social social_frame, social_bg, social_icon, social_close, social_title, - //2 Map + + // 2 Map map_frame, map_bg, map_icon, @@ -132,13 +145,15 @@ widget_ids! { map_frame_r, map_frame_bl, map_frame_br, - //3 Spellbook + + // 3 Spellbook spellbook_frame, spellbook_bg, spellbook_icon, spellbook_close, spellbook_title, - //4 Charwindow + + // 4 Charwindow charwindow_frame, charwindow, charwindow_bg, @@ -157,7 +172,8 @@ widget_ids! { charwindow_rectangle, charwindow_exp_rectangle, charwindow_exp_progress_rectangle, - //5 Quest-Log + + // 5 Quest-Log questlog_frame, questlog_bg, questlog_icon, @@ -166,304 +182,6 @@ widget_ids! { } } -// TODO: make macro to mimic widget_ids! for images ids or find another solution to simplify addition of new images. -pub(self) struct Imgs { - // Bag - bag: ImgId, - bag_hover: ImgId, - bag_press: ImgId, - bag_open: ImgId, - bag_open_hover: ImgId, - bag_open_press: ImgId, - bag_contents: ImgId, - inv_grid: ImgId, - inv_slot: ImgId, - - // Buttons - mmap_closed: ImgId, - mmap_closed_hover: ImgId, - mmap_closed_press: ImgId, - mmap_open: ImgId, - mmap_open_hover: ImgId, - mmap_open_press: ImgId, - - settings: ImgId, - settings_hover: ImgId, - settings_press: ImgId, - - social_button: ImgId, - social_hover: ImgId, - social_press: ImgId, - - map_button: ImgId, - map_hover: ImgId, - map_press: ImgId, - - spellbook_button: ImgId, - spellbook_hover: ImgId, - spellbook_press: ImgId, - - character_button: ImgId, - character_hover: ImgId, - character_press: ImgId, - - qlog_button: ImgId, - qlog_hover: ImgId, - qlog_press: ImgId, - - // Close button - close_button: ImgId, - close_button_hover: ImgId, - close_button_press: ImgId, - - // Menu - esc_bg: ImgId, - fireplace: ImgId, - button: ImgId, - button_hover: ImgId, - button_press: ImgId, - - // MiniMap - mmap_frame: ImgId, - mmap_frame_closed: ImgId, - - // SkillBar Module - sb_grid: ImgId, - sb_grid_bg: ImgId, - l_click: ImgId, - r_click: ImgId, - mana_bar: ImgId, - health_bar: ImgId, - xp_bar: ImgId, - - //Buff Frame(s) - //buff_frame: ImgId, - //buff_frame_bg: ImgId, - //buff_frame_red: ImgId, - //buff_frame_green: ImgId, - - //Missing: Buff Frame Animation - window_frame: ImgId, - window_frame_2: ImgId, - //Settings-Window - settings_frame_r: ImgId, - settings_frame_l: ImgId, - settings_button: ImgId, - settings_button_pressed: ImgId, - settings_button_hover: ImgId, - settings_button_press: ImgId, - settings_bg: ImgId, - settings_icon: ImgId, - settings_button_mo: ImgId, - check: ImgId, - check_mo: ImgId, - check_press: ImgId, - check_checked: ImgId, - check_checked_mo: ImgId, - slider: ImgId, - slider_indicator: ImgId, - button_blank: ImgId, - button_blue_mo: ImgId, - button_blue_press: ImgId, - window_bg: ImgId, - // Social-Window - social_bg: ImgId, - social_icon: ImgId, - // Map-Window - map_bg: ImgId, - map_icon: ImgId, - map_frame_l: ImgId, - map_frame_r: ImgId, - map_frame_bl: ImgId, - map_frame_br: ImgId, - // Spell Book Window - spellbook_bg: ImgId, - spellbook_icon: ImgId, - // Char Window - charwindow: ImgId, - charwindow_icon: ImgId, - charwindow_tab_bg: ImgId, - charwindow_tab: ImgId, - charwindow_expbar: ImgId, - progress_frame: ImgId, - progress: ImgId, - - // Buttons - grid_button: ImgId, - grid_button_hover: ImgId, - grid_button_press: ImgId, - grid_button_open: ImgId, - - // Quest-Log Window - questlog_bg: ImgId, - questlog_icon: ImgId, - //help - // Chat-Arrow - chat_arrow: ImgId, - chat_arrow_mo: ImgId, - chat_arrow_press: ImgId, -} -impl Imgs { - fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs { - let mut load_img = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let image = image::load_from_memory( - assets::load(fullpath.as_str()) - .expect("Error loading Main UI Image") - .as_slice(), - ) - .unwrap(); - ui.new_graphic(ui::Graphic::Image(image)) - }; - let mut load_vox = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let dot_vox = dot_vox::load_bytes( - assets::load(fullpath.as_str()) - .expect("Error loading Main UI .vox") - .as_slice(), - ) - .unwrap(); - ui.new_graphic(ui::Graphic::Voxel(Segment::from(dot_vox))) - }; - Imgs { - // Bag - bag: load_img("element/buttons/bag/closed.png", ui), - bag_hover: load_img("element/buttons/bag/closed_hover.png", ui), - bag_press: load_img("element/buttons/bag/closed_press.png", ui), - bag_open: load_img("element/buttons/bag/open.png", ui), - bag_open_hover: load_img("element/buttons/bag/open_hover.png", ui), - bag_open_press: load_img("element/buttons/bag/open_press.png", ui), - bag_contents: load_vox("element/frames/bag.vox", ui), - inv_grid: load_vox("element/frames/inv_grid.vox", ui), - inv_slot: load_vox("element/buttons/inv_slot.vox", ui), - - // Buttons - mmap_closed: load_vox("element/buttons/button_mmap_closed.vox", ui), - mmap_closed_hover: load_vox("element/buttons/button_mmap_closed_hover.vox", ui), - mmap_closed_press: load_vox("element/buttons/button_mmap_closed_press.vox", ui), - mmap_open: load_vox("element/buttons/button_mmap_open.vox", ui), - mmap_open_hover: load_vox("element/buttons/button_mmap_open_hover.vox", ui), - mmap_open_press: load_vox("element/buttons/button_mmap_open_press.vox", ui), - - settings: load_vox("element/buttons/settings.vox", ui), - settings_hover: load_vox("element/buttons/settings_hover.vox", ui), - settings_press: load_vox("element/buttons/settings_press.vox", ui), - - social_button: load_vox("element/buttons/social.vox", ui), - social_hover: load_vox("element/buttons/social_hover.vox", ui), - social_press: load_vox("element/buttons/social_press.vox", ui), - - map_button: load_vox("element/buttons/map.vox", ui), - map_hover: load_vox("element/buttons/map_hover.vox", ui), - map_press: load_vox("element/buttons/map_press.vox", ui), - - spellbook_button: load_vox("element/buttons/spellbook.vox", ui), - spellbook_hover: load_vox("element/buttons/spellbook_hover.vox", ui), - spellbook_press: load_vox("element/buttons/spellbook_press.vox", ui), - - character_button: load_vox("element/buttons/character.vox", ui), - character_hover: load_vox("element/buttons/character_hover.vox", ui), - character_press: load_vox("element/buttons/character_press.vox", ui), - - qlog_button: load_vox("element/buttons/qlog.vox", ui), - qlog_hover: load_vox("element/buttons/qlog_hover.vox", ui), - qlog_press: load_vox("element/buttons/qlog_press.vox", ui), - - grid_button: load_img("element/buttons/border.png", ui), - grid_button_hover: load_img("element/buttons/border_mo.png", ui), - grid_button_press: load_img("element/buttons/border_press.png", ui), - grid_button_open: load_img("element/buttons/border_pressed.png", ui), - - // Close button - close_button: load_vox("element/buttons/x.vox", ui), - close_button_hover: load_vox("element/buttons/x_hover.vox", ui), - close_button_press: load_vox("element/buttons/x_press.vox", ui), - - // Esc-Menu - esc_bg: load_img("element/frames/menu.png", ui), - fireplace: load_vox("element/misc_bg/fireplace.vox", ui), - button: load_vox("element/buttons/button.vox", ui), - button_hover: load_vox("element/buttons/button_hover.vox", ui), - button_press: load_vox("element/buttons/button_press.vox", ui), - - // MiniMap - mmap_frame: load_vox("element/frames/mmap.vox", ui), - mmap_frame_closed: load_vox("element/frames/mmap_closed.vox", ui), - - // Skillbar Module - sb_grid: load_img("element/skill_bar/sbar_grid.png", ui), - sb_grid_bg: load_img("element/skill_bar/sbar_grid_bg.png", ui), - l_click: load_img("element/skill_bar/l.png", ui), - r_click: load_img("element/skill_bar/r.png", ui), - mana_bar: load_img("element/skill_bar/mana_bar.png", ui), - health_bar: load_img("element/skill_bar/health_bar.png", ui), - xp_bar: load_img("element/skill_bar/xp_bar.png", ui), - - // Missing: Buff Frame Animation (.gif ?!) (we could do animation in ui.maintain(), or in shader?) - window_frame: load_vox("element/frames/window2.vox", ui), - window_frame_2: load_img("element/frames/window_2.png", ui), - - // Settings Window - settings_frame_r: load_vox("element/frames/settings_r.vox", ui), - settings_frame_l: load_vox("element/frames/settings_l.vox", ui), - settings_button: load_vox("element/buttons/settings_button.vox", ui), - settings_button_pressed: load_vox("element/buttons/settings_button_pressed.vox", ui), - settings_button_hover: load_vox("element/buttons/settings_button_hover.vox", ui), - settings_button_press: load_vox("element/buttons/settings_button_press.vox", ui), - settings_bg: load_img("element/frames/settings.png", ui), - settings_icon: load_img("element/icons/settings.png", ui), - settings_button_mo: load_img("element/buttons/blue_mo.png", ui), - check: load_vox("element/buttons/check/no.vox", ui), - check_mo: load_vox("element/buttons/check/no_mo.vox", ui), - check_press: load_vox("element/buttons/check/press.vox", ui), - check_checked: load_vox("element/buttons/check/yes.vox", ui), - check_checked_mo: load_vox("element/buttons/check/yes_mo.vox", ui), - slider: load_vox("element/slider/track.vox", ui), - slider_indicator: load_vox("element/slider/indicator.vox", ui), - button_blank: ui.new_graphic(ui::Graphic::Blank), - button_blue_mo: load_img("element/buttons/blue_mo.png", ui), - button_blue_press: load_img("element/buttons/blue_press.png", ui), - - // Window BG - window_bg: load_img("element/misc_bg/window_bg.png", ui), - - // Social Window - social_bg: load_img("element/misc_bg/small_bg.png", ui), - social_icon: load_img("element/icons/social.png", ui), - - // Map Window - map_bg: load_img("element/misc_bg/small_bg.png", ui), - map_icon: load_img("element/icons/map.png", ui), - map_frame_l: load_vox("element/frames/map_l.vox", ui), - map_frame_r: load_vox("element/frames/map_r.vox", ui), - map_frame_bl: load_vox("element/frames/map_bl.vox", ui), - map_frame_br: load_vox("element/frames/map_br.vox", ui), - - // Spell Book Window - spellbook_bg: load_img("element/misc_bg/small_bg.png", ui), - spellbook_icon: load_img("element/icons/spellbook.png", ui), - - // Char Window - charwindow: load_img("element/misc_bg/charwindow.png", ui), - charwindow_icon: load_img("element/icons/charwindow.png", ui), - charwindow_tab_bg: load_img("element/frames/tab.png", ui), - charwindow_tab: load_img("element/buttons/tab.png", ui), - charwindow_expbar: load_img("element/misc_bg/small_bg.png", ui), - progress_frame: load_img("element/frames/progress_bar.png", ui), - progress: load_img("element/misc_bg/progress.png", ui), - - // Quest-Log Window - questlog_bg: load_img("element/misc_bg/small_bg.png", ui), - questlog_icon: load_img("element/icons/questlog.png", ui), - - // Chat-Arrows - chat_arrow: load_vox("element/buttons/arrow_down.vox", ui), - chat_arrow_mo: load_vox("element/buttons/arrow_down_hover.vox", ui), - chat_arrow_press: load_vox("element/buttons/arrow_down_press.vox", ui), - } - } -} - enum SettingsTab { Interface, Video, diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index a7a911580f..060f1fa985 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -1,6 +1,7 @@ #![feature(drain_filter)] #![recursion_limit = "2048"] +pub mod assets; pub mod anim; pub mod error; pub mod hud; diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index 4b008057b8..e72c2104d3 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -228,6 +228,7 @@ impl Ui { pub fn new(window: &mut Window) -> Result { let scale = Scale::new(window, ScaleMode::Absolute(1.0)); let win_dims = scale.scaled_window_size().into_array(); + Ok(Self { ui: UiBuilder::new(win_dims).build(), image_map: Map::new(),