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
(ns fish.core | |
(:use [arcadia.core] [hard.core] [hard.tween])) | |
(def ccol (objects-named "colcube")) | |
(defn cc-tween [go] | |
(let [[x y z] (->vec (->v3 go)) | |
start (tween (* (+ 12 x) 0.1)) | |
shrink (tween {go {:local-scale [50 50 50]}} 0.1) | |
grow (tween {go {:local-scale [100 100 100]}} 0.1) |
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
(ns flock | |
(:use hard.core hard.input hard.spatial) | |
(:import [UnityEngine])) | |
(declare pump initial make-boid) | |
(def FLOCKS (atom {})) | |
(def HASH (bucket-hash 10)) | |
(arcadia.core/defcomponent Boid |
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
(ns snake.core | |
(:use | |
[arcadia.core] | |
[hard.core] | |
[hard.input] | |
[hard.tween])) | |
(declare get-input) | |
(arcadia.core/defcomponent Pumper [] |
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
(html | |
(<div> | |
(class (? mousedown "noselect")) | |
(render-count :bg "pink") | |
(om/build style-options data {}) | |
(<div.tabs> | |
(mapf [k] | |
(<div.label> | |
(class (when= tab k "active")) | |
(style {:width tabwidth}) |
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
(defmacro deftween [sym props getter valuer & setter] | |
(let [[start duration value target relative ratio uid] props | |
dot-duration (symbol (str "." duration)) | |
dot-start (symbol (str "." start)) | |
dot-value (symbol (str "." value)) | |
[_ [this] get-more] getter |
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
user=> (require 'hard.hooks) | |
nil | |
user=> hard.hooks/MouseDown | |
System.InvalidOperationException: No such var: hard.hooks/MouseDown | |
at clojure.lang.Compiler.ResolveIn (clojure.lang.Namespace n, clojure.lang.Symbol symbol, Boolean allowPrivate) [0x00000] in <filename unknown>:0 | |
at clojure.lang.Compiler.Resolve (clojure.lang.Symbol symbol) [0x00000] in <filename unknown>:0 | |
at clojure.lang.Compiler.AnalyzeSymbol (clojure.lang.Symbol symbol) [0x00000] in <filename unknown>:0 | |
at clojure.lang.Compiler.Analyze (clojure.lang.CljCompiler.Ast.ParserContext pcontext, System.Object form, System.String name) [0x00000] in <filename unknown>:0 , compiling: (NO_SOURCE_PATH:0:0) | |
user=> (use 'hard.hooks) |
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
;Infix macro | |
(def ^:private ordered-ops ['* '/ '+ '-]) | |
(defn ^:private non-op? [x] (if ((set ordered-ops) x) false true)) | |
(defn ^:private num-or-seq? [e] (or (number? e) (sequential? e))) | |
(defn ^:private group [col op] | |
(let [pass1 (partition-by #(or (non-op? %) (= op %)) col)] | |
(map |
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
(ns tween.core | |
(:require arcadia.core clojure.string) | |
(:import [UnityEngine Color Vector3 GameObject Color])) | |
;TODO | |
;[ ] deftween fn for +'ing target and value for relative target | |
;[ ] link! protocol for adding callbacks | |
;[ ] callback should handle sequences | |
;[ ] delay functionality (in link! ?) |
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
(ns farm.core | |
(:use | |
[arcadia.core] | |
[hard.core] | |
[hard.physics] | |
[hard.input] | |
[tween.core :as tween] | |
[hard.edit :only [active]] | |
[farm.invaders :as invaders]) | |
(:import |
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
(defmacro deftween [sym props & methods ] ;getter valuer & setter | |
(let [{:keys [getter valuer setter adder]} (conj default-methods (into {} (map sort-methods methods))) | |
compsym (symbol (str sym "_tween")) | |
res-props (concat '[^boolean active ^System.Double delay ^System.Double start ^System.Double duration ^boolean relative ^float ratio ^int uid | |
getfn addfn easefn easesig] props) | |
[[this] get-more] getter | |
[[this-v] value-more] valuer | |
getterfn (cons 'fn getter) | |
set-more (or setter (list 'set! get-more value-more))] | |
`(do |