/
EugenyCh7
/
Puppet2D.Net
Обзор
Документация
Войти
/
EugenyCh7
/
Puppet2D.Net
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Puppet2D.Window/Touch.cs
60 строк
2 KB
EugenyCh7
comments fix
24 июл 2025, 22:54
24 июл 2025, 22:54
421ed1f
Код
Авторство
О чём код?
using System; using System.Runtime.InteropServices; using System.Security; using Puppet2D.System; namespace Puppet2D.Window { /// <summary> /// Give access to the real-time state of the touches /// </summary> public static class Touch { /// <summary> /// Check if a touch event is currently down /// </summary> /// <param name="Finger">Finger index</param> /// <returns>True if the finger is currently touching the screen, false otherwise</returns> public static bool IsDown(uint Finger) { return sfTouch_isDown(Finger); } /// <summary> /// This function returns the current touch position /// </summary> /// <param name="Finger">Finger index</param> /// <returns>Current position of the finger</returns> public static Vector2i GetPosition(uint Finger) { return GetPosition(Finger, null); } /// <summary> /// This function returns the current touch position /// relative to the given window /// </summary> /// <param name="Finger">Finger index</param> /// <param name="RelativeTo">Reference window</param> /// <returns>Current position of the finger</returns> public static Vector2i GetPosition(uint Finger, WindowBase RelativeTo) { if (RelativeTo != null) { return RelativeTo.InternalGetTouchPosition(Finger); } else { return sfTouch_getPosition(Finger, IntPtr.Zero); } } #region Imports [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern bool sfTouch_isDown(uint Finger); [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern Vector2i sfTouch_getPosition(uint Finger, IntPtr RelativeTo); #endregion } }