private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e) { if (m_d3dInterop == null) { m_d3dInterop = new Direct3DInterop(); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( (float)Application.Current.Host.Content.ActualWidth, (float)Application.Current.Host.Content.ActualHeight ); // Hook-up native component to DrawingSurfaceBackgroundGrid DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dInterop.CreateContentProvider()); DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dInterop); // Set the preferred device orientation m_d3dInterop.WindowOrientation = DisplayOrientations.Landscape; // Hook-up Cocos2d-x delegates m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent); m_d3dInterop.SetCocos2dMessageBoxDelegate(OnCocos2dMessageBoxEvent); m_d3dInterop.SetCocos2dEditBoxDelegate(OpenEditBox); } }
private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e) { if (m_d3dInterop == null) { PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty); DisplayOrientations displayOrientation; switch (pageOrientation) { case PageOrientation.Portrait: case PageOrientation.PortraitUp: displayOrientation = DisplayOrientations.Portrait; break; case PageOrientation.PortraitDown: displayOrientation = DisplayOrientations.PortraitFlipped; break; case PageOrientation.Landscape: case PageOrientation.LandscapeLeft: displayOrientation = DisplayOrientations.Landscape; break; case PageOrientation.LandscapeRight: displayOrientation = DisplayOrientations.LandscapeFlipped; break; default: displayOrientation = DisplayOrientations.Landscape; break; } m_d3dInterop = new Direct3DInterop(displayOrientation); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( (float)Application.Current.Host.Content.ActualWidth, (float)Application.Current.Host.Content.ActualHeight ); // Hook-up native component to DrawingSurfaceBackgroundGrid DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dInterop.CreateContentProvider()); DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dInterop); // Hook-up Cocos2d-x delegates m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent); m_d3dInterop.SetCocos2dMessageBoxDelegate(OnCocos2dMessageBoxEvent); m_d3dInterop.SetCocos2dEditBoxDelegate(OpenEditBox); } }
private void DrawingSurface_Loaded(object sender, RoutedEventArgs e) { if (m_d3dInterop == null) { m_d3dInterop = new Direct3DInterop(); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( (float)DrawingSurface.ActualWidth, (float)DrawingSurface.ActualHeight ); // Hook-up native component to DrawingSurface DrawingSurface.SetContentProvider(m_d3dInterop.CreateContentProvider()); DrawingSurface.SetManipulationHandler(m_d3dInterop); // Hook-up Cocos2d-x delegates m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent); m_d3dInterop.SetCocos2dMessageBoxDelegate(OnCocos2dMessageBoxEvent); m_d3dInterop.SetCocos2dEditBoxDelegate(OpenEditBox); } }
private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e) { if (m_d3dInterop == null) { PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty); DisplayOrientations displayOrientation; switch(pageOrientation) { case PageOrientation.Portrait: case PageOrientation.PortraitUp: displayOrientation = DisplayOrientations.Portrait; break; case PageOrientation.PortraitDown: displayOrientation = DisplayOrientations.PortraitFlipped; break; case PageOrientation.Landscape: case PageOrientation.LandscapeLeft: displayOrientation = DisplayOrientations.Landscape; break; case PageOrientation.LandscapeRight: displayOrientation = DisplayOrientations.LandscapeFlipped; break; default: displayOrientation = DisplayOrientations.Landscape; break; } m_d3dInterop = new Direct3DInterop(displayOrientation); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( (float)Application.Current.Host.Content.ActualWidth, (float)Application.Current.Host.Content.ActualHeight ); // Hook-up native component to DrawingSurfaceBackgroundGrid DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dInterop.CreateContentProvider()); DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dInterop); // Hook-up Cocos2d-x delegates m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent); m_d3dInterop.SetCocos2dMessageBoxDelegate(OnCocos2dMessageBoxEvent); m_d3dInterop.SetCocos2dEditBoxDelegate(OpenEditBox); m_d3dInterop.SetCocos2dOpenURLDelegate(OpenURL); } }
private void DrawingSurfaceBackground_Loaded(object sender, RoutedEventArgs e) { if (m_d3dInterop == null) { PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty); DisplayOrientations displayOrientation = ConvertToNativeOrientation(pageOrientation); m_d3dInterop = new Direct3DInterop(displayOrientation); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( (float)Application.Current.Host.Content.ActualWidth, (float)Application.Current.Host.Content.ActualHeight ); // Hook-up native component to DrawingSurfaceBackgroundGrid DrawingSurfaceBackground.SetBackgroundContentProvider(m_d3dInterop.CreateContentProvider()); DrawingSurfaceBackground.SetBackgroundManipulationHandler(m_d3dInterop); // Hook-up Cocos2d-x delegates m_d3dInterop.SetCocos2dEventDelegate(OnCocos2dEvent); m_d3dInterop.SetCocos2dMessageBoxDelegate(OnCocos2dMessageBoxEvent); m_d3dInterop.SetCocos2dEditBoxDelegate(OpenEditBox); m_d3dInterop.SetCocos2dOpenURLDelegate(OpenURL); } }