コード例 #1
0
        internal override void Initialize(object windowContext)
        {
            if (isInitialized)
            {
                throw new InvalidOperationException("GameWindow is already initialized");
            }

            windowContext = windowContext ?? new GameWindowForm("SharpDX.Toolkit.Game");
            Control = windowContext as Control;
            if (Control == null)
            {
                throw new NotSupportedException("Unsupported window context. Unable to create game window. Only System.Windows.Control subclass are supported");
            }

            //Control.Focus();

            //Control.MouseEnter += GameWindowForm_MouseEnter;
            //Control.MouseLeave += GameWindowForm_MouseLeave;

            gameWindowForm = windowContext as GameWindowForm;
            if (gameWindowForm != null)
            {
                gameWindowForm.Activated += OnActivated;
                gameWindowForm.Deactivate += OnDeactivated;
                //gameWindowForm.UserResized += OnClientSizeChanged;
            }
            else
            {
                //Control.Resize += OnClientSizeChanged;
            }

            isInitialized = true;
        }
コード例 #2
0
        internal override void Initialize(object windowContext)
        {
            if (isInitialized)
            {
                throw new InvalidOperationException("GameWindow is already initialized");
            }

            windowContext = windowContext ?? new GameWindowForm("SharpDX.Toolkit.Game");
            Control       = windowContext as Control;
            if (Control == null)
            {
                throw new NotSupportedException("Unsupported window context. Unable to create game window. Only System.Windows.Control subclass are supported");
            }

            //Control.Focus();

            //Control.MouseEnter += GameWindowForm_MouseEnter;
            //Control.MouseLeave += GameWindowForm_MouseLeave;

            gameWindowForm = windowContext as GameWindowForm;
            if (gameWindowForm != null)
            {
                gameWindowForm.Activated  += OnActivated;
                gameWindowForm.Deactivate += OnDeactivated;
                //gameWindowForm.UserResized += OnClientSizeChanged;
            }
            else
            {
                //Control.Resize += OnClientSizeChanged;
            }

            isInitialized = true;
        }