Mercurial > hg > indyvon
changeset 102:fd8fb8a3ff5a
Fixed anchor point calculation, changes in demo/test scene.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Wed, 18 May 2011 21:28:24 +0400 |
parents | 9874107e3e96 |
children | 9b81174f0511 |
files | src/net/kryshen/indyvon/core.clj src/net/kryshen/indyvon/demo.clj |
diffstat | 2 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/net/kryshen/indyvon/core.clj Wed May 18 20:50:49 2011 +0400 +++ b/src/net/kryshen/indyvon/core.clj Wed May 18 21:28:24 2011 +0400 @@ -141,11 +141,11 @@ (let [size (layer-size layer)] (Location. (case h-align - :top 0 + :left 0 :center (/ (:width size) 2) :right (:width size)) (case v-align - :left 0 + :top 0 :center (/ (:height size) 2) :bottom (:height size))))))
--- a/src/net/kryshen/indyvon/demo.clj Wed May 18 20:50:49 2011 +0400 +++ b/src/net/kryshen/indyvon/demo.clj Wed May 18 21:28:24 2011 +0400 @@ -40,7 +40,7 @@ color (if (hovered? id) (.brighter color) color) width (- *width* shadow-offset) height (- *height* shadow-offset)] - (with-color Color/BLACK + (with-color (:shadow-color *theme*) (.fillRect *graphics* shadow-offset shadow-offset width height)) (with-color color (.fillRect *graphics* offset offset width height)) @@ -103,7 +103,7 @@ (animate highlight 0.0 1.0 @animation-speed)) width (- *width* shadow-offset) height (- *height* shadow-offset)] - (with-color Color/BLACK + (with-color (:shadow-color *theme*) (.fillRect *graphics* shadow-offset shadow-offset width height)) @@ -185,9 +185,9 @@ (draw! test-layer3 100 100 80 50) (draw! button1 50 160) (with-rotate (/ Math/PI 6) 250 200 - (draw! button1 200 160)) - (draw! button2 50 250) - (with-bounds 100 200 140 30 + (draw! button1 210 140)) + (draw! button2 100 200) + (with-bounds 180 240 140 30 (draw-button! :button (label "Immediate button" :center :center) #(println "Button clicked!")))) @@ -198,13 +198,17 @@ (def vp (viewport root)) ;; Miniature (rendered asynchronously) -(def vp-miniature (border (viewport-miniature vp 100 75))) +(def vp-miniature (-> vp (viewport-miniature 100 75) border shadow)) ;; Main scene (def scene (fps-layer (decorate-layer vp [_] (draw! vp) + (draw-anchored! + (label (str "Drag mouse to pan," \newline + "use mouse wheel to zoom.")) + :left :bottom 5 (- *height* 5)) (draw! vp-miniature (- *width* 105) 5)))) (defn show-frame [layer] @@ -213,7 +217,6 @@ (.setVisible true))) (defn -main [] - (println "Try to drag the viewport.") (show-frame scene)) (comment