mirror of
https://github.com/libretro/gw-libretro.git
synced 2025-02-18 14:57:27 +00:00
Updated Bomb Fight to support mouse and touches
This commit is contained in:
parent
8e65e0f60e
commit
1c012e3013
@ -1,33 +1,8 @@
|
||||
local unit1 = system.loadunit 'unit1'
|
||||
local forms = system.loadunit 'forms'
|
||||
local controls = system.loadunit 'controls'
|
||||
|
||||
local keymap = {
|
||||
left = { forms.vk_left, 'Left' },
|
||||
right = { forms.vk_right, 'Right' },
|
||||
a = { forms.vk_right, 'Right' },
|
||||
b = { forms.vk_control, 'Shoot' },
|
||||
l1 = { 0x31, 'Game A' },
|
||||
r1 = { 0x32, 'Game B' },
|
||||
l2 = { 0x33, 'Time' }
|
||||
}
|
||||
|
||||
local menu = {
|
||||
{ unit1.form1.btn_mode_down, 'Time', 0x33 },
|
||||
{ unit1.form1.btn_game_a_down, 'Game A', 0x31 },
|
||||
{ unit1.form1.btn_game_b_down, 'Game B', 0x32 }
|
||||
}
|
||||
|
||||
local timers = {
|
||||
unit1.form1.timerclock,
|
||||
unit1.form1.timerdate,
|
||||
unit1.form1.timergame,
|
||||
unit1.form1.timergamestart,
|
||||
unit1.form1.timergameover,
|
||||
unit1.form1.timerintermission,
|
||||
unit1.form1.timermiss,
|
||||
unit1.form1.timershot,
|
||||
unit1.form1.timerstartup
|
||||
}
|
||||
unit1.form1.oncreate()
|
||||
|
||||
unit1.pf_enemy.data = system.loadbin( 'Enemy.pcm' )
|
||||
unit1.pf_gameover.data = system.loadbin( 'Gameover.pcm' )
|
||||
@ -35,18 +10,79 @@ unit1.pf_miss.data = system.loadbin( 'Miss.pcm' )
|
||||
unit1.pf_shot.data = system.loadbin( 'Shot.pcm' )
|
||||
unit1.pf_start.data = system.loadbin( 'Start.pcm' )
|
||||
|
||||
unit1.form1.oncreate()
|
||||
|
||||
unit1.bsound = true
|
||||
unit1.imode = 0
|
||||
unit1.form1.gam_setmode()
|
||||
|
||||
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,
|
||||
{ 185, 50, 169, 206 },
|
||||
menu
|
||||
)
|
||||
local zoom = { left = 185, top = 50, width = 169, height = 206 }
|
||||
local fire, bottom = system.splitv( zoom )
|
||||
local left, right = system.splith( bottom )
|
||||
|
||||
return system.init{
|
||||
background = unit1.form1.im_background,
|
||||
zoom = zoom,
|
||||
|
||||
controls = {
|
||||
{
|
||||
button = unit1.form1.btn_mode_top,
|
||||
label = 'Time'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_game_a_top,
|
||||
label = 'Game A'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_game_b_top,
|
||||
label = 'Game B'
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_left_down,
|
||||
zone = left,
|
||||
label = 'Left',
|
||||
keys = { left = true },
|
||||
xkeys = { forms.vk_left }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_right_down,
|
||||
zone = right,
|
||||
label = 'Right',
|
||||
keys = { right = true, a = true },
|
||||
xkeys = { forms.vk_right }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_shoot_left_top,
|
||||
zone = fire,
|
||||
label = 'Shoot',
|
||||
keys = { b = true },
|
||||
xkeys = { forms.vk_control }
|
||||
},
|
||||
{
|
||||
button = unit1.form1.btn_shoot_right_top,
|
||||
label = 'Shoot',
|
||||
keys = { b = true },
|
||||
xkeys = { forms.vk_control }
|
||||
}
|
||||
},
|
||||
|
||||
timers = {
|
||||
unit1.form1.timerclock,
|
||||
unit1.form1.timerdate,
|
||||
unit1.form1.timergame,
|
||||
unit1.form1.timergamestart,
|
||||
unit1.form1.timergameover,
|
||||
unit1.form1.timerintermission,
|
||||
unit1.form1.timermiss,
|
||||
unit1.form1.timershot,
|
||||
unit1.form1.timerstartup
|
||||
},
|
||||
|
||||
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…
x
Reference in New Issue
Block a user