Merge branch 'master' into 'master'

Use modified version of conrod

See merge request veloren/veloren!21

Former-commit-id: f3f7a2ec1a699b9bbd06b3ea2357c9dcc79552e3
This commit is contained in:
Joshua Barretto 2019-04-13 22:11:39 +00:00
commit c10564d436
3 changed files with 22 additions and 10 deletions

View File

@ -18,8 +18,9 @@ gfx = "0.17"
gfx_device_gl = { version = "0.15", optional = true }
gfx_window_glutin = "0.28"
glutin = "0.19"
conrod_core = "0.63"
conrod_winit = "0.63"
winit = "0.18"
conrod_core = { git = "https://gitlab.com/veloren/conrod.git" }
conrod_winit = { git = "https://gitlab.com/veloren/conrod.git" }
# ECS
specs = "0.14"

View File

@ -106,11 +106,9 @@ impl Chat {
.rgba(0.0, 0.0, 0.0, 0.4)
.up_from(self.ids.input, 0.0)
.set(self.ids.message_box_bg, ui_widgets);
let (mut items, scrollbar) = List::flow_down(self.messages.len())
let (mut items, _scrollbar) = List::flow_down(self.messages.len())
.middle_of(self.ids.message_box_bg)
.scrollbar_next_to()
.scrollbar_thickness(18.0)
.scrollbar_color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.scroll_kids_vertically()
.set(self.ids.message_box, ui_widgets);
while let Some(item) = items.next(ui_widgets) {
item.set(
@ -121,9 +119,6 @@ impl Chat {
ui_widgets,
)
}
//if let Some(s) = scrollbar {
// s.set(ui_widgets)
//}
// Chat Arrow
if !self.scrolled_to_bottom(ui_widgets) {

View File

@ -43,7 +43,23 @@ pub enum UiError {
pub struct Event(Input);
impl Event {
pub fn try_from(event: glutin::Event, window: &glutin::GlWindow) -> Option<Self> {
conrod_winit::convert_event(event, window.window()).map(|input| {
use conrod_winit::*;
use winit;
// A wrapper around the winit window that allows us to implement the trait necessary for enabling
// the winit <-> conrod conversion functions.
struct WindowRef<'a>(&'a winit::Window);
// Implement the `WinitWindow` trait for `WindowRef` to allow for generating compatible conversion
// functions.
impl<'a> conrod_winit::WinitWindow for WindowRef<'a> {
fn get_inner_size(&self) -> Option<(u32, u32)> {
winit::Window::get_inner_size(&self.0).map(Into::into)
}
fn hidpi_factor(&self) -> f32 {
winit::Window::get_hidpi_factor(&self.0) as _
}
}
convert_event!(event, &WindowRef(window.window())).map(|input| {
Self(input)
})
}