From 389a59567f38afa62a0d612be95be2985d698b08 Mon Sep 17 00:00:00 2001 From: "aydin.kim" Date: Wed, 20 Nov 2013 15:51:40 +0900 Subject: [PATCH] add native graphics metadata for android --- azure.rc | 2 ++ azure_hl.rs | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/azure.rc b/azure.rc index 7c005b0..4bb4afb 100644 --- a/azure.rc +++ b/azure.rc @@ -15,6 +15,8 @@ extern mod layers = "rust-layers"; extern mod opengles = "rust-opengles"; #[cfg(target_os = "linux")] extern mod xlib = "rust-xlib"; +#[cfg(target_os = "android")] +extern mod egl; #[cfg(not(target_os = "android"))] extern mod glfw; diff --git a/azure_hl.rs b/azure_hl.rs index abc990a..be405e9 100644 --- a/azure_hl.rs +++ b/azure_hl.rs @@ -792,7 +792,6 @@ pub fn current_graphics_metadata() -> NativeGraphicsMetadata { } #[cfg(target_os="macos")] -#[cfg(target_os="android")] #[fixed_stack_segment] pub fn current_graphics_metadata() -> NativeGraphicsMetadata { use opengles::cgl::{CGLGetCurrentContext, CGLGetPixelFormat}; @@ -803,3 +802,13 @@ pub fn current_graphics_metadata() -> NativeGraphicsMetadata { } } +#[cfg(target_os="android")] +#[fixed_stack_segment] +pub fn current_graphics_metadata() -> NativeGraphicsMetadata { + use egl::egl::GetCurrentDisplay; + unsafe { + NativeGraphicsMetadata { + display: GetCurrentDisplay(), + } + } +}