Skip to content

Instantly share code, notes, and snippets.

@W-Net-AI
Created August 12, 2014 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save W-Net-AI/127c3d706719264f061d to your computer and use it in GitHub Desktop.
Save W-Net-AI/127c3d706719264f061d to your computer and use it in GitHub Desktop.
(defun set-br (self val)
(let ((rect-x (@ self :int))
(rect-y (@ self :int 1))
(rect-width (@ self :int 2))
(rect-height (@ self :int 3))
(point-x (@ val :int))
(point-y (@ val :int 1))
(new-x)
(new-y))
(if (>= point-x rect-x)
(setf new-x (- point-x rect-width)))
(if (>= point-y rect-y)
(setf new-y (- point-y rect-height)))
(if (<= point-x rect-x)
(setf new-x (- point-x rect-width)))
(if (<= point-y rect-y)
(setf new-y (- point-y rect-height)))
(rect new-x new-y rect-width rect-height)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment