Android Question Simple graphic lines make errors.

funker

Member
Licensed User
Simple graphic lines make errors.
It will not be drawn partly the lines.
error in the library-graphic?


thank you.

B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
    #ApplicationLabel: esp8266
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Dim Timer1 As Timer
End Sub

Sub Globals  
    Private ser1 As Button
    Private sharp As Button
  
    Dim vz As int
    Dim vzz As Float
    Dim hz As int
    Dim hzz As Float
    Dim pi As Float
    Dim x As Float
    Dim y As Float
  
    Private image1 As Panel
    Private cvsGraph As Canvas
End Sub

Sub Activity_Create(FirstTime As Boolean)  
    Timer1.Initialize("Timer1", 200)
      Activity.LoadLayout("esp8266")
  
    cvsGraph.Initialize(image1)  
End Sub

Sub Activity_Resume
    Timer1.Enabled = True
    pi=3.14159265
    hzz=180
    vzz=0
End Sub

Sub Activity_Pause (UserClosed As Boolean)
  
End Sub

Sub Exit_App
    Activity.Finish
    ExitApplication
End Sub

Sub Timer1_Tick
  zeichne
End Sub

Sub ser1_Click
    vz=1
End Sub

Sub sharp_Click
    hz=1
End Sub

Sub zeichne
    If vz=1 Then
        If vzz < 180.0 Then
            vzz=vzz+1.6
            x=Sin(vzz*pi/180)*150
            y=Cos(vzz*pi/180)*150
            image1.Invalidate
            cvsGraph.DrawLine(225,225, 225+x,225+y, Colors.Red, 1)
        Else
            vz=0
            vzz=0
        End If  
    End If
  
    If hz=1 Then
        If hzz < 360.0 Then
            hzz=hzz+1.6
            x=Sin(hzz*pi/180)*150
            y=Cos(hzz*pi/180)*150
            image1.Invalidate
            cvsGraph.DrawLine(225,225, 225+x,225+y, Colors.Green, 1)
        Else
            hz=0
            hzz=180  
        End If  
    End If
End Sub
 

Attachments

  • Bild1.jpg
    Bild1.jpg
    437.5 KB · Views: 220
  • grafik-test.zip
    448.8 KB · Views: 164
Last edited:

sorex

Expert
Licensed User
Longtime User
your invalidates should happen after the drawline command... not sure that it would fix this issue tho but you might mis the last drawing in the picture.
 
Upvote 0
Top