From 54a3a321eb27091d9cf2d3a42a0a43903b556ef4 Mon Sep 17 00:00:00 2001 From: Abhinav Sarkar Date: Wed, 16 Oct 2013 19:24:43 +0530 Subject: [PATCH] Updated the signal diagram --- src/cljs/frpong/core.cljs | 47 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/cljs/frpong/core.cljs b/src/cljs/frpong/core.cljs index 8f6a288..ddae46e 100644 --- a/src/cljs/frpong/core.cljs +++ b/src/cljs/frpong/core.cljs @@ -6,28 +6,33 @@ (:require-macros [cljs.core.async.macros :as m :refer [go]] [frpong.core :refer (go-loop)])) ;; -;; Signal Diagram +;; Signal Diagram ;; -;; +---------------------+ -;; | +-------------+ | -;; | | | | -;; v v | | -;; +----------+ vel-chan | | -;; +-->|c-detector+----------+ | -;; | +----------+ | | -;; | +-----------------+ | -;; | | +-----------------+ -;; | | | | -;; | v v | -;; +---------+ frame-chan +------+ tick-chan | +----------+ pos-chan | -;; |frame-gen+------------>|ticker+-----------+-->|positioner+--------------+ -;; +---------+ +------+ +----------+ | -;; +---------------------+ -;; | -;; v -;; +----------+ -;; | renderer | -;; +----------+ +;; +-d-----------+--------------------------+ +;; v | | +;; keyboard +-e-> sampler +---k---> paddle-postnr +-d-+ +-> gravitation +--+ | +;; ^ | p a | +;; t | | | | +;; | | | | | +;; +-------+ +-p----------+-|---+ | d +;; | | +-a-------|-|------+---------------+ | +;; | v v | | | v +;; browser +-f--> ticker +-+--t--> ball-postnr +-p-+-|------|------------p-> renderer +;; ^ | ^ | | | ^ ^ +;; Signals | | +-----|---------+ | | | | +;; ------- s | | l +--d--+ | s t +;; e: keyboard events | | | +-+-----|-------+ | | | +;; k: keydowns | | p l +-a-|-------|----+ | | +;; f: frames | | v v v v +-l--+ | | +;; t: ticker | +---t-> collision-detr | | +;; p: ball position | | ^ +-s--+-----------------------+ | +;; 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 sqrt [x] (.sqrt js/Math x))