Created
April 29, 2012 18:53
-
-
Save mistercam/2552638 to your computer and use it in GitHub Desktop.
A Reversi sketch
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
(defn setup [] | |
"Configures the properties of our sketch." | |
(smooth) ; turns on anti-aliasing | |
(frame-rate fps) ; the number of times per second we'll redraw the board | |
(apply background color-black)) ; sets the background | |
(defn reversi-quil [] | |
"Starts a quil-based Reversi game." | |
(let [board (atom (initialize-board)) | |
piece (atom :b ) | |
game-over (atom false) | |
msg (atom [0 nil])] | |
(defsketch reversi ; Define a new Reversi sketch | |
:title "Reversi" | |
:setup setup ; specifies the function used to initializes the sketch | |
:draw (partial draw-board board piece msg) ; specifies the draw function | |
:mouse-clicked (partial mouse-clicked board piece game-over msg) ; specifies the mouse clicked handler | |
:size [board-size (+ board-size footer-height)]))) ; specifies the size of the sketch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment