Exemplo n.º 1
0
        /// <summary>
        /// Creates the individual input devices. I only create a keyboard and mouse
        /// here because they are the most common, but you can override this method
        /// for other modes and devices.
        /// </summary>
        protected virtual void CreateInputDevices()
        {
#if !(XBOX || XBOX360)
            this.Keyboard = this.InputManager.CreateInputObject <SIS.Keyboard>(true, String.Empty);
            this.Mouse    = this.InputManager.CreateInputObject <SIS.Mouse>(true, String.Empty);

            this.Keyboard.EventListener = this;
            this.Mouse.EventListener    = this;
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets up a sample. Used by the SampleContext class. Do not call directly.
        /// </summary>
        /// <param name="window"></param>
        /// <param name="keyboard"></param>
        /// <param name="mouse"></param>
        protected internal virtual void Setup(RenderWindow window, SIS.Keyboard keyboard, SIS.Mouse mouse)
        {
            this.Window   = window;
            this.Keyboard = keyboard;
            this.Mouse    = mouse;

            LocateResources();
            CreateSceneManager();
            SetupView();
            LoadResources();
            this.ResourcesLoaded = true;
            SetupContent();
            this.ContentSetup = true;

            this._done = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Extendeded to setup a default tray interface and camera controller.
        /// </summary>
        /// <param name="window"></param>
        /// <param name="keyboard"></param>
        /// <param name="mouse"></param>
        protected internal override void Setup(RenderWindow window, SIS.Keyboard keyboard, SIS.Mouse mouse)
        {
            Window   = window;
            Keyboard = keyboard;
            Mouse    = mouse;

            LocateResources();
            CreateSceneManager();
            SetupView();

            this.TrayManager = new SdkTrayManager("SampleControls", window, mouse, this as ISdkTrayListener);
            // create a tray interface

            LoadResources();
            ResourcesLoaded = true;

            // Show stats and logo and Hide the cursor
            this.TrayManager.ShowFrameStats(TrayLocation.BottomLeft);
            this.TrayManager.ShowLogo(TrayLocation.BottomRight);
            this.TrayManager.HideCursor();

            // create a params panel for displaying sample details
            var items = new List <string>
            {
                "cam.pX",
                "cam.pY",
                "cam.pZ",
                String.Empty,
                "cam.oW",
                "cam.oX",
                "cam.oY",
                "cam.oZ",
                String.Empty,
                "Filtering",
                "Poly Mode"
            };

            this.DetailsPanel = this.TrayManager.CreateParamsPanel(TrayLocation.None, "DetailsPanel", 180, items);
            this.DetailsPanel.SetParamValue(9, "Bilinear");
            this.DetailsPanel.SetParamValue(10, "Solid");
            this.DetailsPanel.Hide();

            SetupContent();
            ContentSetup = true;

            IsDone = false;
        }
Exemplo 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();
        }
Exemplo n.º 5
0
		/// <summary>
		/// Creates backdrop, cursor, and trays.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="window"></param>
		/// <param name="mouse"></param>
		/// <param name="listener"></param>
		public SdkTrayManager( String name, RenderWindow window, SIS.Mouse mouse, ISdkTrayListener listener )
		{
			this.mName = name;
			this.mWindow = window;
			this.Mouse = mouse;
			Listener = listener;

			this.mWidgetPadding = 8;
			this.mWidgetSpacing = 2;

			OverlayManager om = OverlayManager.Instance;

			String nameBase = this.mName + "/";
			nameBase.Replace( ' ', '_' );

			// create overlay layers for everything

			BackdropLayer = om.Create( nameBase + "BackdropLayer" );
			this.mTraysLayer = om.Create( nameBase + "WidgetsLayer" );
			this.mPriorityLayer = om.Create( nameBase + "PriorityLayer" );
			this.cursorLayer = om.Create( nameBase + "CursorLayer" );
			BackdropLayer.ZOrder = 100;
			this.mTraysLayer.ZOrder = 200;
			this.mPriorityLayer.ZOrder = 300;
			this.cursorLayer.ZOrder = 400;

			// make backdrop and cursor overlay containers

			this.cursor =
				(OverlayElementContainer)om.Elements.CreateElementFromTemplate( "SdkTrays/Cursor", "Panel", nameBase + "Cursor" );
			this.cursorLayer.AddElement( this.cursor );
			this.backdrop = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "Backdrop" );
			BackdropLayer.AddElement( this.backdrop );
			this.mDialogShade = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "DialogShade" );
			this.mDialogShade.MaterialName = "SdkTrays/Shade";
			this.mDialogShade.Hide();
			this.mPriorityLayer.AddElement( this.mDialogShade );

			String[] trayNames = {
			                     	"TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight"
			                     };

			for ( int i = 0; i < 9; i++ ) // make the real trays
			{
				this.mTrays[ i ] =
					(OverlayElementContainer)
					om.Elements.CreateElementFromTemplate( "SdkTrays/Tray", "BorderPanel", nameBase + trayNames[ i ] + "Tray" );

				this.mTraysLayer.AddElement( this.mTrays[ i ] );

				this.trayWidgetAlign[ i ] = HorizontalAlignment.Center;

				// align trays based on location
				if ( i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Center;
				}
				if ( i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Center;
				}
				if ( i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Right;
				}
				if ( i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Bottom;
				}
			}

			// create the null tray for free-floating widgets
			this.mTrays[ 9 ] = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "NullTray" );
			this.trayWidgetAlign[ 9 ] = HorizontalAlignment.Left;
			this.mTraysLayer.AddElement( this.mTrays[ 9 ] );

			for ( int i = 0; i < this.mWidgets.Length; i++ )
			{
				this.mWidgets[ i ] = new WidgetList();
			}

			AdjustTrays();

			ShowTrays();
			ShowCursor();
		}
Exemplo n.º 6
0
		/// <summary>
		/// Creates the individual input devices. I only create a keyboard and mouse
		/// here because they are the most common, but you can override this method
		/// for other modes and devices.
		/// </summary>
		protected virtual void CreateInputDevices()
		{
#if !(XBOX || XBOX360 )
			this.Keyboard = this.InputManager.CreateInputObject<SIS.Keyboard>( true, String.Empty );
			this.Mouse = this.InputManager.CreateInputObject<SIS.Mouse>( true, String.Empty );

			this.Keyboard.EventListener = this;
			this.Mouse.EventListener = this;
#endif
		}