blob: 82f5a2c5df9a285c223294802a56ac9ced4d6d82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
;;;; examples/04-a-button.lisp
(defpackage #:ww.examples/4
(:use #:cl)
(:export #:start))
(in-package #:ww.examples/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))))
(font
(ww::get-asset "Ticketing.ttf"))
(b2
(ww::make-text-button font "Press Me" "Relase Me")))
(setf (ww::x b) 100
(ww::y b) 100
(ww::x b2) 400
(ww::y b2) 100)
;; make bigger
(ww::scale-by b 4.0)
(ww::scale-by b2 3)
;; add to scene
(ww::add-unit b2)
(ww::add-unit 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)))))
|