mirror of
https://github.com/libretro/gw-libretro.git
synced 2024-11-23 07:39:47 +00:00
Updated Banana to support mouse and touches
This commit is contained in:
parent
593a735dda
commit
fd36b26335
@ -1,32 +1,8 @@
|
||||
local unit1 = system.loadunit 'unit1'
|
||||
local forms = system.loadunit 'forms'
|
||||
local controls = system.loadunit 'controls'
|
||||
|
||||
local keymap = {
|
||||
up = { forms.vk_left, forms.vk_up, 'Northwest' },
|
||||
down = { forms.vk_left, forms.vk_down, 'Southwest' },
|
||||
x = { forms.vk_right, forms.vk_up, 'Northeast' },
|
||||
b = { forms.vk_right, forms.vk_down, 'Southeast' },
|
||||
l1 = { 49, 'Game A' },
|
||||
r1 = { 50, 'Game B' },
|
||||
l2 = { 51, 'Time' }
|
||||
}
|
||||
|
||||
local menu = {
|
||||
{ unit1.form1.btn_game_a_down, 'Game A', 49 },
|
||||
{ unit1.form1.btn_game_b_down, 'Game B', 50 },
|
||||
{ unit1.form1.btn_mode_down, 'Time', 51 }
|
||||
}
|
||||
|
||||
local timers = {
|
||||
unit1.form1.timeralarm,
|
||||
unit1.form1.timerclock,
|
||||
unit1.form1.timerdate,
|
||||
unit1.form1.timerfork,
|
||||
unit1.form1.timergame,
|
||||
unit1.form1.timergameover,
|
||||
unit1.form1.timergamestart,
|
||||
unit1.form1.timermiss
|
||||
}
|
||||
unit1.form1.oncreate()
|
||||
|
||||
unit1.pfgameover.data = system.loadbin( 'Gameover.pcm' )
|
||||
unit1.pfgot.data = system.loadbin( 'Got.pcm' )
|
||||
@ -35,24 +11,88 @@ unit1.pfstart.data = system.loadbin( 'Start.pcm' )
|
||||
unit1.apfmove[ 1 ].data = system.loadbin( 'Moveup.pcm' )
|
||||
unit1.apfmove[ 2 ].data = system.loadbin( 'Movedown.pcm' )
|
||||
|
||||
unit1.form1.oncreate()
|
||||
|
||||
-- this game doesn't have a acl mode so we have to reblit all images
|
||||
unit1.form1.vid_showall( true )
|
||||
unit1.form1.vid_showscore( 8888, true )
|
||||
|
||||
for i = 1, 4 do
|
||||
unit1.aim_panel_digits[ i ].visible = true
|
||||
end
|
||||
|
||||
unit1.bsound = true
|
||||
|
||||
return system.init(
|
||||
unit1.form1.im_background,
|
||||
keymap,
|
||||
function( key ) unit1.form1.onkeydown( nil, key, 0 ) end,
|
||||
function( key ) unit1.form1.onkeyup( nil, key, 0 ) end,
|
||||
timers,
|
||||
{ 153, 54, 257, 190 },
|
||||
menu
|
||||
)
|
||||
-- this game doesn't have a acl mode so we have to reblit all images
|
||||
do
|
||||
unit1.form1.vid_showall( true )
|
||||
unit1.form1.vid_showscore( 8888, true )
|
||||
|
||||
for i = 1, 4 do
|
||||
unit1.aim_panel_digits[ i ].visible = true
|
||||
end
|
||||
end
|
||||
|
||||
local zoom = { left = 153, top = 54, width = 257, height = 190 }
|
||||
local left, right = system.splith( zoom )
|
||||
local nw, sw = system.splitv( left )
|
||||
local ne, se = system.splitv( right )
|
||||
|
||||
return system.init{
|
||||
background = unit1.form1.im_background,
|
||||
zoom = zoom,
|
||||
|
||||
controls = {
|
||||
{
|
||||
button = unit1.form1.btn_game_a_top,
|
||||
label = 'Game A'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_game_b_top,
|
||||
label = 'Game B'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_mode_top,
|
||||
label = 'Time'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_1_nw_down,
|
||||
zone = nw,
|
||||
label = 'Northwest',
|
||||
keys = { up = true },
|
||||
xkeys = { forms.vk_up, forms.vk_left }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_3_sw_down,
|
||||
zone = sw,
|
||||
label = 'Southwest',
|
||||
keys = { down = true },
|
||||
xkeys = { forms.vk_down, forms.vk_left }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_2_ne_down,
|
||||
zone = ne,
|
||||
label = 'Northeast',
|
||||
keys = { x = true },
|
||||
xkeys = { forms.vk_up, forms.vk_right }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_4_se_down,
|
||||
zone = se,
|
||||
label = 'Southeast',
|
||||
keys = { b = true },
|
||||
xkeys = { forms.vk_down, forms.vk_right }
|
||||
}
|
||||
},
|
||||
|
||||
timers = {
|
||||
unit1.form1.timeralarm,
|
||||
unit1.form1.timerclock,
|
||||
unit1.form1.timerdate,
|
||||
unit1.form1.timerfork,
|
||||
unit1.form1.timergame,
|
||||
unit1.form1.timergameover,
|
||||
unit1.form1.timergamestart,
|
||||
unit1.form1.timermiss
|
||||
},
|
||||
|
||||
onkey = function( key, pressed )
|
||||
local handler = pressed and unit1.form1.onkeydown or unit1.form1.onkeyup
|
||||
handler( nil, key, 0 )
|
||||
end,
|
||||
|
||||
onbutton = function( button, pressed )
|
||||
local handler = pressed and button.onmousedown or button.onmouseup
|
||||
handler( nil, controls.mbleft, false, 0, 0 )
|
||||
end
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user