I created a prototype with the buttons: up, down, left, right, A, B and C.
require "gd"
joysimg = gd.createFromPng("segajoystick.png"):gdStr()
joysw = 120
joysh = 64
transp = {0,0,0,0}
btnpress = {0,0,255,244}
gui.circle = function (x, y, r, fill, border)
fill = fill or {0,0,0,0}
-- Fill
for xr = -r, r do
yr = math.sqrt(r*r - xr*xr)
gui.line (x+xr, y-yr, x+xr, y+yr, fill)
end
-- Border
border = border or fill
yd = 0;
for xr = -r, r do
yr = math.sqrt(r*r - xr*xr)
gui.line (x+xr, y-yr, x+xr, y-yd, border)
gui.line (x+xr, y+yr, x+xr, y+yd, border)
--if (math.abs((y-yd) - (y-yr)) > 1) then
-- gui.line (x+xr, y-yr, x+xr, y-yd-1, border)
-- gui.line (x+xr, y+yr, x+xr, y+yd+1, border)
--else
-- gui.pixel (x+xr, y-yr, border)
-- gui.pixel (x+xr, y+yr, border)
--end
yd = yr;
end
end
gens.registerafter(function()
gui.gdoverlay(10, 223-joysh-10, joysimg, 0.9)
local buttons = joypad.get(1);
if buttons.left then gui.box (10+15, 223-joysh+21, 10+23, 223-joysh+28, btnpress, 'white') end
if buttons.right then gui.box (10+29, 223-joysh+22, 10+37, 223-joysh+29, btnpress, 'white') end
if buttons.up then gui.box (10+23, 223-joysh+14, 10+30, 223-joysh+21, btnpress, 'white') end
if buttons.down then gui.box (10+22, 223-joysh+27, 10+29, 223-joysh+35, btnpress, 'white') end
if buttons.A then gui.circle (10+81, 223-joysh+34, 5, btnpress, 'white') end
if buttons.B then gui.circle (10+93, 223-joysh+28, 5, btnpress, 'white') end
if buttons.C then gui.circle (10+107, 223-joysh+23, 5, btnpress, 'white') end
end)
This script require "gd" library that gens emulator have in gens-lua.html an explanation to how to install.
I use this joystick image,
download it to run the script correctly and move it to gens emulator executable directory.
Just is a test script, can be better