Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Type PointType2(x2 As Int,y2 As Int)
Private js1 As JoyStick
Private js2 As JoyStick
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("main")
js1.ButtonDrawable = "button"
js1.PadBackground = "pad"
js2.ButtonColor = Colors.Yellow
js2.PadColor = Colors.Blue
If FirstTime Then
UDPSocket1.Initialize("UDP", 0, 7777)
End If
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
Dim msg As String
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub js1_value_changed(angle As Double, angleDegrees As Double, powr As Double)
Dim y As Int
Dim x As Int
x = Cos(angle)
y = Sin(angle)
x = Cos(angle)
y = Sin(angle)
Log("x " & x)
Log("y " & y)
Dim s As String = "{"&""""&"json"&""""&":"&""""&"yes"&""""&","&""""&"y"&""""&":"&""""&y&""""&","&""&""""&"x"&""""&":"&""""&x&""""&"}" 'send joy position to win app
Dim Packet As UDPPacket
Dim data() As Byte
data = s.GetBytes("UTF8")
Packet.Initialize(data, "192.168.1.105", 7777)
UDPSocket1.Send(Packet)
End Sub