Skip to content

Instantly share code, notes, and snippets.

@jacobemcken
Last active August 29, 2015 14:12
Show Gist options
  • Save jacobemcken/22d6eb2049a8e5f4ba27 to your computer and use it in GitHub Desktop.
Save jacobemcken/22d6eb2049a8e5f4ba27 to your computer and use it in GitHub Desktop.
Example thats triggers bug (?) in Weasel 0.5.0 upon namespace change
(ns rfgs.core
(:require [weasel.repl :as ws-repl]
[clojure.string :as string]))
(enable-console-print!)
(defonce game-state (atom {})) ; Atom to store the game state
(if-not (ws-repl/alive?)
(do (print "Open REPL")
(ws-repl/connect "ws://localhost:9001"
:verbose true
:print #{:repl :console}
:on-error #(print "Error! " %))))
(defn ^:export init [] ; The entry point into the game from the HTML page
(.log js/console "Launching game")
)
<html>
<head>
<script src="game/out/goog/base.js" type="text/javascript"></script>
<script src="game/rfgs.js" type="text/javascript"></script>
<script type="text/javascript">goog.require("rfgs.core");</script>
</head>
<body>
<canvas id="game-canvas"></canvas>
<script type="text/javascript">
rfgs.core.init();
</script>
</body>
</html>
(defproject rfgs "0.1.0-SNAPSHOT"
:description "FIXME: write a game description"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2665"]
[com.cemerick/piggieback "0.1.5"]
[weasel "0.5.0"]]
:plugins [[lein-cljsbuild "1.0.4"]]
:cljsbuild {
:builds [{
:source-paths ["src"]
:compiler {
:output-to "resources/public/game/rfgs.js"
:output-dir "resources/public/game/out"
:optimizations :none
:pretty-print true}}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment