code-dot-org/blockly — pull request #603 by cpirich (2014-05-22 22:22:51+00:00)
Title: [#70329988] add show title screen block

Added a "show title screen" block that can be used as a cover page, splash screen, and other place to explain your story or game. This block shows a title at the top of the play space and a box with instruction text in the middle of the play space. It also automatically displays one sprite centered in the bottom of the play space (assuming that the user used a setSprite block to set an actor to a specific image). We always show the first type of actor referenced at the bottom of the title screen - non-configurable, but cool "magic" without requiring extra parameters. The sprite is transported to the bottom of the screen and then transported back to the previous position/image/direction when the title screen goes away. The title screen stays up for 5 seconds or until the user clicks on the play space. It draws over-top of whatever is on the screen. If you use it at the start of the story, there is no work required. If you use it in mid-story, you may want to hide actors, but you don't have to. Other code can continue to run while the title screen is visible (e.g. you can animate actors at the bottom of the play space). If the the magically transported sprite is moved or changed through other event handlers while the title screen is active, it is not restored to its previous state when the title screen is dismissed.

In the future, we will use the first title screen as the "cover page" for sharing studio creations on social network sites and in the gallery.

Refactored all of the long-running blocks (except moveDistance) to set the same opts.complete property when they are done.

Refactored the wait and waitForClick code a little so it can be shared with the title screen block. There is now an optional waitCompleteCallback that can be added to cleanup at the end of a wait.

Refactored setSpeechText as setSvgText so it can be used for the title screen instructions that also require the same text wrapping logic.

Modified the speech bubbles to have a maximum of 4 lines of text instead of 2 per earlier discussion with Mona. Moved the default "say" text into blocks.js so it isn't needed on a per-level basis in levels.js.

Fixed styling for svg text elements so the cursor is the normal pointer (default) when hovering over them instead of an insertion point.