示例#1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ActionBasicApp()
 {
     // Instantiate the user interface object. The UI is given the
     // list of game actions and a reference to the DeviceStates array,
     // which the chart will use to display user input.
     UserInterface = new ActionBasicUI(this, ActionNames, DeviceStates);
     // Make sure the user interface has it's handle created before continuing
     UserInterface.CreateControl();
     UserInterface.Show();
 }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ActionBasicApp()
        {
            // Instantiate the user interface object. The UI is given the
            // list of game actions and a reference to the DeviceStates array,
            // which the chart will use to display user input.
            UserInterface = new ActionBasicUI(this, ActionNames, DeviceStates);
            UserInterface.Show();

            #region Step 3: Enumerate Devices.
            // ************************************************************************
            // Step 3: Enumerate Devices.
            //
            // Enumerate through devices according to the desired action map.
            // Devices are enumerated in a prioritized order, such that devices which
            // can best be mapped to the provided action map are returned first.
            // ************************************************************************
            #endregion

            // Setup the action format for actual gameplay
            DIActionFormat.ActionMapGuid = AppGuid;
            DIActionFormat.Genre         = (int)FightingHandToHand.FightingHandToHand;
            DIActionFormat.AxisMin       = -99;
            DIActionFormat.AxisMax       = 99;
            DIActionFormat.BufferSize    = 16;
            CreateActionMap(DIActionFormat.Actions);

            try
            {
                // Enumerate devices according to the action format
                DeviceList DevList = Manager.GetDevices(DIActionFormat, EnumDevicesBySemanticsFlags.AttachedOnly);
                foreach (SemanticsInstance instance in DevList)
                {
                    SetupDevice(instance.Device);
                }
            }
            catch (DirectXException ex)
            {
                UserInterface.ShowException(ex, "EnumDevicesBySemantics");
            }

            // Start the input loop
            InputThread = new Thread(new ThreadStart(RunInputLoop));
            InputThread.Start();
        }