cls For n =0 To 239 Step 8'239 To 0 Step -4 move 239-n,n draw n,239 Next For x=0 To Gxm Step 10 For y=0 To Gym Step 10 Move x,y circle Gx,Gy,4 DrawR rnd*20-10,rnd*20-10 Next y,x
'screen dimensions follow LCDPANEL settings Const Gxm=MM.HRes-1,Gym=MM.VRes-1 ' 0 to zzz 'The global variables Gx and Gy always contain the current graphic cursor in native co-ordinates Dim Integer Gx, Gy ' current native x,y (i.e. not cartesian) coord system
'plot a point Sub Plot(x As Integer,y As Integer) Gx=x:Gy=Gym-y Pixel Gx,Gy End Sub 'plot a point relative to the cursor e.g. PlotR -1,-1 plots a point one pixel left and down from the current graphics cursor Sub PlotR(x As Integer,y As Integer) Gx=Gx+x:Gy=Gy-y Pixel Gx,Gy End Sub 'Draw a line from the current graphics cursor to the x,y given Sub Draw(x As Integer,y As Integer) 'draw a line from the current graphics cursor to the specified point Line Gx,Gy,x,Gym-y Gx=x:Gy=Gym-y End Sub 'Draw a line from the current graphics cursor to the relative point x,y from the cursor Sub DrawR(x As Integer,y As Integer) Line Gx,Gy,Gx+x,Gy-y Gx=Gx+x:Gy=Gy-y End Sub 'move the graphics cursor to the given x,y but doesn't draw anything Sub Move(x As Integer,y As Integer) Gx=x:Gy=Gym-y End Sub 'move the graphics cursor to the point x,y relative to the current cursor but doesn't draw anything Sub MoveR(x As Integer,y As Integer) Gx=Gx+x:Gy=Gy-y End Sub 'sets the global variables Gx and Gy to native LCD panel co-ordinates from Cartesian so 'other drawing commands e.g. Text, Circle, Box etc. can use the Cartesian system. Same as Move but more intuitive Sub Native (x,y) Gx=x:Gy=Gym-y End Sub