internal override void Initialize(GameContext gameContext) { GameContext = gameContext; xenkoGameForm = (AndroidXenkoGameView)gameContext.Control; nativeWindow = new WindowHandle(AppContextType.Android, xenkoGameForm); xenkoGameForm.Load += gameForm_Resume; xenkoGameForm.OnPause += gameForm_OnPause; xenkoGameForm.Unload += gameForm_Unload; xenkoGameForm.RenderFrame += gameForm_RenderFrame; // Setup the initial size of the window var width = gameContext.RequestedWidth; if (width == 0) { width = xenkoGameForm.Width; } var height = gameContext.RequestedHeight; if (height == 0) { height = xenkoGameForm.Height; } // Transmit requested back buffer and depth stencil formats to OpenTK xenkoGameForm.RequestedBackBufferFormat = gameContext.RequestedBackBufferFormat; xenkoGameForm.RequestedGraphicsProfile = gameContext.RequestedGraphicsProfile; xenkoGameForm.Size = new Size(width, height); //xenkoGameForm.Resize += OnClientSizeChanged; }
internal override void Initialize(GameContext gameContext) { this.GameContext = gameContext; gameForm = (OpenTK.GameWindow)gameContext.Control; nativeWindow = new WindowHandle(AppContextType.DesktopOpenTK, gameForm); // Setup the initial size of the window var width = gameContext.RequestedWidth; if (width == 0) { width = gameForm.Width; } var height = gameContext.RequestedHeight; if (height == 0) { height = gameForm.Height; } gameForm.ClientSize = new System.Drawing.Size(width, height); gameForm.MouseEnter += GameWindowForm_MouseEnter; gameForm.MouseLeave += GameWindowForm_MouseLeave; gameForm.Resize += OnClientSizeChanged; }
internal override void Initialize(GameContext gameContext) { GameContext = gameContext; gameForm = gameContext.GameView; nativeWindow = new WindowHandle(AppContextType.iOS, gameForm); gameForm.Load += gameForm_Load; gameForm.Unload += gameForm_Unload; gameForm.RenderFrame += gameForm_RenderFrame; // get the OpenGL ES version var contextAvailable = false; foreach (var version in OpenGLUtils.GetGLVersions(gameContext.RequestedGraphicsProfile)) { var contextRenderingApi = MajorVersionTOEAGLRenderingAPI(version); EAGLContext contextTest = null; try { contextTest = new EAGLContext(contextRenderingApi); // delete extra context if (contextTest != null) contextTest.Dispose(); gameForm.ContextRenderingApi = contextRenderingApi; contextAvailable = true; break; } catch (Exception) { // TODO: log message } } if (!contextAvailable) throw new Exception("Graphics context could not be created."); gameForm.LayerColorFormat = EAGLColorFormat.RGBA8; //gameForm.LayerRetainsBacking = false; }
internal override void Initialize(GameContext windowContext) { if (windowContext != null) { swapChainPanel = windowContext.Control as SwapChainPanel; if (swapChainPanel == null) { throw new NotSupportedException(string.Format("Unsupported window context [{0}]. Only SwapChainPanel", windowContext.Control.GetType().FullName)); } windowHandle = new WindowHandle(AppContextType.WindowsRuntime, swapChainPanel); #if SILICONSTUDIO_PLATFORM_WINDOWS_10 var appView = ApplicationView.GetForCurrentView(); if (appView != null && windowContext.RequestedWidth != 0 && windowContext.RequestedHeight != 0) appView.TryResizeView(new Size(windowContext.RequestedWidth, windowContext.RequestedHeight)); #endif //clientBounds = new DrawingRectangle(0, 0, (int)swapChainPanel.ActualWidth, (int)swapChainPanel.ActualHeight); swapChainPanel.SizeChanged += swapChainPanel_SizeChanged; swapChainPanel.CompositionScaleChanged += swapChainPanel_CompositionScaleChanged; } }