#[cfg(feature = "glfw")]
use glium;
use glfw;
use {Screen, ScreenType};
impl<'a> Screen<'a> {
#[inline]
pub fn reset_cursor(&mut self) {
self.curr_cursor = glfw::StandardCursor::Arrow;
match self.display {
ScreenType::Window(ref d) => {
(*d).gl_window_mut().set_cursor(Some(glfw::Cursor::standard(self.curr_cursor)));
}
_ => (),
};
}
#[inline]
pub fn cursor(&mut self, cursor_type: &str) {
match self.display {
ScreenType::Window(ref d) => {
(*d).gl_window_mut().set_cursor_mode(glfw::CursorMode::Normal);
}
_ => ()
}
if cursor_type == "HAND" {
self.curr_cursor = glfw::StandardCursor::Hand;
} else if cursor_type == "ARROW" {
self.curr_cursor = glfw::StandardCursor::Arrow;
} else if cursor_type == "CROSS" {
self.curr_cursor = glfw::StandardCursor::Crosshair;
} else if cursor_type == "MOVE" {
self.curr_cursor = glfw::StandardCursor::Crosshair;
} else if cursor_type == "TEXT" {
self.curr_cursor = glfw::StandardCursor::IBeam;
} else if cursor_type == "WAIT" {
}
match self.display {
ScreenType::Window(ref d) => {
(*d).gl_window_mut().set_cursor(Some(glfw::Cursor::standard(self.curr_cursor)));
}
_ => ()
};
}
#[inline]
pub fn focused(&mut self) -> bool {
let mut focused = false;
self.glfw.poll_events();
for (_, event) in glfw::flush_messages(&self.events_loop) {
match event {
glfw::WindowEvent::Focus(true) => {
focused = true;
}
_ => (),
}
}
focused
}
#[inline]
pub fn frame_count(&self) -> isize {
self.frame_count
}
#[inline]
pub fn get_frame_rate(&self) -> isize {
self.frame_rate
}
#[inline]
pub fn set_frame_rate(&mut self, f_rate: isize) {
self.frame_rate = f_rate;
}
#[inline]
pub fn height(&self) -> u32 {
self.height
}
#[inline]
pub fn no_cursor(&mut self) {
match self.display {
ScreenType::Window(ref d) => {
(*d).gl_window_mut().set_cursor_mode(glfw::CursorMode::Hidden)
}
_ => ()
};
}
#[inline]
pub fn no_smooth(&mut self) {
self.draw_params = glium::draw_parameters::DrawParameters {
smooth: None,
..self.draw_params.clone()
};
}
#[inline]
pub fn smooth(&mut self) {
self.draw_params = glium::draw_parameters::DrawParameters {
smooth: Some(glium::draw_parameters::Smooth::Nicest),
..self.draw_params.clone()
};
}
#[inline]
pub fn width(&self) -> u32 {
self.width
}
}