Drawing Utilities Extension
Welcome to Graphics Central! With the Drawing Utilities Extension, you can draw polygons and stars, wedges and curves, and rotated rectangles, ellipses, and lines. You can also control letter spacing, get the current drawing color, opacity, font and more!
Works on all platforms (Flash, HTML5, Desktop, and Mobile).
Designed to work with Stencyl 3.4+. Some blocks may not work with older versions of Stencyl.
All Features- draw/fill regular polygons and stars
- draw/fill wedges, chords, and rings
- draw/add arcs to polygons
- draw bezier curves
- draw/fill rotated ellipses, rectangles and lines
- get an x/y value from a rotated line
- draw left/center/right aligned text
- get a current drawing value (e.g., color, stroke thickness, font...)
- choose a color or font
- get/set letter spacing of a font
Download for 3.4+(
How to Install and Update an Extension)
(Legacy downloads:
3.1,
3.2/3.3. Please note that these are no longer being maintained.)
(
View on GitHub)
(
Sample project by Liberado—try it below!)
If upgrading from the 3.2 version of the extension:1. Install the extension as usual. Note that it will not overwrite the 3.2 version, resulting in two versions of the extension in your folder.
2. For each game you want to upgrade:
a. Open the game.
b. In the Extensions settings, disable the "Drawing Utilities" extension and enable the "Drawing Utilities 3.4+" extension.
c. Save and close the game.
DO NOT open any resources before closing. d. Reopen the game. It should now have successfully upgraded.
Angles How-toAngles are generally defined clockwise from 0-360.
Any of the extension blocks can use any number as the angle. -360 is the same as 0, and 450 is the same as 90.
A 0-degree angle is directly to the right. To draw a polygon facing up, use -90 or 270.
BlocksImportant: All of the blocks that do any drawing are for use in drawing events only. If you try to use them anywhere else, you will get an error.

Draws a regular shape (triangle, square, pentagon...) to the screen.

Draws a regular polygon to the screen.
For sides, any integer more than 2 will work. Non-integer numbers will be floored to an integer.

Draws a star to the screen. The inner and outer radii can be defined in either order.

Draws a rectangle or ellipse, rotated by a certain amount.

Draws a ring to the screen. The order of the radii doesn't matter.

Draws a piece of a ring to the screen.

Draws a wedge (slice of a circle) or a chord (edge section of a circle) to the screen.
The start and end fields are the angles to start and end the wedge/chord at.

Draws an arc to the screen, or adds an arc to the currently drawn polygon. The start and end fields are the same as with the wedge block.

Draws a bezier curve from one point to another, either through the specified midpoint or with the specified control point.

Draws a line with an angle and length, rather than an end point.

This one's a bit tricky to use. It basically calculates the endpoint of a hypothetical line. Here's how to work it:
- Choose whether you want to calculate an x or y coordinate.
- Input the x or y coordinate (depending on what you chose before) from which to start the line calculation.
- After that, specify the angle and length of the line that you want to calculate.
The block will return the x or y of the other end of that line. It's very similar to the previous block, but doesn't draw a line. If you need more info, don't hesitate to ask!

Draws text to the screen. It can be aligned to the left, the center or the right.

Gets one of these drawing values: color, stroke color, stroke thickness, opacity, font, or x/y of pen.

Choose a color or a font. Useful for adding them to lists, or setting 'anything' values.

Sets the spacing (extra distance between letters) of the specified font.

Gets the letter spacing of the specified font.
Version History2.0 (03/04/18)
Combined all drawing code into one file, and significantly condense the code (now about the same length that DrawCircles.hx was before)
Bug fix: draw-arc and draw-wedge blocks sometimes draw the wrong portion of the circle if end > 540
Bug fix: rotated ellipse was drawn at twice the proper size (may break existing code that already accounted for this)
Bug fix: draw-text-aligned block didn't take into account letter spacing
Added draw-bezier block
1.3.2 (09/26/15)
Improvements to the code to draw ellipses. Now draws far fewer points on all but the largest of ellipses (e.g. 160x120 ellipse: 360 -> 60, 30x10 ellipse: 360 -> 18)
1.3.1 (09/25/15)
Bug fix: filling a ring only works on Flash
1.3 (07/07/15)
Combined several blocks to take up less room in the palette
1.2.1 (12/15/14)
Bug fix: Point sometimes added at wrong end of an arc
1.2 (12/13/14)
Updated wedge, arc and ring blocks to include non-whole start/end angles.
Added blocks:
- draw/fill ellipse
- draw left/center/right aligned text
- set spacing for a font (3.2+)
1.1 (11/17/14)
Added blocks:
- draw/fill ring/ring piece
- add arc to polygon
- choose a color/font
1.0 - Initial release (09/20/14)
Blocks:
- draw/fill polygon/star
- draw/fill wedge/chord/arc
- draw/fill rotated rectangle/line
- get x/y endpoint of rotated line
- current [drawing value]
If you have any questions, problems, or suggestions, feel free to post them!
ETH