Example #1
0
        internal override void Initialize(GameContext gameContext)
        {
            GameContext = gameContext;

            paradoxGameForm = (AndroidParadoxGameView)gameContext.Control;
            nativeWindow    = new WindowHandle(AppContextType.Android, paradoxGameForm);

            paradoxGameForm.Load        += gameForm_Resume;
            paradoxGameForm.OnPause     += gameForm_OnPause;
            paradoxGameForm.Unload      += gameForm_Unload;
            paradoxGameForm.RenderFrame += gameForm_RenderFrame;

            // Setup the initial size of the window
            var width = gameContext.RequestedWidth;

            if (width == 0)
            {
                width = paradoxGameForm.Width;
            }

            var height = gameContext.RequestedHeight;

            if (height == 0)
            {
                height = paradoxGameForm.Height;
            }

            // Transmit requested back buffer and depth stencil formats to OpenTK
            paradoxGameForm.RequestedBackBufferFormat = gameContext.RequestedBackBufferFormat;
            paradoxGameForm.RequestedGraphicsProfile  = gameContext.RequestedGraphicsProfile;

            paradoxGameForm.Size = new Size(width, height);

            //paradoxGameForm.Resize += OnClientSizeChanged;
        }
Example #2
0
        protected override void Destroy()
        {
            if (paradoxGameForm != null)
            {
                paradoxGameForm.Load        -= gameForm_Resume;
                paradoxGameForm.OnPause     -= gameForm_OnPause;
                paradoxGameForm.Unload      -= gameForm_Unload;
                paradoxGameForm.RenderFrame -= gameForm_RenderFrame;

                paradoxGameForm.GraphicsContext.MakeCurrent(null);
                paradoxGameForm.GraphicsContext.Dispose();
                ((AndroidWindow)paradoxGameForm.WindowInfo).TerminateDisplay();
                //paradoxGameForm.Close();
                paradoxGameForm.Holder.RemoveCallback(paradoxGameForm);
                paradoxGameForm.Dispose();
                paradoxGameForm = null;
            }

            base.Destroy();
        }