This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
LaptopSimulator2015/Base/Input.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2019-10-05 17:49:56 +02:00
using CC_Functions.W32;
using System;
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
namespace Base
{
2019-10-05 17:49:56 +02:00
public static class Input
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
{
2019-09-19 18:51:31 +02:00
/// <summary>
/// Check whether the Key is pressed
/// </summary>
/// <param name="key">Key to check</param>
/// <returns>Whether the key is pressed</returns>
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
public static bool IsKeyDown(Keys key)
{
try
{
2019-10-05 17:49:56 +02:00
return KeyboardReader.IsKeyDown(key);
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
}
2019-10-05 17:49:56 +02:00
catch (Exception e)
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
{
2019-10-05 17:49:56 +02:00
Console.WriteLine("Invader: IsKeyDown failed:\r\n" + e.ToString());
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
return false;
}
}
2019-08-25 16:21:07 +02:00
2019-09-19 18:51:31 +02:00
/// <summary>
/// Unified input for going up
/// </summary>
2019-08-25 16:21:07 +02:00
public static bool Up => IsKeyDown(Keys.Up) || IsKeyDown(Keys.W);
2019-09-19 18:51:31 +02:00
/// <summary>
/// Unified input for going left
/// </summary>
2019-08-25 16:21:07 +02:00
public static bool Left => IsKeyDown(Keys.Left) || IsKeyDown(Keys.A);
2019-09-19 18:51:31 +02:00
/// <summary>
/// Unified input for going down
/// </summary>
2019-08-25 16:21:07 +02:00
public static bool Down => IsKeyDown(Keys.Down) || IsKeyDown(Keys.S);
2019-09-19 18:51:31 +02:00
/// <summary>
/// Unified input for going right
/// </summary>
2019-08-25 16:21:07 +02:00
public static bool Right => IsKeyDown(Keys.Right) || IsKeyDown(Keys.D);
2019-09-19 18:51:31 +02:00
/// <summary>
/// Unified input for doing something
/// </summary>
2019-08-25 16:21:07 +02:00
public static bool Action => IsKeyDown(Keys.Space) || IsKeyDown(Keys.Q) || IsKeyDown(Keys.E);
new file: .gitignore 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
2019-07-23 14:54:05 +02:00
}
}