daily update on 20240424 by nitloady youmu
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static partial class StgSharp
|
||||
{
|
||||
private unsafe static IntPtr[] monitorsArray;
|
||||
|
||||
public static unsafe IntPtr[] MonitorsHandleArray
|
||||
{
|
||||
get
|
||||
{
|
||||
if (monitorsArray == null)
|
||||
{
|
||||
int count = 0;
|
||||
IntPtr* arrayhandle = InternalIO.glfwGetMonitors(&count);
|
||||
monitorsArray = new IntPtr[count];
|
||||
Marshal.Copy((IntPtr)arrayhandle,monitorsArray,0,count);
|
||||
Marshal.FreeHGlobal((IntPtr)arrayhandle);
|
||||
}
|
||||
return monitorsArray;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr DefaultMonitor
|
||||
{
|
||||
get
|
||||
{
|
||||
return MonitorsHandleArray[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,17 +10,14 @@ namespace StgSharp
|
||||
|
||||
public static partial class StgSharp
|
||||
{
|
||||
private static ConcurrentDictionary<int, bool> keyListener = new ConcurrentDictionary<int, bool>();
|
||||
private static ConcurrentDictionary<int, KeyStatus> keyListener
|
||||
= new ConcurrentDictionary<int, KeyStatus>();
|
||||
|
||||
public static KeyStatus CheckKey(KeyboardKey key)
|
||||
{
|
||||
int keyId = (int)key;
|
||||
if (keyListener.ContainsKey((int)keyId))
|
||||
{
|
||||
return keyListener[(int)keyId]?KeyStatus.PRESS:KeyStatus.RELEASE;
|
||||
}
|
||||
keyListener.AddOrUpdate
|
||||
return keyListener.GetOrAdd((int)key, KeyStatus.RELEASE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user