public static IFormatInfo FormatInfo(SharpDX.DXGI.Format dxgiFormat) { int numColors; int colorBits; FormatElementType colorFormatType; int alphaBits; FormatElementType alphaFormatType; int totalBits; ColorAlphaFormatFlags flags; Utility.Helpers.FormatHelper.GetExplicitColorAlphaFormatInfo((ExplicitFormat)dxgiFormat, out numColors, out colorBits, out colorFormatType, out alphaBits, out alphaFormatType, out totalBits, out flags); return new FormatInfo { ID = (int)dxgiFormat, Description = dxgiFormat.ToString(), ExplicitFormat = (ExplicitFormat)dxgiFormat, NumColors = numColors, ColorBits = colorBits, ColorFormatType = colorFormatType, AlphaBits = alphaBits, AlphaFormatType = alphaFormatType, TotalBits = totalBits, Flags = flags }; }
/// <summary> /// ctor and init /// </summary> /// <param name="device">A DXInput device</param> /// <param name="hwnd">The WinHandle of the main window</param> /// <param name="panel">The respective JS panel to show the properties</param> public GamepadCls( SharpDX.XInput.Controller device, UC_GpadPanel panel, int tabIndex ) { log.DebugFormat( "GamepadCls ctor - Entry with index {0}", device.ToString( ) ); m_device = device; m_gPanel = panel; MyTabPageIndex = tabIndex; Activated = false; m_senseLimit = AppConfiguration.AppConfig.gpSenseLimit; // can be changed in the app.config file if it is still too little // Set BufferSize in order to use buffered data. log.Debug( "Get GP Objects" ); try { m_gpCaps = m_device.GetCapabilities( DeviceQueryType.Gamepad ); } catch ( Exception ex ) { log.Error( "Get GamepadCapabilities failed", ex ); } m_gPanel.Caption = DevName; int n = 0; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadDown ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadLeft ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadRight ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadUp ) ) n++; m_gPanel.nDPads = n.ToString( ); m_gPanel.DPadE = ( n > 0 ); n = 0; if ( ( m_gpCaps.Gamepad.LeftThumbX != 0 ) || ( m_gpCaps.Gamepad.LeftThumbY != 0 ) || Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.LeftThumb ) ) { n++; m_gPanel.TStickLE = true; } if ( ( m_gpCaps.Gamepad.RightThumbX != 0 ) || ( m_gpCaps.Gamepad.RightThumbY != 0 ) || Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.RightThumb ) ) { n++; m_gPanel.TStickRE = true; } m_gPanel.nTSticks = n.ToString( ); n = 0; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.A ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.B ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.X ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.Y ) ) n++; if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.Start ) ) { n++; m_gPanel.StartE = true; } if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.Back ) ) { n++; m_gPanel.BackE = true; } if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.LeftShoulder ) ) { n++; m_gPanel.ShoulderLE = true; } if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.RightShoulder ) ) { n++; m_gPanel.ShoulderRE = true; } m_gPanel.nButtons = n.ToString( ); n = 0; if ( m_gpCaps.Gamepad.LeftTrigger > 0 ) { n++; m_gPanel.TriggerLE = true; } if ( m_gpCaps.Gamepad.RightTrigger > 0 ) { n++; m_gPanel.TriggerRE = true; } m_gPanel.nTriggers = n.ToString( ); m_gPanel.ButtonE = true; // what else ... ApplySettings( ); // get whatever is needed here from Settings Activated = true; }
/// <summary> /// Returns a standard Media foundation GUID format from a FourCC input /// </summary> /// <param name="fourCC">FourCC input</param> /// <returns>Media foundation unique ID</returns> public static Guid FromFourCC(SharpDX.Multimedia.FourCC fourCC) { return new Guid(string.Concat(fourCC.ToString(), "-0000-0010-8000-00aa00389b71")); }