User File #638483145181392921

Upload All User Files

#638483145181392921 - Nintendo DS Input Display

input_display.lua
System: Nintendo DS
13 downloads
Uploaded 4/10/2024 2:55 AM by inconsistent (see all 19)
updated (and better looking) version of my old script. made for DS but probably easy to port to other systems
-- @inconsistent_dg
-- made for DS but probably easy to port to other systems
-- mostly stolen from bizhaw's lua for input display

x = 8
y = 144
cyp = 0xC0FFFFFF -- Button Yup Pressed (FCEUX = 0xC0FDDBCF)
cnp = 0xC0000000 -- Button Not Pressed (FCEUX = 0xC0000000)
cln = 0xC0808080 -- Line color
cbg = 0xC0000E60 -- Background (FCEUX = 0xC0000E60)

function VPAD()
    faceText = false
    background = false
    if background == true then
        gui.drawRectangle(x - 4, y - 13, 84, 51, cbg, cbg)
    end

	c = joypad.getwithmovie()
    -- DPAD
	gui.drawRectangle(x + 11, y, 10, 10, c['Up']         and cyp or cnp,c['Up']    and cyp or cnp)
	gui.drawRectangle(x, y + 11, 10, 10 , c['Left']      and cyp or cnp,c['Left']  and cyp or cnp)
	gui.drawRectangle(x + 11, y + 22, 10, 10, c['Down']  and cyp or cnp,c['Down']  and cyp or cnp)
	gui.drawRectangle(x + 22, y + 11, 10, 10, c['Right'] and cyp or cnp,c['Right'] and cyp or cnp)
        -- DPAD lines
        gui.drawLine(x + 16, y +  2, x + 16, y +  8, cln) -- up
        gui.drawLine(x + 16, y + 24, x + 16, y + 30, cln) -- down
        gui.drawLine(x +  2, y + 16, x +  8, y + 16, cln) -- left
        gui.drawLine(x + 24, y + 16, x + 30, y + 16, cln) -- right
    
    -- FACE buttons
    gui.drawEllipse(x + 55,      y, 10, 10, c['X'] and cyp or cnp,c['X'] and cyp or cnp)
    gui.drawEllipse(x + 66, y + 11, 10, 10, c['A'] and cyp or cnp,c['A'] and cyp or cnp)
    gui.drawEllipse(x + 44, y + 11, 10, 10, c['Y'] and cyp or cnp,c['Y'] and cyp or cnp)
    gui.drawEllipse(x + 55, y + 22, 10, 10, c['B'] and cyp or cnp,c['B'] and cyp or cnp)

    if faceText == true then
        -- FACE text
        gui.drawText(x + 55, y - 3, "X", cln, "Arial")
        gui.drawText(x + 44, y + 9, "Y", cln, "Arial")
        gui.drawText(x + 55, y + 19, "A", cln, "Arial")
        gui.drawText(x + 66, y + 8, "B", cln, "Arial")
    end

    -- TRIGGERS
    gui.drawRectangle(x + 0, y - 9, 18, 4, c['L'] and cyp or cnp,c['L']    and cyp or cnp)
    gui.drawRectangle(x + 58, y - 9, 18, 4, c['R'] and cyp or cnp,c['R']    and cyp or cnp)
    
    -- START/SELECT
    gui.drawEllipse(x + 27, y + 30, 4, 4, c['Start'] and cyp or cnp,c['Start']    and cyp or cnp)
    gui.drawEllipse(x + 45, y + 30, 4, 4, c['Select'] and cyp or cnp,c['Select']    and cyp or cnp)
end

while true do
    VPAD()
    emu.frameadvance()
end