Aside from burning out during yesterdayās article, I am very satisfied with our
now, while my friend Vassil promises me
there is never any such thing as the final coat of paint
in this penultimate article, we will derive an application-frame
with multiple panes and a layout from our single-pane hurkle-frame
to make it a bit more complete-game-y and show off some of McCLIMās convenient features.
Next article, we will put the common lisp app on the steam-software-store-alternative itch.io so we can kind of see turning a lisp repl app into a gui, a more advanced gui, and then distributing it via itch.io (lispgames homed steam software store alternative).
Updated git also I had to add some exports to hurkle/class.lisp
from before since the new frame uses them.
#P"~/common-lisp/hurkle/multipane.lisp"
#|
(eepitch-sbcl)
(eepitch-kill)
(eepitch-sbcl)
|#
(uiop:define-package :hurkle/multipane
(:mix :hurkle/commands :hurkle/frame :hurkle/class
:clim :clim-lisp :cl)
(:export #:hurkle-game #:define-hurkle-game-command #:status-message))
(in-package :hurkle/multipane)
(define-application-frame hurkle-game
(hurkle-frame)
((status-message :initform "commence hurkling" :accessor status-message))
(:panes
(app :application :incremental-redisplay t
:display-function 'display-hurkles)
(title :title :title-string (format nil "McCLIM~%Hurkle Game"))
(int :interactor)
(status :application
:display-function
(lambda (f p) (princ (status-message f) p))))
(:layouts (default (horizontally ()
(1/2 (vertically () title app))
(vertically ()
status
(1/2 int)))))
(:command-table (hurkle-frame)))
(defmethod investigate :before ((obj hurkle-game) row col
&key &allow-other-keys)
(with-slots
(active hurkle-row-col turn)
obj
(when active
(cond
((equal hurkle-row-col `(,row ,col))
(setf (status-message obj)
(format nil "You found the hurkle on turn ~d!"
turn)))))))
If you are from a non secret-alien-technology language, that :before
common lisp object system method qualifier lets me add a side effect before a method runs (defined on a class that is one of the frameās grandparents)).
Ā«notesĀ» (to ā.notesā)
Yes, the table dynamically resizes an entire column when the two-character NW
replaces a ?
. On the other hand, this shows the important feature of a table dynamically resizing its column widths.
Everything could be prettier - I am presenting the defaults, what you get for zero extra work.
Really need to add a hotkey for investigate,
and a new-game button!
Okay, I will add those last two in part 4/4
: Releasing the game.
See you on the Mastodon thread to talk about this everyone.
It is my intent to help share some computer science and software engineering knowledge that got closely tied up with lispās cultural history which, as Kay pointed out, makes it a bit unaccessible - for example, when I was at university, there was a lisp-shaped gaping void in computer scienceās historical record, with lame java apps ostensibly appearing ex nihilo in the late 90s. For this reason, please do share this and share your secret alien technology knowledge with me (on the show and otherwise) and everyone else. It improves the health of the lisp community: Other languages who want to be our replacement certainly arenāt going to do it for us.
By the way, check out mdhughesā scheme hurkle
Miscellany: We got a few articles in Sachaās emacsnews!:
screwlisp proposes kittens