Last active
August 28, 2019 18:41
-
-
Save fouric/c01f28d327705f51d97651b133c0e961 to your computer and use it in GitHub Desktop.
what if we had a graphical print function?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defclass graph () | |
((num :initarg :num :accessor num))) | |
(defmethod print-object ((object graph) stream) | |
(sdl2:with-init (:everything) | |
(sdl2:with-window (win :title "graphical print test" :flags '(:shown)) | |
(sdl2:with-renderer (renderer win :flags '()) | |
(sdl2:with-event-loop (:method :poll) | |
(:keydown (:keysym keysym) | |
(when (sdl2:scancode= (sdl2:scancode-value keysym) :scancode-escape) | |
(sdl2:push-event :quit))) | |
(:idle () | |
(sdl2:set-render-draw-color renderer 200 0 200 255) | |
(sdl2:render-clear renderer) | |
(sdl2:render-present renderer)) | |
(:quit () | |
t))))) | |
(format nil "#<GRAPH :NUM ~a>" (num object))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
...this obviously doesn't actually do anything right now, of course - i just wanted to see if it was viable for use in the print-object method