Hello,
I have been playing with two graphics on top of each other, trying to turn them accordimng a set value it works more or less, but shifts to the side so that it seems there are 3 graphics.
Could some one have a look at it and let me know how this could be improved is properly done
enter RWY=250 Wdir 20 and click twice, then change Wdir to 30
Thanks!
File-Upload.net - degree.zip
I have been playing with two graphics on top of each other, trying to turn them accordimng a set value it works more or less, but shifts to the side so that it seems there are 3 graphics.
Could some one have a look at it and let me know how this could be improved is properly done
enter RWY=250 Wdir 20 and click twice, then change Wdir to 30
Thanks!
File-Upload.net - degree.zip
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim DestRect, DestRect1 As Rect
Dim iDegrees,iDegrees1, AngleStart,AngleStart1, AngleEnd,AngleEnd1, AngleStep, AngleStep1 As Float
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 btnRotate As Button
Dim edDegrees As EditText
Dim edtWindDir As EditText
Dim imgRunway As ImageView
Dim imgWindDir As ImageView
Dim Timer1 As Timer
Dim Canvas1 As Canvas
Dim Canvas2 As Canvas
Dim Bitmap1 As Bitmap
Dim Bitmap2 As Bitmap
Dim a As Animation
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
End If
Activity.LoadLayout("layWind")
Canvas1.Initialize(imgRunway)
DestRect.Initialize(0dip, 0dip, 230dip, 230dip)
Bitmap1.Initialize(File.DirAssets, "Runway.png")
iDegrees = 0
Timer1.Initialize("Timer1",100)
AngleStep=200
'------ Wind Pointer ------------------------------------------
Canvas2.Initialize(imgWindDir)
DestRect1.Initialize(0dip, 0dip, 256dip, 256dip)
Bitmap2.Initialize(File.DirAssets, "widdirarrow.png")
iDegrees1 = 0
Timer1.Initialize("Timer1",100)
AngleStep1=200
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnRotate_Click
' If edDegrees.Text = "" Then 'edDegrees.Text = "0"
' ToastMessageShow ("Wrong less than 1°",False)
' Return
' End If
' If edDegrees.Text = >360 Then
' ToastMessageShow ("Wrong more than 360°",False)
' Return
' End If
RWY= edDegrees.Text
AngleEnd=0+RWY
AngleStep=AngleStep
Timer1.Enabled=True
'------ Wind Pointer --------------------------------------------
WD= edtWindDir.Text
AngleEnd1=0+WD
AngleStep1=AngleStep1
Timer1.Enabled=True
End Sub
Sub Timer1_Tick
' If iDegrees>=AngleEnd-AngleStep AND AngleStep=AngleStep1 Then
' AngleStep=AngleStep1/3
' End If
iDegrees=iDegrees+AngleStep
If iDegrees>=AngleEnd Then
Timer1.Enabled=False
iDegrees=AngleEnd
AngleStart=AngleEnd
End If
Canvas1.DrawBitmapRotated(Bitmap1,Null,DestRect,iDegrees)
imgRunway.Invalidate2(DestRect)
iDegrees1=iDegrees1+AngleStep1
If iDegrees1>=AngleEnd1 Then
Timer1.Enabled=False
iDegrees1=AngleEnd1
AngleStart1=AngleEnd1
End If
Canvas1.DrawBitmapRotated(Bitmap2,Null,DestRect1,iDegrees1)
imgWindDir.Invalidate2(DestRect1)
End Sub
Last edited: