anchor.diff:     (tex-x1 :initarg :tex-x1 :type vec2 :initform (vec2 0.0 0.0))
      (tex-x2 :initarg :tex-x2 :type vec2 :initform (vec2 1.0 0.0))
      (tex-y1 :initarg :tex-y1 :type vec2 :initform (vec2 0.0 1.0))
  -   (tex-y2 :initarg :tex-y2 :type vec2 :initform (vec2 1.0 1.0))))
  +   (tex-y2 :initarg :tex-y2 :type vec2 :initform (vec2 1.0 1.0))
  +
  +   ;; for now we directly couple animation with the rectangle
  +   (animation-state :type animation :initform (make-animation) :reader animation-state)))
  +
   
   ;; TODO: add texture coordinate to initilizations, providing a texture.png
   ;; and a fixed texture coordinate with texatl:with-sprite ?
  
positive.code: 	(vector-push-extend name (keys-in-order seq-hash-table))))
      (setf (gethash name rectangles-container) rectangle)))
  
  
  
  ;; TODO: give nice print representation
  
negative.code:   (let ((rectangle (gethash name (the-table *dynamic-rectangles*))))
      (move-rectangle rectangle direction-vec2)))
  
  
  
  ;;;Animation
  
  
  (defun make-animation ()
    (make-instance 'animation))
  
  (defun change-animation (rectangle new-mode new-direction &optional new-sprite-name)
    (let ((animation-state (animation-state rectangle)))
      (with-slots (sprite-name mode direction) animation-state
        (setf mode new-mode
  	    direction new-direction)
        (when new-sprite-name
  	(setf sprite-name new-sprite-name)))))
  
  ;; (defmethod apply-animation-state ((rectangle rectangle))
  ;;   (let ((animation-state (animation-state rectangle)))
  ;;     (with-slots (sprite-name))
  ;;     (texatl.cl:with-sprite (x0 y0 x1 y1)
  ;; 	*global-spritesheet*)))
  
  (defmethod animate ((rectangle rectangle))
    (when (slot-boundp (slot-value rectangle 'animation-state) 'spritesheet)
      (apply-animation-state rectangle)))
  
  (defun print-animation-state (rectangle)
    (let ((animation-state (slot-value rectangle 'animation-state)))
      (with-slots (start-time frame sprite-name mode direction default-animation)
  	animation-state
        ;; TODO: make a neat table
        (format t "~&start-time:~a ~&frame:~a ~&sprite:~a ~&mode~a ~&direction:~a ~&default:~a~%"
  	      start-time frame sprite-name mode direction default-animation))))
  
  ;; TODO: delete
  (defun tex (rectangle)
    (with-slots (tex-x1 tex-x2 tex-y1 tex-y2) rectangle
      (list tex-x1 tex-x2 tex-y1 tex-y2)))
  
  ;;Test data---------------------------------------------------------------------
  
  ;; TODO: remove this test data
  (when (< (hash-table-count (the-table *dynamic-rectangles*)) 1)
    (add-rectangle-as :hero (make-rectangle)))
  
  