diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 47002be63d..dcbebebf2d 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs}; +use super::{img_ids::Imgs, Fonts}; use conrod_core::{ color, widget::{self, Button, Image, Rectangle, Scrollbar}, diff --git a/voxygen/src/hud/buttons.rs b/voxygen/src/hud/buttons.rs index 1f0357f386..24d325472c 100644 --- a/voxygen/src/hud/buttons.rs +++ b/voxygen/src/hud/buttons.rs @@ -3,7 +3,7 @@ use conrod_core::{ widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; -use super::{font_ids::Fonts, img_ids::Imgs, small_window::SmallWindowType, Windows, TEXT_COLOR}; +use super::{img_ids::Imgs, small_window::SmallWindowType, Fonts, Windows, TEXT_COLOR}; use crate::ui::ToggleButton; widget_ids! { diff --git a/voxygen/src/hud/character_window.rs b/voxygen/src/hud/character_window.rs index 4b969ae325..6ef209784d 100644 --- a/voxygen/src/hud/character_window.rs +++ b/voxygen/src/hud/character_window.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs, TEXT_COLOR, XP_COLOR}; +use super::{img_ids::Imgs, Fonts, TEXT_COLOR, XP_COLOR}; use conrod_core::{ color, widget::{self, Button, Image, Rectangle, Text}, diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index da66630814..ab43936a32 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs, TEXT_COLOR}; +use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; use conrod_core::{ input::Key, position::Dimension, diff --git a/voxygen/src/hud/esc_menu.rs b/voxygen/src/hud/esc_menu.rs index 820df50cb6..3d880cd344 100644 --- a/voxygen/src/hud/esc_menu.rs +++ b/voxygen/src/hud/esc_menu.rs @@ -3,7 +3,7 @@ use conrod_core::{ widget_ids, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; -use super::{font_ids::Fonts, img_ids::Imgs, TEXT_COLOR}; +use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; widget_ids! { struct Ids { diff --git a/voxygen/src/hud/font_ids.rs b/voxygen/src/hud/font_ids.rs deleted file mode 100644 index 8033800253..0000000000 --- a/voxygen/src/hud/font_ids.rs +++ /dev/null @@ -1,6 +0,0 @@ -font_ids! { - pub struct Fonts { - opensans: "/voxygen/font/OpenSans-Regular.ttf", - metamorph: "/voxygen/font/Metamorphous-Regular.ttf", - } -} diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index a773a977e6..3acd09b085 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -3,152 +3,152 @@ use crate::ui::{BlankGraphic, ImageGraphic, VoxelGraphic}; image_ids! { pub struct Imgs { - // Bag - bag_contents: "/voxygen/element/frames/bag.vox", - inv_grid: "/voxygen/element/frames/inv_grid.vox", - inv_slot: "/voxygen/element/buttons/inv_slot.vox", + // Bag + bag_contents: "/voxygen/element/frames/bag.vox", + inv_grid: "/voxygen/element/frames/inv_grid.vox", + inv_slot: "/voxygen/element/buttons/inv_slot.vox", - // Buttons - mmap_closed: "/voxygen/element/buttons/button_mmap_closed.vox", - mmap_closed_hover: "/voxygen/element/buttons/button_mmap_closed_hover.vox", - mmap_closed_press: "/voxygen/element/buttons/button_mmap_closed_press.vox", - mmap_open: "/voxygen/element/buttons/button_mmap_open.vox", - mmap_open_hover: "/voxygen/element/buttons/button_mmap_open_hover.vox", - mmap_open_press: "/voxygen/element/buttons/button_mmap_open_press.vox", + // Buttons + mmap_closed: "/voxygen/element/buttons/button_mmap_closed.vox", + mmap_closed_hover: "/voxygen/element/buttons/button_mmap_closed_hover.vox", + mmap_closed_press: "/voxygen/element/buttons/button_mmap_closed_press.vox", + mmap_open: "/voxygen/element/buttons/button_mmap_open.vox", + mmap_open_hover: "/voxygen/element/buttons/button_mmap_open_hover.vox", + mmap_open_press: "/voxygen/element/buttons/button_mmap_open_press.vox", - settings: "/voxygen/element/buttons/settings.vox", - settings_hover: "/voxygen/element/buttons/settings_hover.vox", - settings_press: "/voxygen/element/buttons/settings_press.vox", + settings: "/voxygen/element/buttons/settings.vox", + settings_hover: "/voxygen/element/buttons/settings_hover.vox", + settings_press: "/voxygen/element/buttons/settings_press.vox", - social_button: "/voxygen/element/buttons/social.vox", - social_hover: "/voxygen/element/buttons/social_hover.vox", - social_press: "/voxygen/element/buttons/social_press.vox", + social_button: "/voxygen/element/buttons/social.vox", + social_hover: "/voxygen/element/buttons/social_hover.vox", + social_press: "/voxygen/element/buttons/social_press.vox", - map_button: "/voxygen/element/buttons/map.vox", - map_hover: "/voxygen/element/buttons/map_hover.vox", - map_press: "/voxygen/element/buttons/map_press.vox", + map_button: "/voxygen/element/buttons/map.vox", + map_hover: "/voxygen/element/buttons/map_hover.vox", + map_press: "/voxygen/element/buttons/map_press.vox", - spellbook_button: "/voxygen/element/buttons/spellbook.vox", - spellbook_hover: "/voxygen/element/buttons/spellbook_hover.vox", - spellbook_press: "/voxygen/element/buttons/spellbook_press.vox", + spellbook_button: "/voxygen/element/buttons/spellbook.vox", + spellbook_hover: "/voxygen/element/buttons/spellbook_hover.vox", + spellbook_press: "/voxygen/element/buttons/spellbook_press.vox", - character_button: "/voxygen/element/buttons/character.vox", - character_hover: "/voxygen/element/buttons/character_hover.vox", - character_press: "/voxygen/element/buttons/character_press.vox", + character_button: "/voxygen/element/buttons/character.vox", + character_hover: "/voxygen/element/buttons/character_hover.vox", + character_press: "/voxygen/element/buttons/character_press.vox", - qlog_button: "/voxygen/element/buttons/qlog.vox", - qlog_hover: "/voxygen/element/buttons/qlog_hover.vox", - qlog_press: "/voxygen/element/buttons/qlog_press.vox", + qlog_button: "/voxygen/element/buttons/qlog.vox", + qlog_hover: "/voxygen/element/buttons/qlog_hover.vox", + qlog_press: "/voxygen/element/buttons/qlog_press.vox", - // Close button - close_button: "/voxygen/element/buttons/x.vox", - close_button_hover: "/voxygen/element/buttons/x_hover.vox", - close_button_press: "/voxygen/element/buttons/x_press.vox", + // Close button + close_button: "/voxygen/element/buttons/x.vox", + close_button_hover: "/voxygen/element/buttons/x_hover.vox", + close_button_press: "/voxygen/element/buttons/x_press.vox", - // Esc-Menu - fireplace: "/voxygen/element/misc_bg/fireplace.vox", - button: "/voxygen/element/buttons/button.vox", - button_hover: "/voxygen/element/buttons/button_hover.vox", - button_press: "/voxygen/element/buttons/button_press.vox", + // Esc-Menu + fireplace: "/voxygen/element/misc_bg/fireplace.vox", + button: "/voxygen/element/buttons/button.vox", + button_hover: "/voxygen/element/buttons/button_hover.vox", + button_press: "/voxygen/element/buttons/button_press.vox", - // MiniMap - mmap_frame: "/voxygen/element/frames/mmap.vox", - mmap_frame_closed: "/voxygen/element/frames/mmap_closed.vox", + // MiniMap + mmap_frame: "/voxygen/element/frames/mmap.vox", + mmap_frame_closed: "/voxygen/element/frames/mmap_closed.vox", - // Missing: Buff Frame Animation .gif ?! we could do animation in ui.maintain, or in shader? - window_frame: "/voxygen/element/frames/window2.vox", + // Missing: Buff Frame Animation .gif ?! we could do animation in ui.maintain, or in shader? + window_frame: "/voxygen/element/frames/window2.vox", - // Settings Window - settings_frame_r: "/voxygen/element/frames/settings_r.vox", - settings_frame_l: "/voxygen/element/frames/settings_l.vox", - settings_button: "/voxygen/element/buttons/settings_button.vox", - settings_button_pressed: "/voxygen/element/buttons/settings_button_pressed.vox", - settings_button_hover: "/voxygen/element/buttons/settings_button_hover.vox", - settings_button_press: "/voxygen/element/buttons/settings_button_press.vox", - check: "/voxygen/element/buttons/check/no.vox", - check_mo: "/voxygen/element/buttons/check/no_mo.vox", - check_press: "/voxygen/element/buttons/check/press.vox", - check_checked: "/voxygen/element/buttons/check/yes.vox", - check_checked_mo: "/voxygen/element/buttons/check/yes_mo.vox", - slider: "/voxygen/element/slider/track.vox", - slider_indicator: "/voxygen/element/slider/indicator.vox", + // Settings Window + settings_frame_r: "/voxygen/element/frames/settings_r.vox", + settings_frame_l: "/voxygen/element/frames/settings_l.vox", + settings_button: "/voxygen/element/buttons/settings_button.vox", + settings_button_pressed: "/voxygen/element/buttons/settings_button_pressed.vox", + settings_button_hover: "/voxygen/element/buttons/settings_button_hover.vox", + settings_button_press: "/voxygen/element/buttons/settings_button_press.vox", + check: "/voxygen/element/buttons/check/no.vox", + check_mo: "/voxygen/element/buttons/check/no_mo.vox", + check_press: "/voxygen/element/buttons/check/press.vox", + check_checked: "/voxygen/element/buttons/check/yes.vox", + check_checked_mo: "/voxygen/element/buttons/check/yes_mo.vox", + slider: "/voxygen/element/slider/track.vox", + slider_indicator: "/voxygen/element/slider/indicator.vox", - // Map Window - map_frame_l: "/voxygen/element/frames/map_l.vox", - map_frame_r: "/voxygen/element/frames/map_r.vox", - map_frame_bl: "/voxygen/element/frames/map_bl.vox", - map_frame_br: "/voxygen/element/frames/map_br.vox", + // Map Window + map_frame_l: "/voxygen/element/frames/map_l.vox", + map_frame_r: "/voxygen/element/frames/map_r.vox", + map_frame_bl: "/voxygen/element/frames/map_bl.vox", + map_frame_br: "/voxygen/element/frames/map_br.vox", - // Chat-Arrows - chat_arrow: "/voxygen/element/buttons/arrow_down.vox", - chat_arrow_mo: "/voxygen/element/buttons/arrow_down_hover.vox", - chat_arrow_press: "/voxygen/element/buttons/arrow_down_press.vox", + // Chat-Arrows + chat_arrow: "/voxygen/element/buttons/arrow_down.vox", + chat_arrow_mo: "/voxygen/element/buttons/arrow_down_hover.vox", + chat_arrow_press: "/voxygen/element/buttons/arrow_down_press.vox", - + - // Spell Book Window - spellbook_bg: "/voxygen/element/misc_bg/small_bg.png", - spellbook_icon: "/voxygen/element/icons/spellbook.png", + // Spell Book Window + spellbook_bg: "/voxygen/element/misc_bg/small_bg.png", + spellbook_icon: "/voxygen/element/icons/spellbook.png", - // Bag - bag: "/voxygen/element/buttons/bag/closed.png", - bag_hover: "/voxygen/element/buttons/bag/closed_hover.png", - bag_press: "/voxygen/element/buttons/bag/closed_press.png", - bag_open: "/voxygen/element/buttons/bag/open.png", - bag_open_hover: "/voxygen/element/buttons/bag/open_hover.png", - bag_open_press: "/voxygen/element/buttons/bag/open_press.png", + // Bag + bag: "/voxygen/element/buttons/bag/closed.png", + bag_hover: "/voxygen/element/buttons/bag/closed_hover.png", + bag_press: "/voxygen/element/buttons/bag/closed_press.png", + bag_open: "/voxygen/element/buttons/bag/open.png", + bag_open_hover: "/voxygen/element/buttons/bag/open_hover.png", + bag_open_press: "/voxygen/element/buttons/bag/open_press.png", - map_bg: "/voxygen/element/misc_bg/small_bg.png", - map_icon: "/voxygen/element/icons/map.png", + map_bg: "/voxygen/element/misc_bg/small_bg.png", + map_icon: "/voxygen/element/icons/map.png", - grid_button: "/voxygen/element/buttons/border.png", - grid_button_hover: "/voxygen/element/buttons/border_mo.png", - grid_button_press: "/voxygen/element/buttons/border_press.png", - grid_button_open: "/voxygen/element/buttons/border_pressed.png", + grid_button: "/voxygen/element/buttons/border.png", + grid_button_hover: "/voxygen/element/buttons/border_mo.png", + grid_button_press: "/voxygen/element/buttons/border_press.png", + grid_button_open: "/voxygen/element/buttons/border_pressed.png", - // Skillbar Module - sb_grid: "/voxygen/element/skill_bar/sbar_grid.png", - sb_grid_bg: "/voxygen/element/skill_bar/sbar_grid_bg.png", - l_click: "/voxygen/element/skill_bar/l.png", - r_click: "/voxygen/element/skill_bar/r.png", - mana_bar: "/voxygen/element/skill_bar/mana_bar.png", - health_bar: "/voxygen/element/skill_bar/health_bar.png", - xp_bar: "/voxygen/element/skill_bar/xp_bar.png", + // Skillbar Module + sb_grid: "/voxygen/element/skill_bar/sbar_grid.png", + sb_grid_bg: "/voxygen/element/skill_bar/sbar_grid_bg.png", + l_click: "/voxygen/element/skill_bar/l.png", + r_click: "/voxygen/element/skill_bar/r.png", + mana_bar: "/voxygen/element/skill_bar/mana_bar.png", + health_bar: "/voxygen/element/skill_bar/health_bar.png", + xp_bar: "/voxygen/element/skill_bar/xp_bar.png", - esc_bg: "/voxygen/element/frames/menu.png", + esc_bg: "/voxygen/element/frames/menu.png", - window_frame_2: "/voxygen/element/frames/window_2.png", + window_frame_2: "/voxygen/element/frames/window_2.png", - settings_bg: "/voxygen/element/frames/settings.png", - settings_icon: "/voxygen/element/icons/settings.png", - settings_button_mo: "/voxygen/element/buttons/blue_mo.png", + settings_bg: "/voxygen/element/frames/settings.png", + settings_icon: "/voxygen/element/icons/settings.png", + settings_button_mo: "/voxygen/element/buttons/blue_mo.png", - // Char Window - charwindow: "/voxygen/element/misc_bg/charwindow.png", - charwindow_icon: "/voxygen/element/icons/charwindow.png", - charwindow_tab_bg: "/voxygen/element/frames/tab.png", - charwindow_tab: "/voxygen/element/buttons/tab.png", - charwindow_expbar: "/voxygen/element/misc_bg/small_bg.png", - progress_frame: "/voxygen/element/frames/progress_bar.png", - progress: "/voxygen/element/misc_bg/progress.png", + // Char Window + charwindow: "/voxygen/element/misc_bg/charwindow.png", + charwindow_icon: "/voxygen/element/icons/charwindow.png", + charwindow_tab_bg: "/voxygen/element/frames/tab.png", + charwindow_tab: "/voxygen/element/buttons/tab.png", + charwindow_expbar: "/voxygen/element/misc_bg/small_bg.png", + progress_frame: "/voxygen/element/frames/progress_bar.png", + progress: "/voxygen/element/misc_bg/progress.png", - // Quest-Log Window - questlog_bg: "/voxygen/element/misc_bg/small_bg.png", - questlog_icon: "/voxygen/element/icons/questlog.png", + // Quest-Log Window + questlog_bg: "/voxygen/element/misc_bg/small_bg.png", + questlog_icon: "/voxygen/element/icons/questlog.png", - button_blue_mo: "/voxygen/element/buttons/blue_mo.png", - button_blue_press: "/voxygen/element/buttons/blue_press.png", + button_blue_mo: "/voxygen/element/buttons/blue_mo.png", + button_blue_press: "/voxygen/element/buttons/blue_press.png", - // Window BG - window_bg: "/voxygen/element/misc_bg/window_bg.png", + // Window BG + window_bg: "/voxygen/element/misc_bg/window_bg.png", - // Social Window - social_bg: "/voxygen/element/misc_bg/small_bg.png", - social_icon: "/voxygen/element/icons/social.png", + // Social Window + social_bg: "/voxygen/element/misc_bg/small_bg.png", + social_icon: "/voxygen/element/icons/social.png", diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 81b5ec55a5..f6aeceaab0 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -4,7 +4,7 @@ use conrod_core::{ widget_ids, Positionable, Sizeable, Widget, WidgetCommon, }; -use super::{font_ids::Fonts, img_ids::Imgs}; +use super::{img_ids::Imgs, Fonts}; widget_ids! { struct Ids { diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 34cc17bd55..56a7d3e213 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -4,7 +4,7 @@ use conrod_core::{ widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon, }; -use super::{font_ids::Fonts, img_ids::Imgs, Show, TEXT_COLOR}; +use super::{img_ids::Imgs, Fonts, Show, TEXT_COLOR}; widget_ids! { struct Ids { diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 8a89eb6c6f..8923fab1b2 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -3,7 +3,6 @@ mod buttons; mod character_window; mod chat; mod esc_menu; -mod font_ids; mod img_ids; mod map; mod minimap; @@ -16,7 +15,6 @@ use buttons::Buttons; use character_window::CharacterWindow; use chat::Chat; use esc_menu::EscMenu; -use font_ids::Fonts; use img_ids::Imgs; use map::Map; use minimap::MiniMap; @@ -83,6 +81,13 @@ widget_ids! { } } +font_ids! { + pub struct Fonts { + opensans: "/voxygen/font/OpenSans-Regular.ttf", + metamorph: "/voxygen/font/Metamorphous-Regular.ttf", + } +} + pub enum Event { SendMessage(String), Logout, diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 1a57cce990..99fcf43d7c 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs, TEXT_COLOR}; +use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; use crate::{hud::Show, ui::ToggleButton}; use conrod_core::{ color, diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index 916bbe003a..5fc20576d4 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs, HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR}; +use super::{img_ids::Imgs, Fonts, HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR}; use conrod_core::{ widget::{self, Image, Rectangle, Text}, widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon, diff --git a/voxygen/src/hud/small_window.rs b/voxygen/src/hud/small_window.rs index f19d75c65e..9dd308ace9 100644 --- a/voxygen/src/hud/small_window.rs +++ b/voxygen/src/hud/small_window.rs @@ -1,4 +1,4 @@ -use super::{font_ids::Fonts, img_ids::Imgs, Windows, TEXT_COLOR}; +use super::{img_ids::Imgs, Fonts, Windows, TEXT_COLOR}; use crate::hud::Show; use conrod_core::{ color, diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index 815d5fb040..10f1591648 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -1,6 +1,6 @@ use crate::{ render::Renderer, - ui::{self, Graphic, ScaleMode, Ui}, + ui::{self, BlankGraphic, Graphic, ImageGraphic, ScaleMode, Ui, VoxelGraphic}, window::Window, }; use common::{ @@ -85,8 +85,6 @@ widget_ids! { test_char_l_big, help_text_bg, help_text, - //test_char_m_button, - //test_char_r_button, // Char Creation // Race Icons @@ -160,158 +158,84 @@ widget_ids! { } } -struct Imgs { - v_logo: ImgId, - bg_selection: ImgId, - bg_creation: ImgId, - button: ImgId, - button_hover: ImgId, - button_press: ImgId, - button_red: ImgId, - button_red_hover: ImgId, - button_red_press: ImgId, - selection_window: ImgId, - test_char_l_button: ImgId, - test_char_l_big: ImgId, - name_input: ImgId, - creation_window: ImgId, - creation_window_body: ImgId, - frame_closed: ImgId, - frame_closed_mo: ImgId, - frame_closed_press: ImgId, - frame_open: ImgId, - frame_open_mo: ImgId, - frame_open_press: ImgId, - skin_eyes_window: ImgId, - hair_window: ImgId, - accessories_window: ImgId, - color_picker_bg: ImgId, - slider_range: ImgId, - slider_indicator: ImgId, - window_frame_2: ImgId, +image_ids! { + struct Imgs { + + v_logo: "/voxygen/element/v_logo.vox", + button: "/voxygen/element/buttons/button.vox", + button_hover: "/voxygen/element/buttons/button_hover.vox", + button_press: "/voxygen/element/buttons/button_press.vox", + button_red: "/voxygen/element/buttons/button_red.vox", + button_red_hover: "/voxygen/element/buttons/button_red_hover.vox", + button_red_press: "/voxygen/element/buttons/button_red_press.vox", + name_input: "/voxygen/element/misc_bg/textbox.vox", - //test_char_m_button: ImgId, - //test_char_r_button: ImgId, - // Race Icons - male: ImgId, - female: ImgId, - human_m: ImgId, - human_f: ImgId, - orc_m: ImgId, - orc_f: ImgId, - dwarf_m: ImgId, - dwarf_f: ImgId, - undead_m: ImgId, - undead_f: ImgId, - elf_m: ImgId, - elf_f: ImgId, - danari_m: ImgId, - danari_f: ImgId, - // Weapon Icons - daggers: ImgId, - sword_shield: ImgId, - sword: ImgId, - axe: ImgId, - hammer: ImgId, - bow: ImgId, - staff: ImgId, - // Arrows - arrow_left: ImgId, - arrow_left_mo: ImgId, - arrow_left_press: ImgId, - arrow_left_grey: ImgId, - arrow_right: ImgId, - arrow_right_mo: ImgId, - arrow_right_press: ImgId, - arrow_right_grey: ImgId, - // Icon Borders - icon_border: ImgId, - icon_border_mo: ImgId, - icon_border_press: ImgId, - icon_border_pressed: ImgId, + + bg_selection: "/voxygen/background/bg_selection.png", + bg_creation: "/voxygen/background/bg_creation.png", + selection_window: "/voxygen/element/frames/selection.png", + test_char_l_button: "/voxygen/element/misc_bg/test_char_l.png", + test_char_l_big: "/voxygen/element/misc_bg/test_char_l_big.png", + creation_window: "/voxygen/element/frames/char_creation.png", + creation_window_body: "/voxygen/element/frames/body_creation.png", + frame_closed: "/voxygen/element/buttons/frame/closed.png", + frame_closed_mo: "/voxygen/element/buttons/frame/closed_mo.png", + frame_closed_press: "/voxygen/element/buttons/frame/closed_press.png", + frame_open: "/voxygen/element/buttons/frame/open.png", + frame_open_mo: "/voxygen/element/buttons/frame/open_mo.png", + frame_open_press: "/voxygen/element/buttons/frame/open_press.png", + skin_eyes_window: "/voxygen/element/frames/skin_eyes.png", + hair_window: "/voxygen/element/frames/skin_eyes.png", + accessories_window: "/voxygen/element/frames/skin_eyes.png", + color_picker_bg: "/voxygen/element/misc_bg/color_picker_blank.png", + slider_range: "/voxygen/element/slider/track.png", + slider_indicator: "/voxygen/element/slider/indicator.png", + window_frame_2: "/voxygen/element/frames/window_2.png", + + // Weapon Icons + daggers: "/voxygen/element/icons/daggers.png", + sword_shield: "/voxygen/element/icons/swordshield.png", + sword: "/voxygen/element/icons/sword.png", + axe: "/voxygen/element/icons/axe.png", + hammer: "/voxygen/element/icons/hammer.png", + bow: "/voxygen/element/icons/bow.png", + staff: "/voxygen/element/icons/staff.png", + // Race Icons + male: "/voxygen/element/icons/male.png", + female: "/voxygen/element/icons/female.png", + human_m: "/voxygen/element/icons/human_m.png", + human_f: "/voxygen/element/icons/human_f.png", + orc_m: "/voxygen/element/icons/orc_m.png", + orc_f: "/voxygen/element/icons/orc_f.png", + dwarf_m: "/voxygen/element/icons/dwarf_m.png", + dwarf_f: "/voxygen/element/icons/dwarf_f.png", + undead_m: "/voxygen/element/icons/ud_m.png", + undead_f: "/voxygen/element/icons/ud_f.png", + elf_m: "/voxygen/element/icons/elf_m.png", + elf_f: "/voxygen/element/icons/elf_f.png", + danari_m: "/voxygen/element/icons/danari_m.png", + danari_f: "/voxygen/element/icons/danari_f.png", + // Arrows + arrow_left: "/voxygen/element/buttons/arrow/left.png", + arrow_left_mo: "/voxygen/element/buttons/arrow/left_mo.png", + arrow_left_press: "/voxygen/element/buttons/arrow/left_press.png", + arrow_left_grey: "/voxygen/element/buttons/arrow/left_inactive.png", + arrow_right: "/voxygen/element/buttons/arrow/right.png", + arrow_right_mo: "/voxygen/element/buttons/arrow/right_mo.png", + arrow_right_press: "/voxygen/element/buttons/arrow/right_press.png", + arrow_right_grey: "/voxygen/element/buttons/arrow/right_inactive.png", + // Icon Borders + icon_border: "/voxygen/element/buttons/border.png", + icon_border_mo: "/voxygen/element/buttons/border_mo.png", + icon_border_press: "/voxygen/element/buttons/border_press.png", + icon_border_pressed: "/voxygen/element/buttons/border_pressed.png", + } } -impl Imgs { - fn new(ui: &mut Ui) -> Imgs { - let load_img = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let image = assets::load::(fullpath.as_str()).unwrap(); - ui.add_graphic(Graphic::Image(image)) - }; - let load_vox = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let dot_vox = assets::load::(fullpath.as_str()).unwrap(); - ui.add_graphic(Graphic::Voxel(dot_vox)) - }; - Imgs { - v_logo: load_vox("element/v_logo.vox", ui), - bg_selection: load_img("background/bg_selection.png", ui), - bg_creation: load_img("background/bg_creation.png", ui), - selection_window: load_img("element/frames/selection.png", 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), - button_red: load_vox("element/buttons/button_red.vox", ui), - button_red_hover: load_vox("element/buttons/button_red_hover.vox", ui), - button_red_press: load_vox("element/buttons/button_red_press.vox", ui), - test_char_l_button: load_img("element/misc_bg/test_char_l.png", ui), - test_char_l_big: load_img("element/misc_bg/test_char_l_big.png", ui), - name_input: load_vox("element/misc_bg/textbox.vox", ui), - creation_window: load_img("element/frames/char_creation.png", ui), - creation_window_body: load_img("element/frames/body_creation.png", ui), - frame_closed: load_img("element/buttons/frame/closed.png", ui), - frame_closed_mo: load_img("element/buttons/frame/closed_mo.png", ui), - frame_closed_press: load_img("element/buttons/frame/closed_press.png", ui), - frame_open: load_img("element/buttons/frame/open.png", ui), - frame_open_mo: load_img("element/buttons/frame/open_mo.png", ui), - frame_open_press: load_img("element/buttons/frame/open_press.png", ui), - skin_eyes_window: load_img("element/frames/skin_eyes.png", ui), - hair_window: load_img("element/frames/skin_eyes.png", ui), - accessories_window: load_img("element/frames/skin_eyes.png", ui), - color_picker_bg: load_img("element/misc_bg/color_picker_blank.png", ui), - slider_range: load_img("element/slider/track.png", ui), - slider_indicator: load_img("element/slider/indicator.png", ui), - window_frame_2: load_img("element/frames/window_2.png", ui), - // Weapon Icons - daggers: load_img("element/icons/daggers.png", ui), - sword_shield: load_img("element/icons/swordshield.png", ui), - sword: load_img("element/icons/sword.png", ui), - axe: load_img("element/icons/axe.png", ui), - hammer: load_img("element/icons/hammer.png", ui), - bow: load_img("element/icons/bow.png", ui), - staff: load_img("element/icons/staff.png", ui), - //test_char_m_button: load_img("test_char_m_button"), - //test_char_r_button: load_img("test_char_r_button"), - // Race Icons - male: load_img("element/icons/male.png", ui), - female: load_img("element/icons/female.png", ui), - human_m: load_img("element/icons/human_m.png", ui), - human_f: load_img("element/icons/human_f.png", ui), - orc_m: load_img("element/icons/orc_m.png", ui), - orc_f: load_img("element/icons/orc_f.png", ui), - dwarf_m: load_img("element/icons/dwarf_m.png", ui), - dwarf_f: load_img("element/icons/dwarf_f.png", ui), - undead_m: load_img("element/icons/ud_m.png", ui), - undead_f: load_img("element/icons/ud_f.png", ui), - elf_m: load_img("element/icons/elf_m.png", ui), - elf_f: load_img("element/icons/elf_f.png", ui), - danari_m: load_img("element/icons/danari_m.png", ui), - danari_f: load_img("element/icons/danari_f.png", ui), - // Arrows - arrow_left: load_img("element/buttons/arrow/left.png", ui), - arrow_left_mo: load_img("element/buttons/arrow/left_mo.png", ui), - arrow_left_press: load_img("element/buttons/arrow/left_press.png", ui), - arrow_left_grey: load_img("element/buttons/arrow/left_inactive.png", ui), - arrow_right: load_img("element/buttons/arrow/right.png", ui), - arrow_right_mo: load_img("element/buttons/arrow/right_mo.png", ui), - arrow_right_press: load_img("element/buttons/arrow/right_press.png", ui), - arrow_right_grey: load_img("element/buttons/arrow/right_inactive.png", ui), - // Icon Borders - icon_border: load_img("element/buttons/border.png", ui), - icon_border_mo: load_img("element/buttons/border_mo.png", ui), - icon_border_press: load_img("element/buttons/border_press.png", ui), - icon_border_pressed: load_img("element/buttons/border_pressed.png", ui), - } +font_ids! { + pub struct Fonts { + opensans: "/voxygen/font/OpenSans-Regular.ttf", + metamorph: "/voxygen/font/Metamorphous-Regular.ttf", } } @@ -340,8 +264,7 @@ pub struct CharSelectionUi { ui: Ui, ids: Ids, imgs: Imgs, - font_metamorph: FontId, - font_opensans: FontId, + fonts: Fonts, character_creation: bool, selected_char_no: Option, character_name: String, @@ -357,22 +280,16 @@ impl CharSelectionUi { // Generate ids let ids = Ids::new(ui.id_generator()); // Load images - let imgs = Imgs::new(&mut ui); + let imgs = Imgs::load(&mut ui).expect("Failed to load images"); // Load fonts - let load_font = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/font", filename].concat(); - ui.new_font(assets::load(fullpath.as_str()).expect("Error loading file")) - }; - let font_opensans = load_font("/OpenSans-Regular.ttf", &mut ui); - let font_metamorph = load_font("/Metamorphous-Regular.ttf", &mut ui); + let fonts = Fonts::load(&mut ui).expect("Failed to load fonts"); // TODO: Randomize initial values Self { ui, - imgs, ids, - font_metamorph, - font_opensans, + imgs, + fonts, character_creation: false, selected_char_no: None, character_name: "Character Name".to_string(), @@ -574,7 +491,7 @@ impl CharSelectionUi { .w_h(300.0, 60.0) .mid_top_with_margin_on(self.ids.name_input, 2.0) .font_size(26) - .font_id(self.font_metamorph) + .font_id(self.fonts.metamorph) .center_justify() .text_color(TEXT_COLOR) .color(TRANSPARENT) @@ -931,7 +848,7 @@ impl CharSelectionUi { .mid_top_with_margin_on(self.ids.creation_window, 410.0) .w(500.0) .font_size(20) - .font_id(self.font_opensans) + .font_id(self.fonts.opensans) .color(TEXT_COLOR) .wrap_by_word() .set(self.ids.race_description, ui_widgets); @@ -1105,7 +1022,7 @@ impl CharSelectionUi { .mid_top_with_margin_on(self.ids.creation_window, 410.0) .w(500.0) .font_size(20) - .font_id(self.font_opensans) + .font_id(self.fonts.opensans) .color(TEXT_COLOR) .wrap_by_word() .set(self.ids.race_description, ui_widgets); diff --git a/voxygen/src/menu/main/ui.rs b/voxygen/src/menu/main/ui.rs index a644c579b5..c8f4f078b2 100644 --- a/voxygen/src/menu/main/ui.rs +++ b/voxygen/src/menu/main/ui.rs @@ -1,6 +1,6 @@ use crate::{ render::Renderer, - ui::{self, Graphic, ScaleMode, Ui}, + ui::{self, BlankGraphic, Graphic, ImageGraphic, ScaleMode, Ui, VoxelGraphic}, GlobalState, DEFAULT_PUBLIC_SERVER, }; use common::assets; @@ -51,41 +51,25 @@ widget_ids! { } } -struct Imgs { - bg: ImgId, - v_logo: ImgId, +image_ids! { + struct Imgs { + + v_logo: "/voxygen/element/v_logo.vox", + input_bg: "/voxygen/element/misc_bg/textbox.vox", + button: "/voxygen/element/buttons/button.vox", + button_hover: "/voxygen/element/buttons/button_hover.vox", + button_press: "/voxygen/element/buttons/button_press.vox", - input_bg: ImgId, - - error_frame: ImgId, - button: ImgId, - button_hover: ImgId, - button_press: ImgId, + + bg: "/voxygen/background/bg_main.png", + error_frame: "/voxygen/element/frames/window_2.png", + } } -impl Imgs { - fn new(ui: &mut Ui) -> Imgs { - let load_img = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let image = assets::load::(fullpath.as_str()).unwrap(); - ui.add_graphic(Graphic::Image(image)) - }; - let load_vox = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/", filename].concat(); - let dot_vox = assets::load::(fullpath.as_str()).unwrap(); - ui.add_graphic(Graphic::Voxel(dot_vox)) - }; - Imgs { - bg: load_img("background/bg_main.png", ui), - v_logo: load_vox("element/v_logo.vox", ui), - // Input fields - input_bg: load_vox("element/misc_bg/textbox.vox", ui), - - error_frame: load_img("element/frames/window_2.png", 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), - } +font_ids! { + pub struct Fonts { + opensans: "/voxygen/font/OpenSans-Regular.ttf", + metamorph: "/voxygen/font/Metamorphous-Regular.ttf", } } @@ -102,8 +86,7 @@ pub struct MainMenuUi { ui: Ui, ids: Ids, imgs: Imgs, - font_metamorph: FontId, - font_opensans: FontId, + fonts: Fonts, username: String, server_address: String, login_error: Option, @@ -121,21 +104,15 @@ impl MainMenuUi { // Generate ids let ids = Ids::new(ui.id_generator()); // Load images - let imgs = Imgs::new(&mut ui); + let imgs = Imgs::load(&mut ui).expect("Failed to load images"); // Load fonts - let load_font = |filename, ui: &mut Ui| { - let fullpath: String = ["/voxygen/font", filename].concat(); - ui.new_font(assets::load(fullpath.as_str()).expect("Error loading file")) - }; - let font_opensans = load_font("/OpenSans-Regular.ttf", &mut ui); - let font_metamorph = load_font("/Metamorphous-Regular.ttf", &mut ui); + let fonts = Fonts::load(&mut ui).expect("Failed to load fonts"); Self { ui, - imgs, ids, - font_metamorph, - font_opensans, + imgs, + fonts, username: networking.username.clone(), server_address: networking.servers[networking.default_server].clone(), login_error: None, @@ -162,6 +139,7 @@ impl MainMenuUi { .color(TEXT_COLOR) .set(self.ids.version, ui_widgets); + // TODO: Don't use macros for this? // Input fields // Used when the login button is pressed, or enter is pressed within input field macro_rules! login { @@ -175,8 +153,8 @@ impl MainMenuUi { }; } - //Singleplayer - //Used when the singleplayer button is pressed + // Singleplayer + // Used when the singleplayer button is pressed macro_rules! singleplayer { () => { self.login_error = None; @@ -201,7 +179,7 @@ impl MainMenuUi { .w_h(290.0, 30.0) .mid_bottom_with_margin_on(self.ids.username_bg, 44.0 / 2.0) .font_size(22) - .font_id(self.font_opensans) + .font_id(self.fonts.opensans) .text_color(TEXT_COLOR) // transparent background .color(TRANSPARENT) @@ -223,7 +201,7 @@ impl MainMenuUi { let text = Text::new(&msg) .rgba(1.0, 1.0, 1.0, 1.0) .font_size(30) - .font_id(self.font_opensans); + .font_id(self.fonts.opensans); Rectangle::fill_with([400.0, 100.0], color::TRANSPARENT) .rgba(0.1, 0.1, 0.1, 1.0) .parent(ui_widgets.window) @@ -322,7 +300,7 @@ impl MainMenuUi { .w_h(290.0, 30.0) .mid_bottom_with_margin_on(self.ids.address_bg, 44.0 / 2.0) .font_size(22) - .font_id(self.font_opensans) + .font_id(self.fonts.opensans) .text_color(TEXT_COLOR) // transparent background .color(TRANSPARENT)