static/manual-en.txt in green_shoes-0.179.0 vs static/manual-en.txt in green_shoes-0.189.0

- old
+ new

@@ -597,14 +597,11 @@ But these are built-in methods (also called: Kernel methods.) Which means no dot! A common one is `alert`: {{{ - #!ruby - Shoes.app do - alert "No dots in sight" - end + alert "No dots in sight" }}} Compare that to the method `reverse`, which isn't a Kernel method and is only available for Arrays and Strings: @@ -630,10 +627,12 @@ '''COLORS''' is a complete list of colors available to the app. '''FONTS''' is a complete list of fonts available to the app. +'''VERSION''' is a Green Shoes version. + {{{ Shoes.app do para VERSION para fg(DIR, red) image File.join(DIR, '../static/gshoes-icon.png') @@ -646,11 +645,11 @@ Pops up a window containing a short message. {{{ #!ruby - Shoes.app{ alert("I'm afraid I must interject!") } + alert "I'm afraid I must interject!" }}} Please use alerts sparingly, as they are incredibly annoying! If you are using alerts to show messages to help you debug your program, try checking out the standard Ruby method `puts` or `p` methods. @@ -660,12 +659,13 @@ Pops up a window and asks a question. For example, you may want to ask someone their name. {{{ #!ruby - # Not yet available - name = ask("Please, enter your name:") + if name = ask("Please, enter your name:") + Shoes.app{para "Welcome, #{name}!"} + end }}} When the above script is run, the person at the computer will see a window with a blank box for entering their name. The name will then be saved in the `name` variable. @@ -676,14 +676,13 @@ then gives you back a Color object. See the `Color` help for some ways you can use this color. {{{ #!ruby - # Not yet available - backcolor = ask_color("Pick a background") + backcolor = ask_color "Pick a background" Shoes.app do - background backcolor + background backcolor end }}} === ask_open_file() » a string === @@ -691,12 +690,12 @@ your folders and lets you select a file to open. Hands you back the name of the file. {{{ #!ruby + filename = ask_open_file Shoes.app do - filename = ask_open_file para File.read(filename) end }}} === ask_save_file() » a string === @@ -704,52 +703,53 @@ Pops up a "Save file..." window, similiar to `ask_open_file`, described previously. {{{ #!ruby - # Not yet available save_as = ask_save_file + Shoes.app do + para save_as + end }}} === ask_open_folder() » a string === Pops up an "Open folder..." window. It's the standard window which shows all of your folders and lets you select a folder to open. Hands you back the name of the folder. {{{ #!ruby - # Not yet available folder = ask_open_folder Shoes.app do para Dir.entries(folder) end }}} === ask_save_folder() » a string === Pops up a "Save folder..." window, similiar to `ask_open_folder`, described -previously. On OS X, this method currently behaves like an alias of -`ask_open_folder`. +previously. {{{ #!ruby - # Not yet available save_to = ask_save_folder + Shoes.app do + para save_to + end }}} === confirm(question: a string) » true or false === Pops up a yes-or-no question. If the person at the computer, clicks '''yes''', you'll get back a `true`. If not, you'll get back `false`. {{{ #!ruby - # Not yet available if confirm("Draw a circle?") - Shoes.app{ oval :top => 0, :left => 0, :radius => 50 } + Shoes.app{ oval top: 0, left: 0, radius: 50 } end }}} === exit() === @@ -784,35 +784,50 @@ Also of interest: the `Shoes::FONTS` constant is a complete list of fonts available to you on this platform. You can check for a certain font by using `include?`. {{{ - Shoes.app do - if Shoes::FONTS.include? "Coolvetica" - alert "Coolvetica is available on this system." - else - alert "You do not have the Coolvetica font." - end -end + if Shoes::FONTS.include? "Coolvetica" + alert "Coolvetica is available on this system." + else + alert "You do not have the Coolvetica font." + end }}} If you have trouble with fonts showing up, make sure your app loads the font before it is used. Especially on OS X, if fonts are used before they are loaded, the font cache will tend to ignore loaded fonts. -=== gray(the numbers: darkness, alpha) » Shoes::Color === +=== gradient(color1, color2) » a range of RGB array === +Builds a linear gradient from two colors. For each color, you may pass in +a color/rgb method or a string describing the color. The `gradient(green, red)` is +the same as `green..red` for example. Also possible to use different kind of args +like this: `gradient(green, '#FA3')` + +{{{ + Shoes.app do + oval 100, 100, 100, fill: gradient(green, '#FA3'), angle: 45 + end +}}} + +=== gray(the numbers: darkness, alpha) » a RGB array === + Create a grayscale color from a level of darkness and, optionally, an alpha level. {{{ - # Not yet available - black = gray(0.0) - white = gray(1.0) + Shoes.app do + nostroke + 11.times do |i| + y = x = 50 + 10 * i + r = 200 - 10 * i + oval x, y, r, fill: gray(1-i*0.1) + end + end }}} - === rgb(red, green, blue, alpha) » an array of decimal numbers === Create a color from red, green and blue components. An alpha level (indicating transparency) can also be added, optionally. @@ -1727,18 +1742,32 @@ allows images and gradients to be used for drawing lines and filling in shapes. Shoes also borrows some animation ideas from Processing and will continue to closely consult Processing's methods as it expands. -=== arc(left, top, width, height, angle1, angle2) » Shoes::Shape === +=== arc(left, top, width, height, angle1, angle2) » Shoes::Oval === Draws an arc shape (a section of an oval) at coordinates (left, top). This method just give you a bit more control than [[oval]], by offering the `:angle1` and `:angle2` styles. (In fact, you can mimick the `oval` method by -setting `:angle1` to 0 and `:angle2` to `Shoes::TWO_PI`.) +setting `:angle1` to 0 and `:angle2` to `2*Math::PI`.) -'''Note:''' Green Shoes doesn't support `arc` method. +{{{ + Shoes.app do + fill yellow..green + stroke red..blue + strokewidth 10 + cap :curve + + a = animate 12 do |i| + @e.remove if @e + r = i * (Math::PI * 0.01) + @e = arc 100, 50, 180, 360, 0, i * (Math::PI * 0.01) + a.stop if r >= 2*Math::PI + end + end +}}} === arrow(left, top, width) » Shoes::Shape === Draws an arrow at coordinates (left, top) with a pixel `width`. @@ -1748,11 +1777,29 @@ Sets the line cap, which is the shape at the end of every line you draw. If set to `:curve`, the end is rounded. The default is `:rect`, a line which ends abruptly flat. The `:project` cap is also fat, but sticks out a bit longer. -'''Note:''' Green Shoes doesn't support `cap` method. +{{{ + Shoes.app do + nofill + strokewidth 20 + stroke green + cap :curve + line 100, 100, 300, 100 + line 100, 250, 300, 300 + cap :rect + line 100, 150, 300, 150 + stroke blue + cap :project + line 100, 200, 300, 200 + line 200, 100, 200, 300 + strokewidth 1 + stroke red + rect 100, 100, 200, 200 + end +}}} === fill(pattern) » pattern === Sets the fill bucket to a specific color (or pattern.) Patterns can be colors, gradients or images. So, once the fill bucket is set, you can draw shapes and @@ -3237,11 +3284,11 @@ Fills the edit line with the characters of `a string`. == Image == -An image is a picture in PNG, JPEG or GIF format. Shoes can resize images or +An image is a picture in PNG, JPEG or GIF format. Green Shoes can resize images or flow them in with text. Images can be loaded from a file or directly off the web. !{:margin_left => 100}man-ele-image.png! To create an image, use the `image` method in a slot: @@ -3251,11 +3298,11 @@ para "Nice, nice, very nice. Busy, busy, busy." image "../static/shoes-manual-apps.png" end }}} -When you load any image into Shoes, it is cached in memory. This means that if +When you load any image into Green Shoes, it is cached in memory. This means that if you load up many image elements from the same file, it'll only really load the file once. You can use web URLs directly as well. @@ -3269,11 +3316,13 @@ When an image is loaded from the web, it's cached on the hard drive as well as in memory. This prevents a repeat download unless the image has changed. (In case you're wondering: Shoes keeps track of modification times and etags just like a browser would.) -Shoes also loads remote images in the background using system threads. So, +'''Note:''' Green Shoes doesn't support the hard drive cache management feature like Red Shoes. + +Green Shoes also loads remote images in the background using system threads. So, using remote images will not block Ruby or any intense graphical displays you may have going on. === full_height() » a number === @@ -3292,14 +3341,18 @@ === path() » a string === The URL or file name of the image. +'''Note:''' Green Shoes doesn't support `path` method. + === path = a string === Swaps the image with a different one, loaded from a file or URL. +'''Note:''' Green Shoes doesn't support `path=` method. + == ListBox == List boxes (also called "combo boxes" or "drop-down boxes" or "select boxes" in some places) are a list of options that drop down when you click on the box. !{:margin_left => 100}man-ele-listbox.png! @@ -3374,17 +3427,19 @@ now. If nothing is selected, `nil` will be the reply. == Progress == Progress bars show you how far along you are in an activity. Usually, a -progress bar represents a percentage (from 0% to 100%.) Shoes thinks of +progress bar represents a percentage (from 0% to 100%.) Green Shoes thinks of progress in terms of the decimal numbers 0.0 to 1.0. !{:margin_left => 100}man-ele-progress.png! -A simple progress bar is 200 pixels wide, but you can use the `:width` style -(as with all Shoes elements) to lengthen it. +A simple progress bar is 150 pixels wide, but you can use the `:width` style +(as with all Green Shoes elements) to lengthen it. +'''Note:''' The minimum size is 150 pixels wide in Green Shoes. + {{{ Shoes.app do title "Progress example" @p = progress left: 10, top: 100, width: width - 20 @@ -3493,10 +3548,12 @@ === focus() » self === Moves focus to the radio. The radio will be highlighted and, if the user hits Enter, the radio will be toggled between its marked and unmarked states. +'''Note:''' Green Shoes doesn't support `focus` method. + == Shape == A shape is a path outline usually created by drawing methods like `oval` and `rect`. !{:margin_left => 100}man-ele-shape.png! @@ -3505,11 +3562,11 @@ == TextBlock == The TextBlock object represents a group of text organized as a single element. A paragraph containing bolded text, for example. A caption containing links and bolded text. (So, a `caption` is a TextBlock type. However, `link` and -`strong` are TextClass types.) !{:margin_left => 100}man-ele-textblock.png! +`strong` are Text types.) !{:margin_left => 100}man-ele-textblock.png! All of the various types of TextBlock are found on the [[Element Element Creation]] page. * [[Element.banner]], a 48 pixel font. @@ -3522,10 +3579,12 @@ === contents() » an array of elements === Lists all of the strings and styled text objects inside this block. +'''Note:''' Green Shoes doesn't support `contents` method. + === replace(a string) === Replaces the text of the entire block with the characters of `a string`. === text() » a string === @@ -3541,43 +3600,50 @@ === to_s() » a string === An alias for [[TextBlock.text]]. Returns a flattened string of all of this TextBlock's contents. +'''Note:''' Green Shoes doesn't support `to_s` method. + == Timers == -Shoes contains three timer classes: the Animation class, the Every class and -the Timer class. Both Animations and Everies loop over and over after they -start. Timers happen once. A one-shot timer. +Green Shoes contains three timers: the animate, every and +timer. Both animate and every loop over and over after they +start. The timer happens once. A one-shot timer. -Animations and Everies are basically the same thing. The difference is that -Animations usually happen many, many times per second. And Everies happen only +The animate and every are basically the same thing. The difference is that +the animate usually happen many, many times per second. And the every happens only once every few seconds or rarely. +The animate and every automatically start themselves. + === start() » self === Both types of timers automatically start themselves, so there's no need to use this normally. But if you [[Timers.stop]] a timer and would like to start it up again, then by all means: use this! +'''Note:''' Green Shoes doesn't support `start` method. + === stop() » self === -Pauses the animation or timer. In the case of a one-shot timer that's already -happened, it's already stopped and this method will have no effect. +Stops the animate or every loop. -=== toggle() » self === +=== pause() » self === -If the animation or timer is stopped, it is started. Otherwise, if it is +Pauses the animate or every loop. If the animate or every loop is stopped, it is started. Otherwise, if it is already running, it is stopped. == Video == Shoes supports embedding of QuickTime, Flash video (FLV), DivX, Xvid and various other popular video formats. This is all thanks to VideoLAN and ffmpeg, two sensational open source libraries. Use the `video` method on a slot to -setup a Shoes::Video object. !{:margin_left => 100}man-ele-video.png! +setup a Shoes::Video object. +'''Note:''' Green Shoes doesn't support any video formats. !{:margin_left => 100}man-ele-video.png! + In addition to video formats, some audio formats are also supported, such as MP3, WAV and Ogg Vorbis. Video support is optional in Shoes and some builds do not support video. For example, video support is unavailable for PowerPC. When you download Shoes, the @@ -3664,7 +3730,7 @@ == FAQ == Hope this helps: * You can join [[http://librelist.com/browser/shoes/ Shoes ML]] and feel free ask your questions. - * [[http://github.com/shoes/shoes/ Official Current Source Code]] is on GitHub. - * [[http://github.com/shoes/shoes/downloads Recent Builds]] for your platform. + * [[https://github.com/ashbb/green_shoes/ Current Source Code]] is on GitHub. + * Green Shoes Gem is on [[http://rubygems.org/gems/green_shoes RubyGems.org]].