OpenGL rebuild project start!

This commit is contained in:
Nitload
2023-04-29 03:06:32 +08:00
parent 7dba067146
commit 4dd3f4f6d1
263 changed files with 51374 additions and 1522 deletions
@@ -0,0 +1,15 @@
namespace StgSharp.Graphic.Input
{
public enum HidConsumerUsage : ushort
{
/// <summary>
/// General consumer control device.
/// </summary>
ConsumerControl = 0x01,
/// <summary>
/// Set the horizontal offset of the display in the document.
/// </summary>
ACPan = 0x0238,
}
}
@@ -0,0 +1,258 @@
namespace StgSharp.Graphic.Input
{
public enum HidGenericDesktopUsage : ushort
{
/// <summary>
/// A collection of axes that generates a value to direct, indicate, or point
/// user intentions to an application.
/// </summary>
Pointer = 0x01,
/// <summary>
/// A hand-held, button-activated input device that when rolled along a flat surface,
/// directs an indicator to move correspondingly about a computer screen, allowing the
/// operator to move the indicator freely in select operations or to manipulate text or graphics.
/// </summary>
Mouse = 0x02,
// 0x03 // Reserved
/// <summary>
/// A manual control or cursor device.
/// </summary>
Joystick = 0x04,
/// <summary>
/// A manual control or cursor device.
/// </summary>
GamePad = 0x05,
/// <summary>
/// The primary computer input device.
/// </summary>
Keyboard = 0x06,
/// <summary>
/// Any keyboard configuration that does not meet the minimum requirements of the Boot Keyboard.
/// </summary>
Keypad = 0x07,
/// <summary>
/// An input device used to orient eyepoints and or objects in 3 dimensional space.
/// </summary>
MultiAxisController = 0x08,
// 0x09 - 0x2F // Reserved
/// <summary>
/// A linear translation in the X direction.
/// </summary>
X = 0x30,
/// <summary>
/// A linear translation in the Y direction.
/// </summary>
Y = 0x31,
/// <summary>
/// A linear translation in the Z direction.
/// </summary>
Z = 0x32,
/// <summary>
/// A rotation about the X axis. Angular position report values follow the righthand rule.
/// </summary>
RotationX = 0x33,
/// <summary>
/// A rotation about the Y axis. Angular position report values follow the righthand rule.
/// </summary>
RotationY = 0x34,
/// <summary>
/// A rotation about the Z axis. Angular position report values follow the righthand rule.
/// </summary>
RotationZ = 0x35,
/// <summary>
/// A linear control for generating a variable value, normally in the form of a thumb slide in a slot.
/// </summary>
Slider = 0x36,
/// <summary>
/// A rotary control for generating a variable value,
/// normally in the form of a knob spun by the index finger and thumb.
/// </summary>
Dial = 0x37,
/// <summary>
/// A rotary control for generating a variable value, normally rolled, unlike a dial.
/// </summary>
Wheel = 0x38,
/// <summary>
/// A specialized mechanical configuration of switches generating a variable value with a null state.
/// </summary>
Hatswitch = 0x39,
/// <summary>
/// Used with buffered –byte data to indicate the number of valid bytes in the buffered-byte field.
/// </summary>
CountedBuffer = 0x3A,
/// <summary>
/// Defines a report field that indicates the number of meaningful data bytes
/// in an associated buffered-byte field.
/// </summary>
ByteCount = 0x3B,
/// <summary>
/// Enables the generation of a USB remote wakeup when the device detects motion.
/// </summary>
MotionWakeup = 0x3C,
/// <summary>
/// Session start button.
/// </summary>
Start = 0x3D,
/// <summary>
/// Application option select button.
/// </summary>
Select = 0x3E,
// 0x3F // Reserved
/// <summary>
/// A vector in the X direction.
/// </summary>
VectorX = 0x40,
/// <summary>
/// A vector in the Y direction.
/// </summary>
VectorY = 0x41,
/// <summary>
/// A vector in the Z direction.
/// </summary>
VectorZ = 0x42,
/// <summary>
/// A vector in the X direction relative to the body of an object.
/// </summary>
VectorXBodyRelative = 0x43,
/// <summary>
/// A vector in the Y direction relative to the body of an object.
/// </summary>
VectorYBodyRelative = 0x44,
/// <summary>
/// A vector in the Z direction relative to the body of an object.
/// </summary>
VectorZBodyRelative = 0x45,
/// <summary>
/// A non oriented vector or value.
/// </summary>
VectorNonOriented = 0x46,
// 0x47 - 0x7F // Reserved
/// <summary>
/// An application-level collection that contains system-software-specific usages.
/// </summary>
SystemControl = 0x80,
/// <summary>
/// Asserted when the intended action is to initiate system-wide power down now from
/// Full Power or Sleep states.
/// </summary>
SystemPowerDown = 0x81,
/// <summary>
/// Asserted when the intended action is to initiate system-wide low power mode now.
/// </summary>
SystemSleep = 0x82,
/// <summary>
/// Asserted when the intended action is to initiate system-wide Full Power state now.
/// </summary>
SystemWakeUp = 0x83,
/// <summary>
/// Evokes a context-sensitive menu.
/// </summary>
SystemContextMenu = 0x84,
/// <summary>
/// Evokes the OS main-level selection menu.
/// </summary>
SystemMainMenu = 0x85,
/// <summary>
/// Displays an application-specific menu.
/// </summary>
SystemAppMenu = 0x86,
/// <summary>
/// Displays the help menu.
/// </summary>
SystemMenuHelp = 0x87,
/// <summary>
/// Exits a menu.
/// </summary>
SystemMenuExit = 0x88,
/// <summary>
/// Selects a menu item.
/// </summary>
SystemMenuSelect = 0x89,
/// <summary>
/// Menu select right.
/// </summary>
SystemMenuRight = 0x8A,
/// <summary>
/// Menu select left.
/// </summary>
SystemMenuLeft = 0x8B,
/// <summary>
/// Menu select up.
/// </summary>
SystemMenuUp = 0x8C,
/// <summary>
/// Menu select down.
/// </summary>
SystemMenuDown = 0x8D,
// 0x8E - 0x8F // Reserved
/// <summary>
/// Indicates that top of a Direction Pad is pressed.
/// </summary>
DPadUp = 0x90,
/// <summary>
/// Indicates that bottom of a Direction Pad is pressed
/// </summary>
DPadDown = 0x91,
/// <summary>
/// Indicates that right side of a Direction Pad is pressed
/// </summary>
DPadRight = 0x92,
/// <summary>
/// Indicates that left side of a Direction Pad is pressed
/// </summary>
DPadLeft = 0x93,
// 0x94 - 0xFFFF // Reserved
}
}
@@ -0,0 +1,57 @@
using System.Diagnostics;
namespace StgSharp.Graphic.Input
{
public static class HidHelper
{
/// <summary>
/// Translates a generic HID usage value to a specific joystick axis for the specified <see cref="HidPage"/>.
/// </summary>
/// <param name="page">The HID usage page.</param>
/// <param name="usage">The generic usage value.</param>
/// <returns>An <see cref="int"/> that maps the HID usage value to a joystick axis.</returns>
public static int TranslateJoystickAxis(HidPage page, int usage)
{
switch (page)
{
case HidPage.GenericDesktop:
switch ((HidGenericDesktopUsage)usage)
{
case HidGenericDesktopUsage.X:
return 0;
case HidGenericDesktopUsage.Y:
return 1;
case HidGenericDesktopUsage.Z:
return 2;
case HidGenericDesktopUsage.RotationZ:
return 3;
case HidGenericDesktopUsage.RotationX:
return 4;
case HidGenericDesktopUsage.RotationY:
return 5;
case HidGenericDesktopUsage.Slider:
return 6;
case HidGenericDesktopUsage.Dial:
return 7;
case HidGenericDesktopUsage.Wheel:
return 8;
}
break;
case HidPage.Simulation:
switch ((HidSimulationUsage)usage)
{
case HidSimulationUsage.Rudder:
return 9;
case HidSimulationUsage.Throttle:
return 10;
}
break;
}
Debug.Print($"[Input] Unknown axis with HID page/usage {page}/{usage}");
return 0;
}
}
}
+170
View File
@@ -0,0 +1,170 @@
namespace StgSharp.Graphic.Input
{
public enum HidPage : ushort
{
/// <summary>
/// This page describes an undefined usage.
/// </summary>
Undefined = 0x00,
/// <summary>
/// This page describes generic desktop controls.
/// </summary>
GenericDesktop = 0x01,
/// <summary>
/// This page provides detailed descriptions of the usages employed by simulation devices.
/// </summary>
Simulation = 0x02,
/// <summary>
/// Describes virtual reality controls. The usages depend on designators to identify the individual controls.
/// </summary>
VR = 0x03,
/// <summary>
/// This page describes sport controls.
/// </summary>
Sport = 0x04,
/// <summary>
/// This page describes game controls.
/// </summary>
Game = 0x05,
/// <summary>
/// This page provides usage definitions for controls that can be on any type of device.
/// </summary>
GenericDevice = 0x06,
/// <summary>
/// This page is for key codes to be used in implementing a USB keyboard.
/// </summary>
/// <remarks>
/// The usage type of all key codes is Selectors (Sel), except for the modifier keys 'Keyboard Left Control'
/// (0x224) to 'Keyboard Right GUI' (0x231) which are Dynamic Flags (DV).
/// </remarks>
KeyboardOrKeypad = 0x07,
/// <summary>
/// This page describes an LED or indicator that is implemented as an On/Off control (OOC)
/// using the "Single button toggle" mode,
/// where a value of 1 will turn on the indicator, and a value of 0 will turn it off.
/// </summary>
LEDs = 0x08,
/// <summary>
/// This page describes a set of buttons which can be defined as Sel, OOC, MC or OSC depending on
/// the context of their declaration.
/// </summary>
Button = 0x09,
/// <summary>
/// This page allows multiple instances of a control or sets of controls to be declared without
/// requiring indiviual enumeration in the native usage page.
/// </summary>
Ordinal = 0x0A,
/// <summary>
/// This page defines the keytop and control usages for telephony devices.
/// </summary>
/// <remarks>
/// Note that in many cases usage definitions are intentionally vague, since it is assumed that
/// the controls are interpreted by the telephone software application.
/// </remarks>
Telephony = 0x0B,
/// <summary>
/// This page describes application-specific controls.
/// They only affect a specific device, not the system as a whole.
/// </summary>
Consumer = 0x0C,
/// <summary>
/// This section provides detailed descriptions of the usages employed by Digitizer Devices.
/// </summary>
Digitizer = 0x0D,
// 0x0E // Reserved
/// <summary>
/// Describes force feedback and related devices.
/// </summary>
PID = 0x0F,
/// <summary>
/// The Unicode page directly maps to the two-octet form defined in the Unicode Standard.
/// </summary>
Unicode = 0x10,
// 0x11 - 0x13 // Reserved
/// <summary>
/// The Alphanumeric display page is intended for use by simple alphanumeric
/// displays that are used on consumer devices.
/// </summary>
AlphanumericDisplay = 0x14,
// 0x15 - 0x3F // Reserved
/// <summary>
/// This page provides usage definitions for medical instruments.
/// </summary>
MedicalInstruments = 0x40,
// 0x41 - 0x7F
// 0x80 - 0x83 // USB Device Class Definition for Monitor Devices
/// <summary>
/// Power device page.
/// </summary>
PowerDevice = 0x84,
/// <summary>
/// Battery system page.
/// </summary>
BatterySystem = 0x85,
// 0x86 - 0x87 // USB Device Class Definition for Power Devices (also includes 0x84 and 0x85)
// 0x88 - 0x8B // Reserved
/// <summary>
/// This page describes the USB Device Class definition for a bar code scanner ("Point of Sale" device).
/// </summary>
BarCodeScanner = 0x8C,
/// <summary>
/// This page describes the USB Device Class definition for a scale ("Point of Sale" device).
/// </summary>
Scale = 0x8D,
/// <summary>
/// This page describes the USB Device Class definition for a magnetic stripe reading device
/// ("Point of Sale" device).
/// </summary>
MagneticStripeReader = 0x8E,
// 0x8F // Reserved Point of Sale pages
/// <summary>
/// This page describes the USB Device Class definition for "Image Class Devices".
/// </summary>
CameraControl = 0x90,
/// <summary>
/// This page describes the OAAF definitions for arcade and coinop related devices.
/// </summary>
Arcade = 0x91,
// 0x92 - 0xFEFF // Reserved
/// <summary>
/// Marks the beginning of vendor-defined usage pages.
/// </summary>
VendorDefinedStart = 0xFF00,
// 0xFF00 - 0xFFFF // Vendor-defined
}
}
@@ -0,0 +1,288 @@
using StgSharp.Graphic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic.Input
{
public enum HidSimulationUsage : ushort
{
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found on an airplane.
/// </summary>
FlightSimulationDevice = 0x01,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found in an automobile or truck.
/// </summary>
AutomobileSimulationDevice = 0x02,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found in a tank or a treaded vehicle.
/// </summary>
TankSimulationDevice = 0x03,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a spaceship.
/// </summary>
SpaceshipSimulationDevice = 0x04,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a submarine.
/// </summary>
SubmarineSimulationDevice = 0x05,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a sailboat.
/// </summary>
SailingSimulationDevice = 0x06,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a motorcycle.
/// </summary>
MotorcycleSimulationDevice = 0x07,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a sports simulation device.
/// </summary>
SportsSimulationDevice = 0x08,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on an airplane.
/// </summary>
AirplaneSimulationDevice = 0x09,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a helicopter.
/// </summary>
HelicopterSimulationDevice = 0x0A,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard control of a magic carpet.
/// </summary>
MagicCarpetSimulationDevice = 0x0B,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a bicycle.
/// </summary>
BicycleSimulationDevice = 0x0C,
// 0x0D - 0x1F // Reserved
/// <summary>
/// A Flight Control Stick controls the Pitch and Roll of an airplane.
/// </summary>
FlightControlStick = 0x20,
/// <summary>
/// A Flight Stick defines a class of device commonly used for flight simulator games.
/// </summary>
FlightStick = 0x21,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// A cyclic control is a stick between the pilot’s legs that moves in two axes.
/// </summary>
CyclicControl = 0x22,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// Cyclic Trim allows fine adjustment of the cyclic position in two dimensions.
/// </summary>
CyclicTrim = 0x23,
/// <summary>
/// A flight yoke (also called a control wheel) controls the pitch and roll of an airplane.
/// </summary>
FlightYoke = 0x24,
/// <summary>
/// A device for controlling the direction and velocity of a vehicle that is driven by tracks.
/// </summary>
TrackControl = 0x25,
// 0x26 - 0xAF // Reserved
/// <summary>
/// An aileron is one of two movable flaps on the wings of an airplane that can be used
/// to control the plane’s rolling and banking movements.
/// </summary>
Aileron = 0xB0,
/// <summary>
/// Allows fine adjustment of the Aileron position.
/// </summary>
AileronTrim = 0xB1,
/// <summary>
/// This control mechanically behaves the same as rudder pedals.
/// </summary>
AntiTorqueControl = 0xB2,
/// <summary>
/// This control enables or disables an airplane’s autopilot.
/// </summary>
AutopilotEnable = 0xB3,
/// <summary>
/// Chaff is used to reflect electromagnetic energy as a radar countermeasure.
/// </summary>
ChaffRelease = 0xB4,
/// <summary>
/// This control is specifically for a helicopter.
/// It controls the vertical acceleration or lift of the helicopter.
/// </summary>
CollectiveControl = 0xB5,
/// <summary>
/// A flap that can be extended on an aircraft to increase drag and reduce the speed of descent.
/// </summary>
DiveBrake = 0xB6,
/// <summary>
/// A pushbutton that enables electronic countermeasures.
/// </summary>
ElectronicCountermeasures = 0xB7,
/// <summary>
/// A movable control surface, usually attached to the horizontal stabilizer of an aircraft,
/// that is used to produce motion up or down.
/// </summary>
Elevator = 0xB8,
/// <summary>
/// Elevator Trim allows fine adjustment of the Elevator position.
/// </summary>
ElevatorTrim = 0xB9,
/// <summary>
/// The zero position is centered, positive values turn right, and negative values turn left.
/// </summary>
Rudder = 0xBA,
/// <summary>
/// A valve that regulates the flow of a fluid, such as the valve in an internal-combustion engine
/// that controls the amount of vaporized fuel entering the cylinders.
/// </summary>
Throttle = 0xBB,
/// <summary>
/// Typically this is a two-position pushbutton where the first position enables communications with the
/// crew and the second position enables the transmitter for communication external to the plane.
/// </summary>
FlightCommunications = 0xBC,
/// <summary>
/// A flare is a device that produces a bright light for signaling, illumination, identification,
/// or heat for infrared missile countermeasures.
/// </summary>
FlareRelease = 0xBD,
/// <summary>
/// A control for raising or lowering an airplane’s landing gear.
/// </summary>
LandingGear = 0xBE,
/// <summary>
/// A device for slowing or stopping the motion of an airplane when it is on the ground.
/// </summary>
ToeBrake = 0xBF,
/// <summary>
/// A lever pressed by the finger to release or activate a mechanism, typically used to discharge a firearm.
/// </summary>
Trigger = 0xC0,
/// <summary>
/// This device is normally a covered toggle switch that must be selected to enable the weapons system.
/// </summary>
WeaponsArm = 0xC1,
/// <summary>
/// This device can either be a pushbutton that steps through the available weapons or
/// a radio button that selects them individually.
/// </summary>
WeaponsSelect = 0xC2,
/// <summary>
/// Wing flap controls are usually powered either hydraulically or by electric motors,
/// and are used for low-speed control of an airplane.
/// </summary>
WingFlaps = 0xC3,
/// <summary>
/// A device, especially the gas pedal of a motor vehicle, for increasing speed.
/// </summary>
Accelerator = 0xC4,
/// <summary>
/// A device for slowing or stopping motion, as of a vehicle, especially by contact friction.
/// </summary>
Brake = 0xC5,
/// <summary>
/// A device for disengaging the transmission of a vehicle to allow shifting of gears.
/// </summary>
Clutch = 0xC6,
/// <summary>
/// A device for shifting gears in a vehicle.
/// </summary>
Shifter = 0xC7,
/// <summary>
/// A steering wheel is a single degree-of-freedom device that rotates about an axis.
/// </summary>
Steering = 0xC8,
/// <summary>
/// This control determines the right-to-left positioning of the tank turret.
/// </summary>
TurretDirection = 0xC9,
/// <summary>
/// This control determines the elevation of the gun barrel in a turret.
/// </summary>
BarrelElevation = 0xCA,
/// <summary>
/// Dive planes control the vertical ascent or descent of the submarine under power.
/// </summary>
DivePlane = 0xCB,
/// <summary>
/// Ballast controls the vertical ascent or descent of the submarine.
/// </summary>
Ballast = 0xCC,
/// <summary>
/// A foot-operated assembly of pedals attached to a crank that is used for powering a bicycle.
/// </summary>
BicycleCrank = 0xCD,
/// <summary>
/// A steering control, held in both hands, for a motorcycle or bicycle.
/// </summary>
HandleBars = 0xCE,
/// <summary>
/// Engages the front brake of the motorcycle to slow the vehicle.
/// </summary>
FrontBrake = 0xCF,
/// <summary>
/// Engages the rear brake of the motorcycle to slow the vehicle.
/// </summary>
RearBrake = 0xD0,
// 0xD1 - 0xFFFF // Reserved
}
}