Created
April 13, 2016 18:16
-
-
Save lispnik/157b734cb2c51a9659948b16c2eb6d16 to your computer and use it in GitHub Desktop.
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
(ql:quickload "sdl2") | |
(ql:quickload "sdl2-image") | |
(defun run () | |
(sdl2:with-init (:everything) | |
(sdl2:with-window (win :flags '(:shown)) | |
(sdl2:with-renderer (renderer win :flags '(:renderer-accelerated)) | |
(let* ((surface-frames 23) | |
(surface (sdl2-image:load-image "out.png")) | |
(texture (sdl2:create-texture-from-surface renderer surface)) | |
(frame-width (/ (sdl2:texture-width texture) surface-frames)) | |
(frame-height (sdl2:texture-height texture)) | |
(frame 0)) | |
(sdl2:with-event-loop (:method :poll) | |
(:keyup | |
(:keysym keysym) | |
(when (sdl2:scancode= (sdl2:scancode-value keysym) :scancode-escape) | |
(sdl2:push-event :quit))) | |
(:idle | |
() | |
(let ((source-rect (sdl2:make-rect (* frame frame-width) 0 frame-width frame-height))) | |
(sdl2:render-copy renderer texture :source-rect source-rect) | |
(setf frame (mod (1+ frame) surface-frames)) | |
(sdl2:delay 30)) | |
(sdl2:render-present renderer)) | |
(:quit () t))))))) |
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
convert -layers dispose ../Downloads/giphy.gif giphy.gif | |
montage giphy.gif -tile x1 -geometry '1x1+0+0<' out.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment