hi how can i make to allow the user to touch 2 panel in same time and it give a sound?
this is my code i m trying to make a drum app.
I m using gestures and it is ok but when you need press 2 panel in same time itdont give sound
i go send the apk demo for all understand.
can someone help me on this? i m trying but i dont understand what to make now =(
this is my code i m trying to make a drum app.
I m using gestures and it is ok but when you need press 2 panel in same time itdont give sound
i go send the apk demo for all understand.
can someone help me on this? i m trying but i dont understand what to make now =(
B4X:
#Region Project Attributes
#ApplicationLabel: Bateria
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim bumbos,tarols,chipos As Int
Dim sp As SoundPool
Dim g As Gestures
Dim Panel2, panel3, panel4 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
Panel2.Initialize("Panel2")
'Panel2.Color = Colors.LightGray
Panel2.Tag = "Panel2"
panel3.Initialize("Panel3")
'panel3.Color = Colors.LightGray
panel3.Tag = "Panel3"
panel4.Initialize("Panel4")
'panel4.Color = Colors.LightGray
panel4.Tag = "Panel4"
'Panel3.Initialize("Panel3")
g.SetOnTouchListener(Panel2, "Panel2_GesturesTouch")
g.SetOnTouchListener(panel3, "Panel3_GesturesTouch")
g.SetOnTouchListener(panel4, "Panel4_GesturesTouch")
Activity.AddView(Panel2, 38%x, 50%y, 35%x, 50%Y) 'bumbo
Activity.AddView(panel3, 21%x, 50%y, 17%x, 45%Y) 'tarol
Activity.AddView(panel4, 1%x, 55%y, 20%x, 23%Y) 'chipo
sp.Initialize(100)
bumbos = sp.Load(File.DirAssets, "bumbo.mp3")
tarols = sp.Load(File.DirAssets, "tarol.mp3" )
chipos = sp.Load(File.DirAssets, "chipo.mp3" )
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Panel2_GesturesTouch(o As Object, ptrID As Int, action As Int, x As Float, y As Float) As Boolean
sp.Play(bumbos ,1,1,1,0,1 )
Return False ' need to return true otherwise we don't get any other events in the gesture
End Sub
Sub Panel3_GesturesTouch(o As Object, ptrID As Int, action As Int, x As Float, y As Float) As Boolean
sp.Play(tarols ,1,1,2,0,1 )
Return False ' need to return true otherwise we don't get any other events in the gesture
End Sub
Sub Panel4_GesturesTouch(o As Object, ptrID As Int, action As Int, x As Float, y As Float) As Boolean
sp.Play(chipos ,1,1,2,0,1 )
Return False ' need to return true otherwise we don't get any other events in the gesture
End Sub