vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.41k stars 67 forks source link

Input methods do not seem to work #167

Closed ptillemans closed 7 months ago

ptillemans commented 7 months ago

I could not get inputs to work on my side project. To avoid issues related to my writings I replicated with the issue by following the tutorial in the README. When trying to follow along with the tutorial I cannot get the input methods to work

❯ sbcl 
This is SBCL 2.1.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload :sketch)
To load "sketch":
  Load 1 ASDF system:
    sketch
; Loading "sketch"
.............
(:SKETCH)
* (defpackage :tutorial (:use :cl :sketch)
)
#<PACKAGE "TUTORIAL">
* (in-package :tutorial)
#<PACKAGE "TUTORIAL">
* (defsketch input-test
   ((title "Hello, input")
    (rectangles nil))
 (loop for (x y) in rectangles
       do (rect x y 50 50)))
(defmethod on-click ((window input-test) x y)
  (with-slots (rectangles) window
    (push (list x y) rectangles)))#<STANDARD-CLASS TUTORIAL::INPUT-TEST>
* 
#<STANDARD-METHOD TUTORIAL::ON-CLICK (INPUT-TEST T T) {1002AC7673}>
* (make-instance 'input-test)
#<INPUT-TEST {1002AC9153}>

The gray window appears but nothing happens when clicking. Adding a format to print something shows nothing.

When running the examples using

* (ql:quickload 'sketch-examples)
To load "sketch-examples":
  Load 1 ASDF system:
    sketch-examples
; Loading "sketch-examples"

(SKETCH-EXAMPLES)
* (make-instance 'sketch-examples:life)
#<SKETCH-EXAMPLES:LIFE {1002BE2EC3}>
*

I can flip the cells and make it run so at least on-text and 'on-click` seem to work on my system, so it seem to exclude things in the desktop stack.

I am also a bit confused by the discrepancy between quicklisp versions and project versions but that is probably because I have not wrapped my head around this part.

Kevinpgalligan commented 7 months ago

I can't check right now, but I think the quicklisp version is not in sync with the repo. So you could switch to the ultralisp distribution, or clone the repo into your quicklisp local-projects to guarantee that you have the latest version.

ptillemans commented 7 months ago

I did try before logging the ticket that without effect. I then got medieval on quicklisp and burned with fire all files and directories related to sketch, git cloned in local-project. Copied indigo to blue and exported that, just to be sure I was getting the right version and reran the tutorial (with blue this time) and that worked. I tried my weekend project and that worked too. Thanks for the quick reaction! Sorry for triggering an issue too soon, I am new to CL and a bit lost at the moment.

Kevinpgalligan commented 7 months ago

No worries, it's rather confusing and we should maybe clarify it in the docs somehow!