Mercurial > hg > indyvon
changeset 77:1ca7872b889b
Rename text-layer to label.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Tue, 31 Aug 2010 02:20:24 +0400 |
parents | dafd4ff9d313 |
children | 4c0f2af742ba |
files | README.ru src/net/kryshen/indyvon/demo.clj src/net/kryshen/indyvon/layers.clj |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/README.ru Mon Aug 30 21:56:14 2010 +0400 +++ b/README.ru Tue Aug 31 02:20:24 2010 +0400 @@ -47,7 +47,7 @@ "сейчас нарисовать здесь кнопку") или описываться путем композиции слоев (предполагая, что реализованы функции border, vbox, text и button, которые создают слои): - (border (hbox (text "Comment:") (button (text "Button")))) + (border (hbox (label "Comment:") (button (label "Button")))) Отрисовку можно распараллелить с помощью функции async-layer, которая возвращает слой, показывающий результат отрисовки слоя-аргумента. При
--- a/src/net/kryshen/indyvon/demo.clj Mon Aug 30 21:56:14 2010 +0400 +++ b/src/net/kryshen/indyvon/demo.clj Tue Aug 31 02:20:24 2010 +0400 @@ -61,7 +61,7 @@ (def layer2m (miniature layer2 30 30)) -(def layer3 (border (text-layer "Sample\ntext" :right :center))) +(def layer3 (border (label "Sample\ntext" :right :center))) (def layer (reify
--- a/src/net/kryshen/indyvon/layers.clj Mon Aug 30 21:56:14 2010 +0400 +++ b/src/net/kryshen/indyvon/layers.clj Tue Aug 31 02:20:24 2010 +0400 @@ -147,10 +147,10 @@ (.getLeading tl))) 0 layouts)) -(defn text-layer +(defn label "Creates a layer to display multiline text." ([text] - (text-layer text :left :top)) + (label text :left :top)) ([text h-align v-align] (let [lines (re-split #"\r\n|\n|\r|\u0085|\u2028|\u2029" text)] (reify Layer @@ -302,7 +302,7 @@ fps (/ @frames elapsed)] (when (or (> elapsed update-interval) (not @display)) (ref-set display - (border (text-layer (format "%.1f" fps) :right :bottom) 0 5)) + (border (label (format "%.1f" fps) :right :bottom) 0 5)) (ref-set frames 0) (ref-set prev-time time))) @display)))))