Move Common functionality to Core project & rendering and Model support as well

This commit is contained in:
miku-666
2025-09-01 23:03:39 +02:00
parent 698056a0a0
commit 9656c8b48d
177 changed files with 5979 additions and 1279 deletions

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PckStudio.Core.Extensions
{
public static class CursorExtensions
{
[StructLayout(LayoutKind.Sequential)]
struct PointStruct
{
public Int32 x;
public Int32 y;
}
[StructLayout(LayoutKind.Sequential)]
struct CursorInfoStruct
{
/// <summary> The structure size in bytes that must be set via calling Marshal.SizeOf(typeof(CursorInfoStruct)).</summary>
public Int32 cbSize;
/// <summary> The cursor state: 0 == hidden, 1 == showing, 2 == suppressed (is supposed to be when finger touch is used, but in practice finger touch results in 0, not 2)</summary>
public Int32 flags;
/// <summary> A handle to the cursor. </summary>
public IntPtr hCursor;
/// <summary> The cursor screen coordinates.</summary>
public PointStruct pt;
}
/// <summary> Must initialize cbSize</summary>
[DllImport("user32.dll")]
static extern bool GetCursorInfo(ref CursorInfoStruct pci);
public static bool IsVisible(this Cursor _)
{
CursorInfoStruct pci = new CursorInfoStruct();
pci.cbSize = Marshal.SizeOf(typeof(CursorInfoStruct));
GetCursorInfo(ref pci);
// const Int32 hidden = 0x00;
const Int32 showing = 0x01;
// const Int32 suppressed = 0x02;
bool isVisible = ((pci.flags & showing) != 0);
return isVisible;
}
}
}