Ejemplo n.º 1
0
        /// <summary>
        /// Sets up SIS input.
        /// </summary>
        protected virtual void SetupInput()
        {
            var pl = new SIS.ParameterList();

            pl.Add(new SIS.Parameter("WINDOW", RenderWindow["WINDOW"]));
#if !(XBOX || XBOX360)
            if (!RenderWindow.GetType().Name.Contains("OpenTK"))
            {
                pl.Add(new SIS.Parameter("w32_mouse", "CLF_BACKGROUND"));
                pl.Add(new SIS.Parameter("w32_mouse", "CLF_NONEXCLUSIVE"));
            }
            else
            {
                pl.Add(new SIS.Parameter("w32_no_coop", string.Empty));
            }
#endif
#if !( WINDOWS_PHONE )
            this.InputManager = SIS.InputManager.CreateInputSystem(pl);
#else
            this.InputManager = SIS.InputManager.CreateInputSystem(typeof(SIS.Xna.XnaInputManagerFactory), pl);
#endif

            CreateInputDevices();             // create the specific input devices

            WindowResized(RenderWindow);      // do an initial adjustment of mouse area
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Destroys SIS input devices and the input manager.
        /// </summary>
        protected virtual void ShutdownInput()
        {
            if (this.InputManager != null)
            {
                this.InputManager.DestroyInputObject(this.Keyboard);
                this.InputManager.DestroyInputObject(this.Mouse);

                this.InputManager = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets up SIS input.
        /// </summary>
        protected virtual void SetupInput(Type factoryType = null)
        {
            var pl = new SIS.ParameterList
            {
                new SIS.Parameter("WINDOW", RenderWindow["WINDOW"])
            };

#if !(XBOX || XBOX360)
            if (!RenderWindow.GetType().Name.Contains("OpenTK"))
            {
                pl.Add(new SIS.Parameter("w32_mouse", "CLF_BACKGROUND"));
                pl.Add(new SIS.Parameter("w32_mouse", "CLF_NONEXCLUSIVE"));
            }
            else
            {
                pl.Add(new SIS.Parameter("w32_no_coop", string.Empty));
            }
#endif
            if (factoryType != null && factoryType.IsAssignableFrom(typeof(SIS.IInputManagerFactory)))
            {
                this.InputManager = SIS.InputManager.CreateInputSystem(factoryType, pl);
            }
            else
            {
                switch (this.Root.RenderSystem.Name)
                {
                case "DirectX9":
                default:
                    this.InputManager = SIS.InputManager.CreateInputSystem(typeof(SIS.DirectX.DirectXInputManagerFactory), pl);
                    break;
                }
            }

            CreateInputDevices();        // create the specific input devices

            WindowResized(RenderWindow); // do an initial adjustment of mouse area
        }
Ejemplo n.º 4
0
        public override void Initialize()
        {
            ParameterList args = new ParameterList();

            args.Add(new Parameter("WINDOW", this.Game.Window.Handle));
#if !( WINDOWS_PHONE )
            args.Add(new Parameter("w32_mouse_hide", true));
#endif
            _inputManager = SIS.InputManager.CreateInputSystem(typeof(SIS.Xna.XnaInputManagerFactory), args);

            //log.Info( String.Format( "SIS Version : {0}", _inputManager.Version ) );
            //log.Info( String.Format( "Platform : {0}", _inputManager.InputSystemName ) );
            //log.Info( String.Format( "Number of Mice : {0}", _inputManager.DeviceCount<SIS.Mouse>() ) );
            //log.Info( String.Format( "Number of Keyboards : {0}", _inputManager.DeviceCount<SIS.Keyboard>() ) );
            //log.Info( String.Format( "Number of GamePads: {0}", _inputManager.DeviceCount<SIS.Joystick>() ) );

            bool buffered = false;

            if (_inputManager.DeviceCount <SIS.Keyboard>() > 0)
            {
                _kb = _inputManager.CreateInputObject <SIS.Keyboard>(buffered, "");
                //log.Info( String.Format( "Created {0}buffered keyboard", buffered ? "" : "un" ) );
            }
            else
            {
                _kb = new NullKeyboard();
            }

            if (_inputManager.DeviceCount <SIS.Mouse>() > 0)
            {
                _m = _inputManager.CreateInputObject <SIS.Mouse>(buffered, "");
                //log.Info( String.Format( "Created {0}buffered mouse", buffered ? "" : "un" ) );
                ////_m.EventListener = _handler;

                //MouseState ms = _m.MouseState;
                //ms.Width = 100;
                //ms.Height = 100;
            }
            else
            {
                _m = new NullMouse();
            }

            ////This demo only uses at max 4 joys
            int numSticks = _inputManager.DeviceCount <SIS.Joystick>();
            if (numSticks > 4)
            {
                numSticks = 4;
            }

            for (int i = 0; i < numSticks; ++i)
            {
                _joys.Insert(i, _inputManager.CreateInputObject <SIS.Joystick>(true, ""));
                //_joys[ i ].EventListener = _handler;

                _ff.Insert(i, (SIS.ForceFeedback)_joys[i].QueryInterface <SIS.ForceFeedback>());
                if (_ff[i] != null)
                {
                    //log.Info( String.Format( "Created buffered joystick with ForceFeedback support." ) );
                    //Dump out all the supported effects:
                    //        const ForceFeedback::SupportedEffectList &list = g_ff[i]->getSupportedEffects();
                    //        ForceFeedback::SupportedEffectList::const_iterator i = list.begin(),
                    //            e = list.end();
                    //        for( ; i != e; ++i)
                    //            std::cout << "Force =  " << i->first << " Type = " << i->second << std::endl;
                }
                //else
                //log.Info( String.Format( "Created buffered joystick. **without** FF support" ) );
            }
            base.Initialize();
        }
Ejemplo n.º 5
0
		/// <summary>
		/// Destroys SIS input devices and the input manager.
		/// </summary>
		protected virtual void ShutdownInput()
		{
			if ( this.InputManager != null )
			{
				this.InputManager.DestroyInputObject( this.Keyboard );
				this.InputManager.DestroyInputObject( this.Mouse );

				this.InputManager = null;
			}
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Sets up SIS input.
		/// </summary>
		protected virtual void SetupInput()
		{
			var pl = new SIS.ParameterList();
			pl.Add( new SIS.Parameter( "WINDOW", RenderWindow[ "WINDOW" ] ) );
#if !(XBOX || XBOX360 )
			if ( !RenderWindow.GetType().Name.Contains( "OpenTK" ) )
			{
				pl.Add( new SIS.Parameter( "w32_mouse", "CLF_BACKGROUND" ) );
				pl.Add( new SIS.Parameter( "w32_mouse", "CLF_NONEXCLUSIVE" ) );
			}
			else
				pl.Add( new SIS.Parameter( "w32_no_coop", string.Empty )  );
#endif
#if !( WINDOWS_PHONE )
			this.InputManager = SIS.InputManager.CreateInputSystem( pl );
#else
			this.InputManager = SIS.InputManager.CreateInputSystem( typeof(SIS.Xna.XnaInputManagerFactory), pl );
#endif

			CreateInputDevices(); // create the specific input devices

			WindowResized( RenderWindow ); // do an initial adjustment of mouse area
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Sets up SIS input.
		/// </summary>
		protected virtual void SetupInput()
		{
			SIS.ParameterList pl = new SIS.ParameterList();
			pl.Add( new SIS.Parameter( "WINDOW", RenderWindow[ "WINDOW" ] ) );
#if !(XBOX || XBOX360 )
			pl.Add( new SIS.Parameter( "w32_mouse", "CLF_BACKGROUND" ) );
			pl.Add( new SIS.Parameter( "w32_mouse", "CLF_NONEXCLUSIVE" ) );
#endif
			this.InputManager = SIS.InputManager.CreateInputSystem( pl );

			CreateInputDevices();      // create the specific input devices

			this.WindowResized( RenderWindow );    // do an initial adjustment of mouse area
		}