aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS-TheRevival/Functions/InGame
diff options
context:
space:
mode:
authorEverythingWindows <[email protected]>2022-11-17 11:44:01 +0700
committerEverythingWindows <[email protected]>2022-11-17 11:44:01 +0700
commit9d0b741e7b1ced233cd791f51e1c975b60d43acd (patch)
treec946d787509201ada3a34553c01a275f2f17969e /ShiftOS-TheRevival/Functions/InGame
parentdc8ddb780f10e7c8372c558ad4dec5fd171b8cc8 (diff)
downloadshiftos-therevival-old-9d0b741e7b1ced233cd791f51e1c975b60d43acd.tar.gz
shiftos-therevival-old-9d0b741e7b1ced233cd791f51e1c975b60d43acd.tar.bz2
shiftos-therevival-old-9d0b741e7b1ced233cd791f51e1c975b60d43acd.zip
Added KeyboardHandler to handle shortcuts and key input to make it universally used
Diffstat (limited to 'ShiftOS-TheRevival/Functions/InGame')
-rw-r--r--ShiftOS-TheRevival/Functions/InGame/Hardwares/KeyboardHandler.vb51
1 files changed, 51 insertions, 0 deletions
diff --git a/ShiftOS-TheRevival/Functions/InGame/Hardwares/KeyboardHandler.vb b/ShiftOS-TheRevival/Functions/InGame/Hardwares/KeyboardHandler.vb
new file mode 100644
index 0000000..26aca44
--- /dev/null
+++ b/ShiftOS-TheRevival/Functions/InGame/Hardwares/KeyboardHandler.vb
@@ -0,0 +1,51 @@
+Imports System.IO
+
+Module KeyboardHandler
+ Public InputKey As Keys
+
+ Public Sub ShortcutHandle()
+ Select Case InputKey
+ Case (Keys.Control + Keys.Q)
+ If Console.CurrentInterpreter = "terminal" Then
+ Else
+ TerminateApp(KeyInput)
+ TextRebind()
+ End If
+ Case Else
+ ExecKeyBinding(KeyInput)
+ End Select
+ End Sub
+
+ Public Sub ExecKeyBinding(KeyInput As Keys)
+ Select Case KeyInput
+ Case (Keys.S + Keys.Control)
+ Select Case Console.CurrentInterpreter
+ Case "textpad"
+ If File.Exists(Console.CurrentDirectory & "\" & command) = True Then
+ Dim TempCompare As String = File.ReadAllText(Console.CurrentDirectory & "\" & command)
+ If Console.TextBox1.Text = TempCompare Then
+
+ Else
+ Dim BeforeCP As Integer = Strings.ComputerInfo(2)
+ SaveFile(command)
+ TextPad_GenerateCP_SavedFile()
+ Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
+ Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
+ End If
+ Else
+ Dim BeforeCP As Integer = Strings.ComputerInfo(2)
+ SaveFile(command)
+ TextPad_GenerateCP_SavedFile()
+ Dim AfterCP As Integer = Strings.ComputerInfo(2) - BeforeCP
+ Console.ToolBar.Text = "TextPad - " & command & " - You've got " & AfterCP & " Codepoints" & Environment.NewLine & "Ctrl-Q Exit | Ctrl-N New | Ctrl-O Open | Ctrl-S Save | F12 Save As"
+ End If
+ End Select
+ Case (Keys.N + Keys.Control)
+ Select Case Console.CurrentInterpreter
+ Case "textpad"
+ Console.TextBox1.Text = Nothing
+ End Select
+ End Select
+ End Sub
+
+End Module