Ejemplo n.º 1
0
 void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_form != null)
         {
             UnregisterFromAllWindows(); 
             _form.Dispose();
             _form = null;
         }
     }
     _platform = null;
     Game = null;
     Mouse.SetWindows(null);
     Device.KeyboardInput -= OnRawKeyEvent;
     Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, DeviceFlags.Remove);
 }
Ejemplo n.º 2
0
 void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_form != null)
         {
             UnregisterFromAllWindows(); 
             _form.Dispose();
             _form = null;
         }
     }
 }
Ejemplo n.º 3
0
        internal WinFormsGameWindow(WinFormsGamePlatform platform)
        {
            _platform = platform;
            Game = platform.Game;

            _form = new WinFormsGameForm(this);
            
            // When running unit tests this can return null.
            var assembly = Assembly.GetEntryAssembly();
            if (assembly != null)
                _form.Icon = Icon.ExtractAssociatedIcon(assembly.Location);
            Title = Utilities.AssemblyHelper.GetDefaultWindowTitle();

            _form.MaximizeBox = false;
            _form.FormBorderStyle = FormBorderStyle.FixedSingle;
            _form.StartPosition = FormStartPosition.CenterScreen;           

            // Capture mouse events.
            _form.MouseWheel += OnMouseScroll;
            _form.MouseEnter += OnMouseEnter;
            _form.MouseLeave += OnMouseLeave;            

            // Use RawInput to capture key events.
            Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, DeviceFlags.None);
            Device.KeyboardInput += OnRawKeyEvent;

            _form.Activated += OnActivated;
            _form.Deactivate += OnDeactivate;
            _form.ClientSizeChanged += OnClientSizeChanged;

            _form.KeyPress += OnKeyPress;

            RegisterToAllWindows();
        }
Ejemplo n.º 4
0
 public void Dispose()
 {
     if (_form != null)
     {
         _form.Dispose();
         _form = null;
     }
 }