public override void Initialize() { try { font = resources.contentManager.Load <SpriteFont>("Fonts/Courier New"); } catch (Exception e) { throw new System.ArgumentException("GUIComponent requires 'Courier New.spritefont' in [Game]Content's 'Fonts' directory!", "GUIComponent"); } //Load the textures used by the GUI guiTextures = resources.getTextureSet(Path.Combine("000_GUI")); //Set up the inputs used by the GUI. this[StaticBindings.CLICK] = new SinglePressBinding(tileEngine.inputComponent, null, null, InputComponent.MouseButton.LEFT); (this[StaticBindings.CLICK] as SinglePressBinding).downEvent += onClick; (this[StaticBindings.CLICK] as SinglePressBinding).upEvent += releaseClick; this[StaticBindings.RIGHTCLICK] = new SinglePressBinding(tileEngine.inputComponent, null, null, InputComponent.MouseButton.RIGHT); (this[StaticBindings.RIGHTCLICK] as SinglePressBinding).downEvent += onRightClick; (this[StaticBindings.RIGHTCLICK] as SinglePressBinding).upEvent += releaseRightClick; this[StaticBindings.KEYPRESS] = new TextBinding(tileEngine.inputComponent); (this[StaticBindings.KEYPRESS] as TextBinding).charEntered += onKeypress; }
/** * desc here * * @param paramsdeschere * * @return returndeschere */ public override void Initialize() { font = resources.contentManager.Load <SpriteFont>("Fonts/Courier New"); //Load the textures used by the GUI engineTextures = resources.getTextureSet(Path.Combine("000_GUI"));//This is now correct //Set up the inputs used by the GUI. this[StaticBindings.CLICK] = new SinglePressBinding(engine.inputComponent, null, null, InputComponent.MouseButton.LEFT); (this[StaticBindings.CLICK] as SinglePressBinding).downEvent += onClick; (this[StaticBindings.CLICK] as SinglePressBinding).upEvent += releaseClick; this[StaticBindings.RIGHTCLICK] = new SinglePressBinding(engine.inputComponent, null, null, InputComponent.MouseButton.RIGHT); (this[StaticBindings.RIGHTCLICK] as SinglePressBinding).downEvent += onRightClick; (this[StaticBindings.RIGHTCLICK] as SinglePressBinding).upEvent += releaseRightClick; this[StaticBindings.KEYPRESS] = new TextBinding(engine.inputComponent); (this[StaticBindings.KEYPRESS] as TextBinding).charEntered += onKeypress; }