aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/emscripten/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/emscripten/mod.rs')
-rw-r--r--src/api/emscripten/mod.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/api/emscripten/mod.rs b/src/api/emscripten/mod.rs
index e6f51e3..0913623 100644
--- a/src/api/emscripten/mod.rs
+++ b/src/api/emscripten/mod.rs
@@ -23,6 +23,7 @@ pub struct PollEventsIterator<'a> {
impl<'a> Iterator for PollEventsIterator<'a> {
type Item = Event;
+ #[inline]
fn next(&mut self) -> Option<Event> {
None
}
@@ -35,6 +36,7 @@ pub struct WaitEventsIterator<'a> {
impl<'a> Iterator for WaitEventsIterator<'a> {
type Item = Event;
+ #[inline]
fn next(&mut self) -> Option<Event> {
None
}
@@ -44,6 +46,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
pub struct WindowProxy;
impl WindowProxy {
+ #[inline]
pub fn wakeup_event_loop(&self) {
unimplemented!()
}
@@ -51,21 +54,25 @@ impl WindowProxy {
pub struct MonitorID;
+#[inline]
pub fn get_available_monitors() -> VecDeque<MonitorID> {
let mut list = VecDeque::new();
list.push_back(MonitorID);
list
}
+#[inline]
pub fn get_primary_monitor() -> MonitorID {
MonitorID
}
impl MonitorID {
+ #[inline]
pub fn get_name(&self) -> Option<String> {
- Some("Canvas".to_string())
+ Some("Canvas".to_owned())
}
+ #[inline]
pub fn get_dimensions(&self) -> (u32, u32) {
unimplemented!()
}
@@ -109,13 +116,16 @@ impl Window {
})
}
+ #[inline]
pub fn set_title(&self, _title: &str) {
}
+ #[inline]
pub fn get_position(&self) -> Option<(i32, i32)> {
Some((0, 0))
}
+ #[inline]
pub fn set_position(&self, _: i32, _: i32) {
}
@@ -135,10 +145,12 @@ impl Window {
}
}
+ #[inline]
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
self.get_inner_size()
}
+ #[inline]
pub fn set_inner_size(&self, width: u32, height: u32) {
unsafe {
use std::ptr;
@@ -147,52 +159,64 @@ impl Window {
}
}
+ #[inline]
pub fn poll_events(&self) -> PollEventsIterator {
PollEventsIterator {
window: self,
}
}
+ #[inline]
pub fn wait_events(&self) -> WaitEventsIterator {
WaitEventsIterator {
window: self,
}
}
+ #[inline]
pub fn create_window_proxy(&self) -> WindowProxy {
WindowProxy
}
+ #[inline]
pub fn show(&self) {}
+ #[inline]
pub fn hide(&self) {}
+ #[inline]
pub fn platform_display(&self) -> *mut libc::c_void {
unimplemented!()
}
+ #[inline]
pub fn platform_window(&self) -> *mut libc::c_void {
unimplemented!()
}
+ #[inline]
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}
+ #[inline]
pub fn set_cursor(&self, _cursor: MouseCursor) {
unimplemented!()
}
+ #[inline]
pub fn hidpi_factor(&self) -> f32 {
1.0
}
}
impl GlContext for Window {
+ #[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
// TOOD: check if == EMSCRIPTEN_RESULT
ffi::emscripten_webgl_make_context_current(self.context);
Ok(())
}
+ #[inline]
fn is_current(&self) -> bool {
true // FIXME:
}
@@ -206,15 +230,18 @@ impl GlContext for Window {
}
}
+ #[inline]
fn swap_buffers(&self) -> Result<(), ContextError> {
unsafe { ffi::emscripten_sleep(1); } // FIXME:
Ok(())
}
+ #[inline]
fn get_api(&self) -> Api {
Api::WebGl
}
+ #[inline]
fn get_pixel_format(&self) -> PixelFormat {
unimplemented!();
}