-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfdraw.lua
117 lines (103 loc) · 4.06 KB
/
sfdraw.lua
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
-----------------------------------------------------------------------------
-- This is a collection of functions for use in modifying the Super Street
-- Fight II UI to accommodate third-party computer-controller characters.
--
-- 2017 Edward Hummerston
-----------------------------------------------------------------------------
SFDraw = {}
SFDraw.WHITE = 0xffe6e6e6
SFDraw.BLACK = 0xff193a7b
SFDraw.BLUE = 0xff319cb5
SFDraw.YELLOW = 0xfff7b552
SFDraw.RED = 0xffd62100
SFDraw.ORANGE = 0xfff75a3a
SFDraw.TEXT = 0xfff78746
-----------------------------------------------------------------------------
-- Draws a controller's input state to the emulator screen in an arcade
-- layout.
--
-- @param playerSlot The controller port to represent. (Also determines
-- drawn position.)
-----------------------------------------------------------------------------
function SFDraw.drawPad(playerSlot, pads)
local bX = ((playerSlot==1) and 79 or 151) -- left side of control display
local bY = 47 -- top of control display
gui.drawEllipse(bX,bY,8,8, SFDraw.BLACK) -- circle of joystick base
gui.drawEllipse(bX+3,bY + 3,
2, 2, SFDraw.BLACK, SFDraw.BLACK) -- joystick shaft base
local pY = 0 -- player Y-axis input
if (pads["P" .. playerSlot .. " Up"]) then
pY = -1
elseif (pads["P" .. playerSlot .. " Down"]) then
pY = 1
end
local pX = 0 -- player X-axis input
if (pads["P" .. playerSlot .. " Left"]) then
pX = -1
elseif (pads["P" .. playerSlot .. " Right"]) then
pX = 1
end
gui.drawPixel(bX+4 + pX,bY + 4 + pY, SFDraw.BLACK) -- joystick shaft
gui.drawEllipse(bX+2+(pX*3),bY + 2 + (pY*3),
4, 4, SFDraw.ORANGE, SFDraw.ORANGE) -- joystick head
-- some pixels to add sphere effect
gui.drawPixel(bX+5+(pX*3),bY + 3 + (pY*3), SFDraw.WHITE)
gui.drawPixel(bX+4+(pX*3),bY + 2 + (pY*3), SFDraw.YELLOW)
bX = bX + 12
-- Y/Light Punch
if (pads["P" .. playerSlot .. " Y"]) then
gui.drawEllipse(bX, bY, 3, 3, SFDraw.BLUE, SFDraw.BLUE)
else
gui.drawEllipse(bX, bY, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
-- B/Light Kick
if (pads["P" .. playerSlot .. " B"]) then
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.BLUE, SFDraw.BLUE)
else
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
bY = bY - 1 -- the first pair of buttons are lower on an arcade stick
bX = bX + 5
-- X/Medium Punch
if (pads["P" .. playerSlot .. " X"]) then
gui.drawEllipse(bX, bY, 3, 3, SFDraw.YELLOW, SFDraw.YELLOW)
else
gui.drawEllipse(bX, bY, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
-- A/Medium Kick
if (pads["P" .. playerSlot .. " A"]) then
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.YELLOW, SFDraw.YELLOW)
else
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
bX = bX + 5
-- L/Heavy Punch
if (pads["P" .. playerSlot .. " L"]) then
gui.drawEllipse(bX, bY, 3, 3, SFDraw.RED, SFDraw.RED)
else
gui.drawEllipse(bX, bY, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
-- R/Heavy Kick
if (pads["P" .. playerSlot .. " R"]) then
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.RED, SFDraw.RED)
else
gui.drawEllipse(bX, bY+5, 3, 3, SFDraw.BLACK, SFDraw.BLACK)
end
end
-----------------------------------------------------------------------------
-- Draws a string to the emulator screen in the style of SSF2 in-game
-- character names.
--
-- @param playerSlot The player character being named. (Determines drawn
-- position.)
-- @param name The string to be drawn.
-----------------------------------------------------------------------------
function SFDraw.drawName(playerSlot, name)
local nameX = ((playerSlot==1) and 30 or 226)
local textAlign = ((playerSlot==1) and "left" or "right")
-- text shadow drawn first
gui.drawText(nameX+1,57, name, SFDraw.BLACK, 0x00000000,
12, "Times New Roman", "bold", textAlign, "bottom")
gui.drawText(nameX,56, name, SFDraw.YELLOW, 0x00000000,
12, "Times New Roman", "bold", textAlign, "bottom")
end