aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/android/mod.rs23
-rw-r--r--src/headless.rs9
-rw-r--r--src/window.rs9
3 files changed, 27 insertions, 14 deletions
diff --git a/src/api/android/mod.rs b/src/api/android/mod.rs
index be5a79f..12d0bea 100644
--- a/src/api/android/mod.rs
+++ b/src/api/android/mod.rs
@@ -8,8 +8,7 @@ use std::sync::mpsc::{Receiver, channel};
use {CreationError, Event, MouseCursor};
use CreationError::OsError;
use events::ElementState::{Pressed, Released};
-use events::Event::{MouseInput, MouseMoved};
-use events::MouseButton;
+use events::{Touch, TouchPhase};
use std::collections::VecDeque;
@@ -70,15 +69,19 @@ impl<'a> Iterator for PollEventsIterator<'a> {
fn next(&mut self) -> Option<Event> {
match self.window.event_rx.try_recv() {
- Ok(event) => {
- match event {
- android_glue::Event::EventDown => Some(MouseInput(Pressed, MouseButton::Left)),
- android_glue::Event::EventUp => Some(MouseInput(Released, MouseButton::Left)),
- android_glue::Event::EventMove(x, y) => Some(MouseMoved((x as i32, y as i32))),
- _ => None,
- }
+ Ok(android_glue::Event::EventMotion(motion)) => {
+ Some(Event::Touch(Touch {
+ phase: match motion.action {
+ android_glue::MotionAction::Down => TouchPhase::Started,
+ android_glue::MotionAction::Move => TouchPhase::Moved,
+ android_glue::MotionAction::Up => TouchPhase::Ended,
+ android_glue::MotionAction::Cancel => TouchPhase::Cancelled,
+ },
+ location: (motion.x as f64, motion.y as f64),
+ id: motion.pointer_id as u64,
+ }))
}
- Err(_) => {
+ _ => {
None
}
}
diff --git a/src/headless.rs b/src/headless.rs
index 4730eb4..f3ddbf0 100644
--- a/src/headless.rs
+++ b/src/headless.rs
@@ -16,9 +16,14 @@ use platform;
/// Object that allows you to build headless contexts.
pub struct HeadlessRendererBuilder<'a> {
- dimensions: (u32, u32),
+ /// The dimensions to use.
+ pub dimensions: (u32, u32),
+
+ /// The OpenGL attributes to build the context with.
+ pub opengl: GlAttributes<&'a platform::HeadlessContext>,
+
+ // Should be made public once it's stabilized.
pf_reqs: PixelFormatRequirements,
- opengl: GlAttributes<&'a platform::HeadlessContext>,
}
impl<'a> HeadlessRendererBuilder<'a> {
diff --git a/src/window.rs b/src/window.rs
index 246f5c9..e69f525 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -24,9 +24,14 @@ use platform;
/// Object that allows you to build windows.
pub struct WindowBuilder<'a> {
+ /// The attributes to use to create the window.
+ pub window: WindowAttributes,
+
+ /// The attributes to use to create the context.
+ pub opengl: GlAttributes<&'a platform::Window>,
+
+ // Should be made public once it's stabilized.
pf_reqs: PixelFormatRequirements,
- window: WindowAttributes,
- opengl: GlAttributes<&'a platform::Window>,
}
impl<'a> WindowBuilder<'a> {