Mercurial > hg > indyvon
changeset 24:c17e3588ede9
Change argument order in draw!
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Mon, 21 Jun 2010 00:54:45 +0400 |
parents | bbe95838fe77 |
children | 07ee065cbb3e |
files | src/indyvon/component.clj src/indyvon/core.clj |
diffstat | 2 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/indyvon/component.clj Sun Jun 20 04:23:28 2010 +0400 +++ b/src/indyvon/component.clj Mon Jun 21 00:54:45 2010 +0400 @@ -23,7 +23,7 @@ :font-context (.getFontRenderContext graphics) :update-fn #(.repaint component))] (.clearRect graphics 0 0 width height) - (draw! context layer graphics 0 0 width height false)) + (draw! layer context graphics 0 0 width height false)) (commit (:dispatcher context))) (defn preferred-size [component layer context] @@ -75,8 +75,8 @@ (render! [this context g] (.setColor g Color/YELLOW) (.fillRect g 0 0 (:width context) (:height context)) - (draw! context layer1b g 10 5) - (draw! context layer1 g 55 5)) + (draw! layer1b context g 10 5) + (draw! layer1 context g 55 5)) (size [this context] [70 65]) MouseHandler (handle-mouse [this context event] @@ -96,7 +96,7 @@ (reify Layer (render! [this c g] - (draw! c @fl g) + (draw! @fl c g) (dosync (alter frames + 1) (let [time (System/currentTimeMillis) @@ -113,9 +113,9 @@ ;;(update context) (.setColor g (rand-nth [Color/BLACK Color/BLUE Color/RED])) (.drawLine g 0 0 (:width context) (:height context)) - (draw! context layer2 g 15 20) - (draw! context layer3 g 100 100 80 50) - (draw! context fps g)) + (draw! layer2 context g 15 20) + (draw! layer3 context g 100 100 80 50) + (draw! fps context g)) (size [this context] [400 300]))) (doto frame
--- a/src/indyvon/core.clj Sun Jun 20 04:23:28 2010 +0400 +++ b/src/indyvon/core.clj Mon Jun 21 00:54:45 2010 +0400 @@ -52,19 +52,19 @@ (defn draw! "Render layer in a new graphics context." - ([context layer graphics] - (draw! context layer graphics + ([layer context graphics] + (draw! layer context graphics 0 0 (:width context) (:height context))) - ([context layer graphics x y] - (draw! context layer graphics x y true)) - ([context layer graphics x y clip] + ([layer context graphics x y] + (draw! layer context graphics x y true)) + ([layer context graphics x y clip] (let [s (size layer context)] - (draw! context layer graphics + (draw! layer context graphics x y (s 0) (s 1) clip))) - ([context layer graphics x y w h] - (draw! context layer graphics + ([layer context graphics x y w h] + (draw! layer context graphics x y w h true)) - ([context layer graphics x y w h clip] + ([layer context graphics x y w h clip] (let [context (assoc context :layer layer :parent context @@ -99,7 +99,7 @@ (.setColor g (-> c :theme :border-color)) (doseq [i (range 0 width)] (.drawRect g i i (- w 1 i i) (- h 1 i i))) - (draw! c content g offset offset (- w offset offset) + (draw! content c g offset offset (- w offset offset) (- h offset offset)))) (size [l c] (let [s (size content c)] @@ -190,7 +190,7 @@ :bottom (alter y + (- @last-height height))) (ref-set last-width width) (ref-set last-height height)) - (draw! c content g + (draw! content c g (- 0 @x (anchor 0)) (- 0 @y (anchor 1))))) (size [layer c] (size content c))