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 diff
     1.1 --- a/src/indyvon/component.clj	Sun Jun 20 04:23:28 2010 +0400
     1.2 +++ b/src/indyvon/component.clj	Mon Jun 21 00:54:45 2010 +0400
     1.3 @@ -23,7 +23,7 @@
     1.4                    :font-context (.getFontRenderContext graphics)
     1.5                    :update-fn #(.repaint component))]
     1.6      (.clearRect graphics 0 0 width height)
     1.7 -    (draw! context layer graphics 0 0 width height false))
     1.8 +    (draw! layer context graphics 0 0 width height false))
     1.9    (commit (:dispatcher context)))
    1.10  
    1.11  (defn preferred-size [component layer context]
    1.12 @@ -75,8 +75,8 @@
    1.13            (render! [this context g]
    1.14               (.setColor g Color/YELLOW)
    1.15               (.fillRect g 0 0 (:width context) (:height context))
    1.16 -             (draw! context layer1b g 10 5)
    1.17 -             (draw! context layer1 g 55 5))
    1.18 +             (draw! layer1b context g 10 5)
    1.19 +             (draw! layer1 context g 55 5))
    1.20            (size [this context] [70 65])
    1.21            MouseHandler
    1.22            (handle-mouse [this context event]
    1.23 @@ -96,7 +96,7 @@
    1.24             (reify
    1.25              Layer
    1.26              (render! [this c g]
    1.27 -               (draw! c @fl g)
    1.28 +               (draw! @fl c g)
    1.29                 (dosync
    1.30                  (alter frames + 1)
    1.31                  (let [time (System/currentTimeMillis)
    1.32 @@ -113,9 +113,9 @@
    1.33               ;;(update context)
    1.34               (.setColor g (rand-nth [Color/BLACK Color/BLUE Color/RED]))       
    1.35               (.drawLine g 0 0 (:width context) (:height context))
    1.36 -             (draw! context layer2 g 15 20)
    1.37 -             (draw! context layer3 g 100 100 80 50)
    1.38 -             (draw! context fps g))
    1.39 +             (draw! layer2 context g 15 20)
    1.40 +             (draw! layer3 context g 100 100 80 50)
    1.41 +             (draw! fps context g))
    1.42             (size [this context] [400 300])))
    1.43      
    1.44      (doto frame
     2.1 --- a/src/indyvon/core.clj	Sun Jun 20 04:23:28 2010 +0400
     2.2 +++ b/src/indyvon/core.clj	Mon Jun 21 00:54:45 2010 +0400
     2.3 @@ -52,19 +52,19 @@
     2.4  
     2.5  (defn draw!
     2.6    "Render layer in a new graphics context."
     2.7 -  ([context layer graphics]
     2.8 -     (draw! context layer graphics
     2.9 +  ([layer context graphics]
    2.10 +     (draw! layer context graphics
    2.11                      0 0 (:width context) (:height context)))
    2.12 -  ([context layer graphics x y]
    2.13 -     (draw! context layer graphics x y true))
    2.14 -  ([context layer graphics x y clip]
    2.15 +  ([layer context graphics x y]
    2.16 +     (draw! layer context graphics x y true))
    2.17 +  ([layer context graphics x y clip]
    2.18       (let [s (size layer context)]
    2.19 -       (draw! context layer graphics
    2.20 +       (draw! layer context graphics
    2.21                x y (s 0) (s 1) clip)))
    2.22 -  ([context layer graphics x y w h]
    2.23 -     (draw! context layer graphics
    2.24 +  ([layer context graphics x y w h]
    2.25 +     (draw! layer context graphics
    2.26              x y w h true))
    2.27 -  ([context layer graphics x y w h clip]
    2.28 +  ([layer context graphics x y w h clip]
    2.29       (let [context (assoc context
    2.30                       :layer layer
    2.31                       :parent context
    2.32 @@ -99,7 +99,7 @@
    2.33               (.setColor g (-> c :theme :border-color))
    2.34               (doseq [i (range 0 width)]
    2.35                 (.drawRect g i i (- w 1 i i) (- h 1 i i)))
    2.36 -             (draw! c content g offset offset (- w offset offset)
    2.37 +             (draw! content c g offset offset (- w offset offset)
    2.38                      (- h offset offset))))
    2.39          (size [l c]
    2.40             (let [s (size content c)]
    2.41 @@ -190,7 +190,7 @@
    2.42                   :bottom (alter y + (- @last-height height)))
    2.43             (ref-set last-width width)
    2.44             (ref-set last-height height))
    2.45 -          (draw! c content g
    2.46 +          (draw! content c g
    2.47                   (- 0 @x (anchor 0))
    2.48                   (- 0 @y (anchor 1)))))
    2.49       (size [layer c] (size content c))