Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
lines
#11
HyperBASIC? looks like fb to me ;P


for qb 4.5:

Code:
Declare Sub DrawLine( colour As Integer, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer )


Screen 13

DrawLine 15, 1, 1, 7, 7




Sub DrawLine( colour As Integer, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer)

    Dim slope As Double,x As Double,y As Double
    slope = (y2 - y1) / (x2 - x1)
  
    x = x1+0.5
    y = y1+0.5
  
    If (Abs(slope) > 1) Then
      
        slope = (x2 - x1) / (y2 - y1)
        If (y1 < y2) Then
          
            While (Int(y) <= y2)
              
                PSet (Int(x),Int(y)),colour
                y = y + 1
                x = x + slope
            Wend
          
        Else
          
            While (Int(y) >= y2)
              
                PSet (Int(x),Int(y)),colour
                y = y - 1
                x = x - slope
            Wend
        End If
      
    ElseIf(x1 < x2) Then
      
      
      
        While(Int(x) <= x2)
          
            PSet (Int(x),Int(y)),colour
            x = x + 1
            y = y + slope
        Wend
      
    Else
      
        While(Int(x) >= x2)
          
            PSet (Int(x),Int(y)),colour
            x = x - 1
            y = y - slope
        Wend
    End If
End Sub


yeah, take that all n00bs who said i push fb on people, i can still go at it in qb with the best of em. =p
Reply


Messages In This Thread
lines - by Dio - 03-12-2006, 05:03 AM
lines - by Agamemnus - 03-12-2006, 05:30 AM
lines - by Dio - 03-12-2006, 12:49 PM
lines - by Ralph - 03-13-2006, 04:38 AM
lines - by Dio - 03-13-2006, 09:08 AM
lines - by Radical Raccoon - 03-13-2006, 09:33 AM
lines - by axipher - 03-13-2006, 07:28 PM
lines - by Ralph - 03-14-2006, 09:09 PM
lines - by axipher - 03-14-2006, 09:26 PM
lines - by axipher - 03-14-2006, 09:34 PM
lines - by Anonymous - 03-14-2006, 10:16 PM
lines - by Dio - 03-15-2006, 08:40 AM
lines - by RyanKelly - 03-15-2006, 09:39 AM
lines - by Agamemnus - 03-15-2006, 10:56 AM
lines - by RyanKelly - 03-16-2006, 10:10 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)