Permalink
Browse files

Added some convenience!

  • Loading branch information...
1 parent a10577b commit ccf9c5098d2cc964f9a57c57381956f6326652c7 Josh Marchán committed Nov 28, 2009
Showing with 32 additions and 0 deletions.
  1. +1 −0 squirl.asd
  2. +24 −0 src/convenience.lisp
  3. +7 −0 src/package.lisp
View
@@ -12,6 +12,7 @@
(:file "bounding-box" :depends-on ("vec"))
(:file "collision" :depends-on ("shape" "poly-shape" "contact"))
(:file "contact" :depends-on ("vec"))
+ (:file "convenience" :depends-on ("body" "shape" "poly-shape" "vec"))
(:file "hash-set" :depends-on ("utils"))
(:file "package")
(:file "shape" :depends-on ("vec" "bounding-box" "body"))
View
@@ -0,0 +1,24 @@
+;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
+(in-package :squirl)
+
+(defun make-rectangle (width height &key (restitution 0d0) (friction 0d0) (offset +zero-vector))
+ (let* ((width/2 (/ width 2))
+ (height/2 (/ height 2))
+ (verts (list (vec (- width/2) height/2)
+ (vec width/2 height/2)
+ (vec width/2 (- height/2))
+ (vec (- width/2) (- height/2)))))
+ (make-poly verts :restitution restitution :friction friction :offset offset)))
+
+(defun make-circle-body ()
+ ;; todo
+ )
+(defun make-segment-body ()
+ ;; todo
+ )
+(defun make-poly-body ()
+ ;; todo
+ )
+(defun make-rectangle-body ()
+ ;; todo
+ )
View
@@ -171,4 +171,11 @@
:world-collision-callback
:collide
:defcollision
+
+ ;; convenience
+ :make-rectangle
+ :make-circle-body
+ :make-segment-body
+ :make-poly-body
+ :make-rectangle-body
))

0 comments on commit ccf9c50

Please sign in to comment.