added visual test item

This commit is contained in:
Pfauenauge90 2019-06-29 03:47:38 +02:00
parent 626978213f
commit f4499e26af
5 changed files with 40 additions and 10 deletions

BIN
assets/voxygen/element/buttons/grid_inv.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/potion_red.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,8 +1,9 @@
use super::{img_ids::Imgs, Fonts};
use super::{img_ids::Imgs, Fonts, TEXT_COLOR};
use conrod_core::{
color,
position::Relative,
widget::{self, Button, Image, Rectangle, Scrollbar},
widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
widget_ids, Labelable, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
};
widget_ids! {
@ -16,6 +17,7 @@ widget_ids! {
inv_slot_0,
map_title,
inv_slot[],
item1,
}
}
@ -99,10 +101,28 @@ impl<'a> Widget for Bag<'a> {
let x = i % 5;
let y = i / 5;
Button::image(self.imgs.inv_slot)
.top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0))
.top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0))
.parent(state.ids.inv_grid_2)
.w_h(40.0, 40.0)
.set(state.ids.inv_slot[i], ui);
}
}
// Test Item
if self.inventory_space > 0 {
Button::image(self.imgs.potion_red)
.w_h(4.0*3.5, 7.0*3.5)
.middle_of(state.ids.inv_slot[0])
.label("5x")
.label_font_id(self.fonts.opensans)
.label_font_size(12)
.label_x(Relative::Scalar(10.0))
.label_y(Relative::Scalar(-10.0))
.label_color(TEXT_COLOR)
.set(state.ids.item1, ui);
}
// X-button
if Button::image(self.imgs.close_button)
.w_h(28.0, 28.0)

View File

@ -8,13 +8,14 @@ image_ids! {
bag_contents: "voxygen/element/frames/bag.vox",
inv_grid: "voxygen/element/frames/inv_grid.vox",
inv_slot: "voxygen/element/buttons/inv_slot.vox",
grid_inv: "voxygen/element/buttons/grid_inv.vox",
// Window Parts
window_3: "voxygen/element/frames/window_3.vox",
tab_bg: "voxygen/element/frames/tab_bg.vox",
tab_small_open: "voxygen/element/frames/tab_small_open.vox",
tab_small_closed: "voxygen/element/frames/tab_small_closed.vox",
// MiniMap
mmap_frame: "voxygen/element/frames/mmap.vox",
mmap_frame_closed: "voxygen/element/frames/mmap_closed.vox",
@ -121,6 +122,8 @@ image_ids! {
// Crosshair
crosshair: "voxygen/element/misc_bg/crosshair.vox",
// Items
potion_red: "voxygen/voxel/object/potion_red.vox",
//////////////////////////////////////////////////////////////////////////////////////////////////////
<ImageGraphic>

View File

@ -291,7 +291,7 @@ impl Hud {
open_windows: Windows::None,
map: false,
ui: true,
inventory_test_button: false,
inventory_test_button: true,
mini_map: false,
settings_tab: SettingsTab::Interface,
want_grab: true,
@ -476,13 +476,14 @@ impl Hud {
// Add Bag-Space Button.
if self.show.inventory_test_button {
if Button::image(self.imgs.grid_button)
if Button::image(self.imgs.button)
.w_h(100.0, 100.0)
.middle_of(ui_widgets.window)
.label("1 Up!")
.label("Add 10 Spaces")
.label_font_size(20)
.hover_image(self.imgs.grid_button_hover)
.press_image(self.imgs.grid_button_press)
.label_color(TEXT_COLOR)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.set(self.ids.bag_space_add, ui_widgets)
.was_clicked()
{