diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-30 10:05:21 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-30 10:05:21 -0500 |
commit | 749a5a306deacd5c481ecc4c53b7f03178c3e335 (patch) | |
tree | bdfef3b82a72dbfbea85ff013013362ef3baf75d /examples/04-a-button.lisp | |
parent | 98b5811d8b50d20f8c15e9b202f0d3f0457df58b (diff) |
[add] button unit and [example]; [modify] scale-by is now defun
Diffstat (limited to 'examples/04-a-button.lisp')
-rw-r--r-- | examples/04-a-button.lisp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/04-a-button.lisp b/examples/04-a-button.lisp new file mode 100644 index 0000000..85d2e83 --- /dev/null +++ b/examples/04-a-button.lisp @@ -0,0 +1,33 @@ +;;;; examples/04-a-button.lisp + +(defpackage #:ww.example/4 + (:use #:cl) + (:export #:start)) + +(in-package #:ww.example/4) + +(defclass app-with-buttons (ww::application) ()) + +(defmethod ww::boot ((app app-with-buttons)) + (let ((b + (ww::make-texture-button + "Fezghoul.png" "GelatinousCube.png" + :pressed (lambda (button) (format t "Button ~a was clicked!~%" button)) + :released (lambda (button) (format t "Button ~a was relased!~%" button ))))) + (setf (ww::x b) 100 + (ww::y b) 100) + + (ww::scale-by b 4.0) + + (ww::add-unit app b))) + +(defun start () + (ww::start (make-instance + 'app-with-buttons + :fps 30 + :width 800 + :height 600 + :title "Wheelwork Example: A Button" + :asset-root (merge-pathnames + "examples/" + (asdf:system-source-directory :wheelwork))))) |