-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyStrokes.lua
More file actions
55 lines (48 loc) · 1.85 KB
/
KeyStrokes.lua
File metadata and controls
55 lines (48 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--[[
Localization
]]
local SetDrawColor = SetDrawColor
local DrawRect = DrawRect
local IsKeyDown = IsKeyDown
local SetTextPos = SetTextPos
local DrawText = DrawText
local SetFont = SetFont
local DrawOutlinedRect = DrawOutlinedRect
local ScrW = ScrW
local ScrH = ScrH
--[[
Localization end
]]
local white = Color(255, 255, 255)
local black = Color(0, 0, 0)
local red = Color(255, 0, 0)
local green = Color(0, 255, 0)
local blue = Color(0, 0, 255)
local function DrawKey(keyButton, keyLabel, x, y, w, h, keyColor, keyColorPressed, keyTextColor, font, outlineEnabled, outlineColor)
if input.IsKeyDown(keyButton) then
surface.SetDrawColor(keyColorPressed)
else
surface.SetDrawColor(keyColor)
end
surface.DrawRect(x, y, w, h)
if outlineEnabled then
surface.SetDrawColor(outlineColor or red)
surface.DrawOutlinedRect(x, y, w, h)
end
surface.SetTextColor(keyTextColor)
surface.SetFont(font)
local textw, texth = surface.GetTextSize(keyLabel)
surface.SetTextPos(x + (w / 2) - (textw / 2), y + (h / 2) - (texth / 2)) -- This just centers the key
surface.DrawText(keyLabel)
end
hook.Add("HUDPaint", "DrawKeys", function()
DrawKey(KEY_W, "W", ScrW() - 110, ScrH() - 165, 50, 50, white, red, black, "DermaLarge", false)
DrawKey(KEY_A, "A", ScrW() - 165, ScrH() - 110, 50, 50, white, red, black, "DermaLarge", false)
DrawKey(KEY_S, "S", ScrW() - 110, ScrH() - 110, 50, 50, white, red, black, "DermaLarge", false)
DrawKey(KEY_D, "D", ScrW() - 55, ScrH() - 110, 50, 50, white, red, black, "DermaLarge", false)
DrawKey(KEY_SPACE, "SPACE", ScrW() - 165, ScrH() - 55, 160, 50, white, red, black, "DermaLarge", false)
//DrawKey(KEY_LSHIFT, "LSHIFT", ScrW() - 270, ScrH() - 110, 100, 50, white, red, black, "DermaLarge", false) --I don't like how it looks personally, but why not.
end)
--[[ PREVIEW
https://femboy.astolfo.porn/GLsxVFDo deadlink lolollololololol
]]