Advertisement
Guest User

Untitled

a guest
Feb 11th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.54 KB | None | 0 0
  1.   def drawGrid(draw: Shape => Unit) {
  2.     var y_spacing = 0
  3.     var x_spacing = 0
  4.    
  5.     val numLines = G_SIZE / G_INTERVAL
  6.    
  7.     def makeLn(axis: Char) {
  8.       val aLine = axis match {
  9.         case 'y' =>
  10.           y_spacing += G_INTERVAL
  11.           makeLine(y_spacing, 0, y_spacing, G_SIZE)
  12.         case 'x' =>
  13.           x_spacing += G_INTERVAL
  14.           makeLine(0,x_spacing, G_SIZE, x_spacing)
  15.       }
  16.       draw(aLine)
  17.     }
  18.     (1 to numLines).foreach(_ => makeLn('y'))
  19.     (1 to numLines).foreach(_ => makeLn('x'))
  20.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement