Updated the signal diagram

This commit is contained in:
Abhinav Sarkar 2013-10-16 19:24:43 +05:30
parent a77bf54274
commit 54a3a321eb

View File

@ -6,28 +6,33 @@
(:require-macros [cljs.core.async.macros :as m :refer [go]] (:require-macros [cljs.core.async.macros :as m :refer [go]]
[frpong.core :refer (go-loop)])) [frpong.core :refer (go-loop)]))
;; ;;
;; Signal Diagram ;; Signal Diagram
;; ;;
;; +---------------------+ ;; +-d-----------+--------------------------+
;; | +-------------+ | ;; v | |
;; | | | | ;; keyboard +-e-> sampler +---k---> paddle-postnr +-d-+ +-> gravitation +--+ |
;; v v | | ;; ^ | p a |
;; +----------+ vel-chan | | ;; t | | | |
;; +-->|c-detector+----------+ | ;; | | | | |
;; | +----------+ | | ;; +-------+ +-p----------+-|---+ | d
;; | +-----------------+ | ;; | | +-a-------|-|------+---------------+ |
;; | | +-----------------+ ;; | v v | | | v
;; | | | | ;; browser +-f--> ticker +-+--t--> ball-postnr +-p-+-|------|------------p-> renderer
;; | v v | ;; ^ | ^ | | | ^ ^
;; +---------+ frame-chan +------+ tick-chan | +----------+ pos-chan | ;; Signals | | +-----|---------+ | | | |
;; |frame-gen+------------>|ticker+-----------+-->|positioner+--------------+ ;; ------- s | | l +--d--+ | s t
;; +---------+ +------+ +----------+ | ;; e: keyboard events | | | +-+-----|-------+ | | |
;; +---------------------+ ;; k: keydowns | | p l +-a-|-------|----+ | |
;; | ;; f: frames | | v v v v +-l--+ | |
;; v ;; t: ticker | +---t-> collision-detr | |
;; +----------+ ;; p: ball position | | ^ +-s--+-----------------------+ |
;; | renderer | ;; l: ball velocity | | s | |
;; +----------+ ;; a: ball acceleration +-----|-------------+-------------+ |
;; d: paddle positions | |
;; s: game state +------------------------------------------------------+
;;
;; All signals except the signal e are at the rate of the signal f. The signal e is at the rate
;; at which the keyboard issues events.
(defn abs [x] (.abs js/Math x)) (defn abs [x] (.abs js/Math x))
(defn sqrt [x] (.sqrt js/Math x)) (defn sqrt [x] (.sqrt js/Math x))