//////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the Manager class. /// </summary> /// <param name="game"> /// The Game class. /// </param> /// <param name="graphics"> /// The GraphicsDeviceManager class provided by the Game class. /// </param> /// <param name="skin"> /// The name of the skin being loaded at the start. /// </param> public Manager(Game game, GraphicsDeviceManager graphics, string skin) : base(game) { disposing = false; //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleUnhadledExceptions); content = new ArchiveManager(Game.Services); input = new InputSystem(this, new InputOffset(0, 0, 1f, 1f)); components = new List<Component>(); controls = new ControlsList(); orderList = new ControlsList(); this.graphics = graphics; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(PrepareGraphicsDevice); skinName = skin; #if (XBOX_FAKE) game.Window.Title += " (XBOX_FAKE)"; #endif states.Buttons = new Control[32]; states.Click = -1; states.Over = null; input.MouseDown += new MouseEventHandler(MouseDownProcess); input.MouseUp += new MouseEventHandler(MouseUpProcess); input.MousePress += new MouseEventHandler(MousePressProcess); input.MouseMove += new MouseEventHandler(MouseMoveProcess); input.MouseScroll += new MouseEventHandler(MouseScrollProcess); input.GamePadDown += new GamePadEventHandler(GamePadDownProcess); input.GamePadUp += new GamePadEventHandler(GamePadUpProcess); input.GamePadPress += new GamePadEventHandler(GamePadPressProcess); input.KeyDown += new KeyEventHandler(KeyDownProcess); input.KeyUp += new KeyEventHandler(KeyUpProcess); input.KeyPress += new KeyEventHandler(KeyPressProcess); keyboardLayouts.Add(new KeyboardLayout()); keyboardLayouts.Add(new CzechKeyboardLayout()); keyboardLayouts.Add(new GermanKeyboardLayout()); }
//////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { if (disposing) { this.disposing = true; // Recursively disposing all controls added to the manager and its child controls. if (controls != null) { int c = controls.Count; for (int i = 0; i < c; i++) { if (controls.Count > 0) controls[0].Dispose(); } } // Disposing all components added to manager. if (components != null) { int c = components.Count; for (int i = 0; i < c; i++) { if (components.Count > 0) components[0].Dispose(); } } if (content != null) { content.Unload(); content.Dispose(); content = null; } if (renderer != null) { renderer.Dispose(); renderer = null; } if (input != null) { input.Dispose(); input = null; } } if (GraphicsDevice != null) GraphicsDevice.DeviceReset -= new System.EventHandler<System.EventArgs>(GraphicsDevice_DeviceReset); base.Dispose(disposing); }
//////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the Manager class. /// </summary> /// <param name="game">The Game class.</param> /// <param name="graphics">The GraphicsDeviceManager class provided by the Game class.</param> /// <param name="skin">The name of the skin being loaded at the start.</param> public Manager(Game game, GraphicsDeviceManager graphics, string skin) { disposing = false; #endif #if (!XBOX && !XBOX_FAKE) menuDelay = SystemInformation.MenuShowDelay; doubleClickTime = SystemInformation.DoubleClickTime; #endif #if (!XBOX && !XBOX_FAKE) this.window = window; window.FormClosing += new FormClosingEventHandler(Window_FormClosing); #endif this.Game = game; content = new ContentManager(Game.Services); input = new InputSystem(this, new InputOffset(0, 0, 1f, 1f)); components = new List<Component>(); controls = new ControlsList(); orderList = new ControlsList(); this.graphics = graphics; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(PrepareGraphicsDevice); skinName = skin; #if (XBOX_FAKE) game.Window.Title += " (XBOX_FAKE)"; #endif states.Buttons = new Control[32]; states.Click = -1; states.Over = null; input.MouseDown += new MouseEventHandler(MouseDownProcess); input.MouseUp += new MouseEventHandler(MouseUpProcess); input.MousePress += new MouseEventHandler(MousePressProcess); input.MouseMove += new MouseEventHandler(MouseMoveProcess); input.GamePadDown += new GamePadEventHandler(GamePadDownProcess); input.GamePadUp += new GamePadEventHandler(GamePadUpProcess); input.GamePadPress += new GamePadEventHandler(GamePadPressProcess); input.KeyDown += new KeyEventHandler(KeyDownProcess); input.KeyUp += new KeyEventHandler(KeyUpProcess); input.KeyPress += new KeyEventHandler(KeyPressProcess); keyboardLayouts.Add(new KeyboardLayout()); keyboardLayouts.Add(new CzechKeyboardLayout()); keyboardLayouts.Add(new GermanKeyboardLayout()); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Destructors /////// //////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { if (disposing) { this.disposing = true; // Recursively disposing all controls added to the manager and its child controls. if (controls != null) { int c = controls.Count; for (int i = 0; i < c; i++) { if (controls.Count > 0) controls[0].Dispose(); } } // Disposing all components added to manager. if (components != null) { int c = components.Count; for (int i = 0; i < c; i++) { if (components.Count > 0) components[0].Dispose(); } } if (content != null) { content.Unload(); content.Dispose(); content = null; } if (renderer != null) { renderer.Dispose(); renderer = null; } if (input != null) { input.Dispose(); input = null; } } base.Dispose(disposing); }
/// <summary> /// Initializes a new instance of the Manager class. /// </summary> /// <param name="game"> /// The Game class. /// </param> /// <param name="graphics"> /// The GraphicsDeviceManager class provided by the Game class. /// </param> /// <param name="skin"> /// The name of the skin being loaded at the start. /// </param> public Manager(Game game, GraphicsDeviceManager graphics, string skin) : base(game) { disposing = false; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleUnhadledExceptions); #if (!XBOX && !XBOX_FAKE) menuDelay = SystemInformation.MenuShowDelay; doubleClickTime = SystemInformation.DoubleClickTime; #endif #if (!XBOX && !XBOX_FAKE) window = (Form)Form.FromHandle(Game.Window.Handle); window.FormClosing += new FormClosingEventHandler(Window_FormClosing); #endif content = new ArchiveManager(Game.Services); input = new InputSystem(this, new InputOffset(0, 0, 1f, 1f)); components = new List<Component>(); controls = new ControlsList(); orderList = new ControlsList(); this.graphics = graphics; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(PrepareGraphicsDevice); skinName = skin; #if (XBOX_FAKE) game.Window.Title += " (XBOX_FAKE)"; #endif states.Buttons = new Control[32]; states.Click = -1; states.Over = null; // Hook up the input system mouse events. input.MouseDown += new MouseEventHandler(MouseDownProcess); input.MouseUp += new MouseEventHandler(MouseUpProcess); input.MousePress += new MouseEventHandler(MousePressProcess); input.MouseMove += new MouseEventHandler(MouseMoveProcess); input.MouseScroll += new MouseEventHandler(MouseScrollProcess); // Hook up the input system gamepad events. input.GamePadDown += new GamePadEventHandler(GamePadDownProcess); input.GamePadUp += new GamePadEventHandler(GamePadUpProcess); input.GamePadPress += new GamePadEventHandler(GamePadPressProcess); // Hook up the input system key events. input.KeyDown += new KeyEventHandler(KeyDownProcess); input.KeyUp += new KeyEventHandler(KeyUpProcess); input.KeyPress += new KeyEventHandler(KeyPressProcess); // Create the English (US), Czech, and German keyboard layouts. keyboardLayouts.Add(new KeyboardLayout()); keyboardLayouts.Add(new CzechKeyboardLayout()); keyboardLayouts.Add(new GermanKeyboardLayout()); }