     self.height = Int((height - doublePadding) / cellHeight)
   }
 
-}
+  public func pointToCell(x: Int32, y: Int32) -> CellPoint? {
+    p("pointToCell \(x) \(y)")
+    if x >= padding && x <= (cellWidth * Int32(width)) + padding &&
+        y >= padding && y <= (cellHeight * Int32(height)) + padding {
+      return CellPoint(x: Int((x - padding) / cellWidth),
+          y: Int((y - padding) / cellHeight))
+    }
+    return nil
+  }
+
+}

          p("mouse button down \(ev.button.x) \(ev.button.y) \(ev.button.clicks)")
        } else if ev.type == MOUSEBUTTONUP {
          p("mouse button up \(ev.button.x) \(ev.button.y) \(ev.button.clicks)")
        } else if ev.type == TEXTINPUT {
          p("text input \(ev.text)")
        } else if ev.type == QUIT {


  deinit { SDL_DestroyTexture(texture) }

}


public struct CellPoint {
  var x: Int
  var y: Int
}


