Last active
August 29, 2015 14:04
-
-
Save verma/3fb02dcad9a6bc3e972a to your computer and use it in GitHub Desktop.
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
;; How I am requiring the macros: | |
;; core.cljs | |
(ns pre-k-adventures.core | |
(:require [pre-k-adventures.util :as util] | |
[cljs.core.match]) | |
(:require-macros [cljs.core.match.macros :refer [match]] | |
[pre-k-adventures.macros :refer [offset-rand]])) | |
;; usage some where in core.cljs | |
;; | |
(fn [ctx img x y] | |
(blit-cell! ctx img 3 10 1 2 (offset-rand x 20) (offset-rand (- y 1) 4)) | |
(blit-cell! ctx img 0 10 1 2 x (- y 1)) | |
(blit-cell! ctx img 1 10 1 2 (offset-rand x 16) (offset-rand (- y 1) 10))) | |
;; macros.clj | |
(ns pre-k-adventures.macros) | |
(defmacro offset-rand [x by] | |
`(pre-k-adventures.util/offset-by ~x (- by (rand-int (* 2 by))))) | |
;; lein cljsbuild once (line 71 is where the macro is being used in core.cljs) | |
Compiling "js/main.js" from ["src"]... | |
WARNING: No such namespace: pre-k-adventures.macros at line 71 src/pre_k_adventures/core.cljs | |
WARNING: No such namespace: pre-k-adventures.macros at line 71 src/pre_k_adventures/core.cljs | |
WARNING: No such namespace: pre-k-adventures.macros at line 71 src/pre_k_adventures/core.cljs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment