Project #A013 [cin] Cryville.Input is a realtime input library under .NET Framework 3.5.
This project was created on 2023-04-30. It has been open-sourced since 2023-05-05.
There is no release at the moment, so you need to build the project by yourself.
- Clone Cryville.Common and Cryville.Input into the same folder.
- Open Cryville.Common.sln in the Cryville.Common repository and build the solution.
- Open Cryville.Input.sln in the Cryville.Input repository, switch to the Release configuration, and build the project Cryville.Input.
- The output libraries and documentations should now be in
Cryville.Input/bin/Release
.
Simply copy all the files in Cryville.Input/bin/Release
to the Assets/Plugins
folder in your unity project.
Simply copy all the contents in Cryville.Input.Unity.Builtin
to the Assets/Plugins/Cryville.Input.Unity.Builtin
folder in your unity project.
- Copy all the contents in
Cryville.Input.Unity.Android
to theAssets/Plugins/Cryville.Input.Unity.Android
folder in your unity project. - Make sure you have Android NDK installed. Open a command prompt in
Cryville.Input.Unity.Android.Native
(as the working directory) and runndk-build
in your Android NDK. - Copy the two folders in
Cryville.Input.Unity.Android.Native/libs
to theAssets/Plugins/Android
folder in your unity project.
The simplest way to use the library is to construct a SimpleInputConsumer
and check new input events periodically, typically every game tick. You need to construct an InputManager
before constructing a SimpleInputConsumer
, and before that, you need to call InputManager.HandlerRegistries.Add()
for every handler types you want to use. See the following example:
InputManager manager;
SimpleInputConsumer consumer;
Action<InputEvent> d_eventcb;
void Start() {
InputManager.HandlerRegistries.Add(typeof(AndroidTouchHandler), new object[0]); // Register AndroidTouchHandler
manager = new InputManager();
consumer = new SimpleInputConsumer(manager);
consumer.Activate();
d_eventcb = HandleInputEvent;
}
void Update() {
consumer.EnumerateEvents(d_eventcb);
}
void HandleInputEvent(InputEvent ev) {
// Handle input events here
}
- Unity GUI input (via
Event
inUnityEngine.IMGUIModule
) - Unity mouse input
- Unity touch input
- Android sensor
- Accelerometer
- Accelerometer Uncalibrated
- Ambient Temperature
- Geomagnetic Rotation Vector
- Gravity
- Gyroscope
- Gyroscope Uncalibrated
- Heart Beat
- Heart Rate
- Light
- Linear Acceleration
- Magnetic Field
- Magnetic Field Uncalibrated
- Pressure
- Proximity
- Relative Humidity
- Rotation Vector
- Step Counter
- Android touch
- Windows key (
WM_KEY*
) - Windows mouse (
WM_MOUSE*
) - Windows pointer (
WM_POINTER*
) - Windows touch (
WM_TOUCH
)
Go into the .mk
file shown in the error message and modify the line ifneq ($(words $(TARGET_TOOLCHAIN_LIST)), 1)
to ifneq ($(words $(TARGET_TOOLCHAIN_LIST)), 2)
.
The coordinate system an input handler uses depends on its underlying API. Use ReferenceCue.InverseTransform(InputFrame)
to transform a received frame to a universal reference. If the device has a boundary, use ReferenceCue.InverseTransform(InputFrame, InputVector)
instead and specify the size in the second parameter.