![CreepyCrafter24](/assets/img/avatar_default.png)
new file: 1/1.cs new file: 1/1.csproj new file: 1/Properties/AssemblyInfo.cs new file: Base/Base.csproj new file: Base/Input.cs new file: Base/Level.cs new file: Base/Properties/AssemblyInfo.cs new file: LaptopSimulator2015.sln new file: LaptopSimulator2015/App.config new file: LaptopSimulator2015/CaptchaGenerator.cs new file: LaptopSimulator2015/FakeDesktop.Designer.cs new file: LaptopSimulator2015/FakeDesktop.cs new file: LaptopSimulator2015/FakeDesktop.resx new file: LaptopSimulator2015/LaptopSimulator2015.csproj new file: LaptopSimulator2015/Program.cs new file: LaptopSimulator2015/Properties/AssemblyInfo.cs new file: LaptopSimulator2015/Properties/Resources.Designer.cs new file: LaptopSimulator2015/Properties/Resources.resx new file: LaptopSimulator2015/Properties/Settings.Designer.cs new file: LaptopSimulator2015/Properties/Settings.settings new file: LaptopSimulator2015/Resources/fans.wav new file: LaptopSimulator2015/Resources/pcoptimizerpro.jpeg new file: LaptopSimulator2015/Settings.cs new file: LaptopSimulator2015/strings.Designer.cs new file: LaptopSimulator2015/strings.de.Designer.cs new file: LaptopSimulator2015/strings.de.resx new file: LaptopSimulator2015/strings.resx new file: README.md new file: SIT/App.config new file: SIT/MainForm.Designer.cs new file: SIT/MainForm.cs new file: SIT/MainForm.resx new file: SIT/Program.cs new file: SIT/Properties/AssemblyInfo.cs new file: SIT/Properties/Resources.Designer.cs new file: SIT/Properties/Resources.resx new file: SIT/Properties/Settings.Designer.cs new file: SIT/Properties/Settings.settings new file: SIT/SIT.csproj new file: ToDo.txt new file: make.bat
36 lines
948 B
C#
36 lines
948 B
C#
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 Base
|
|
{
|
|
public class Input
|
|
{
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
|
private static extern short GetKeyState(int keyCode);
|
|
|
|
public static bool IsKeyDown(Keys key)
|
|
{
|
|
try
|
|
{
|
|
int state = 0;
|
|
short retVal = GetKeyState((int)key);
|
|
if ((retVal & 0x8000) == 0x8000)
|
|
state |= 1;
|
|
if ((retVal & 1) == 1)
|
|
state |= 2;
|
|
return 1 == (state & 1);
|
|
}
|
|
catch (Exception e1)
|
|
{
|
|
Console.WriteLine("Invader: IsKeyDown failed:\r\n" + e1.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|