This file contains 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
(in-package :famiclom) | |
;; Launch an sdl-window. After Pressing R, the inputs are polled and | |
;; then. displayed in the window or written to stdout. | |
(defvar *last-key-pressed* nil) | |
(defclass pad () | |
((a :initform nil :accessor button-a |
This file contains 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
(in-package :famiclom) | |
;; Launch an sdl-window. After Pressing p, the inputs are polled and | |
;; then. displayed in the window or written to stdout. | |
(defstruct pad | |
(buttons (make-array 8 :element-type 'boolean :initial-element nil)) | |
(strobe '(:a :b :select :start :up :down :left :right)) | |
(index 0 :type fixnum)) ;; Used for strobe method |
This file contains 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
(defun play-rom (file) | |
(reset *nes*) | |
(load-rom file) | |
(sdl:with-init (sdl:sdl-init-video sdl:sdl-init-audio) | |
(sdl:window 256 240 :bpp 24 :sw t) | |
(sdl:enable-key-repeat 10 10) | |
(sdl:with-events (:poll) | |
(:quit-event () t) | |
(:key-down-event | |
(:key key-pressed) |
This file contains 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
(defun profile! (&optional (mode :time)) | |
(reset *nes*) | |
(load-rom "/home/puercopop/quicklisp/local-projects/famiclom/roms/smb.nes") | |
(sb-sprof:with-profiling (:sample-interval 0.001 | |
:alloc-interval 2 | |
:max-samples 1000 | |
:show-progress t | |
:report :graph | |
:mode :time | |
:reset t) |
This file contains 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
(in-package :famiclom) | |
(defun get-byte-input% (addr) | |
(declare (ignore addr)) | |
(format t "Reading button ~A: ~A~%" (first (pad-strobe *pad*)) (get-state *pad*)) | |
(prog1 (get-state *pad*) | |
(next-state *pad*))) | |
(let ((last-input 0)) |
This file contains 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
(in-package :famiclom) | |
(require 'sb-sprof) | |
(defun check-for-input () | |
(let ((event (sdl:new-event))) | |
(loop | |
;; Pops the event-queue and binds it to event, return 0 if no pending | |
;; events. | |
:for event-poll = (sdl-cffi::SDL-Poll-event event) |
This file contains 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
(defpattern sdl-event (type key state) | |
`(and (sdl:event-type (type (eq ,type))) | |
(sdl::key-key (key (eq ,key)) ,state))) | |
(setf (fdefinition 'event-typep) #'sdl:key-down-p) | |
(sdl:with-init (sdl:sdl-init-video) | |
(sdl:window 256 240 :bpp 24 :sw t) | |
(sdl:enable-key-repeat 10 10) | |
(unwind-protect (let ((event (sdl:new-event))) |
This file contains 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
(setq shoes-off-config | |
`((:username ,(getenv "rcirc_bouncer_username") | |
:password ,(getenv "rcirc_bouncer_password") | |
:server-alist (("irc.freenode.net" | |
:nick "PuercoPop" | |
:port 6667 | |
:user-name "PuercoPop" | |
:password "NinjaKittens" | |
:full-name "Full Name" | |
:channels ("#emacs" "#lisp" "#limajs" "#python.pe")))))) |
This file contains 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
#!/usr/bin/cl -Q -sp coleslaw --entry entry | |
;;;; | |
;; This script assumes it is executed from the repository's top level directory | |
;; to determine correctly the blog-dir variable. | |
;;;; | |
;; (coleslaw:preview #P"/home/puercopop/Projects/RunaRimac/hello-world.md") | |
(defun entry (argv) | |
(declare (ignorable argv)) | |
(let |
This file contains 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
LISPKIT> (load-ui-from-file (asdf:system-relative-pathname :lispkit "main.ui")) | |
#<GTK-BUILDER {10070732D3}> | |
LISPKIT> (gtk:gtk-builder-get-object #<GTK-BUILDER {10070732D3}> "webviewcontainer" ) | |
NIL | |
LISPKIT> (gtk:gtk-builder-get-object #<GTK-BUILDER {10070732D3}> "mainwindow" ) | |
NIL | |
LISPKIT> (asdf:system-relative-pathname :lispkit "main.ui") | |
#P"/home/puercopop/quicklisp/local-projects/lispkit/main.ui" | |
LISPKIT> (gtk:gtk-builder-get-object #<GTK-BUILDER {10070732D3}> "scrolledwindow" ) | |
NIL |