(5.5.0) scribble_get_quad - JujuAdams/ScribbleOldDocs GitHub Wiki

scribble_get_quad(string/textElement, x, y, [leftPad], [topPad], [rightPad], [bottomPad])

Returns: 8-element array containing 4 coordinates pairs, which are the positions of each corner of the textbox (use the SCRIBBLE_QUAD enum to get each coordinate pair)

Argument Name Purpose
0 string/textElement Either:1. A string2. A previously created text element
1 x x-position in the room to draw at
2 y y-position in the room to draw at
[3] [leftPad] Extra space on the left-hand side of the textbox. Positive values create more space. Defaults to 0
[4] [topPad] Extra space on the top of the textbox. Positive values create more space. Defaults to 0
[5] [rightPad] Extra space on the right-hand side of the textbox. Positive values create more space. Defaults to 0
[6] [bottomPad] Extra space on the bottom of the textbox. Positive values create more space. Defaults to 0

The padding arguments can be given the value undefined to indicate that the default value should be used.

The array returned by scribble_get_quad() has 8 elements organised into 4 pairs of values. Taken together, these 4 coordinate pairs give the exact position of each corner of the textbox, even after it has been rotated/scaled etc.

The SCRIBBLE_QUAD enum exists to help unpack the array that scribble_get_quad() returns:

enum SCRIBBLE_QUAD
{
    X0, Y0, //Top left corner
    X1, Y1, //Top right corner
    X2, Y2, //Bottom left corner
    X3, Y3, //Bottom right corner
    __SIZE
}

Thus the pair { array[SCRIBBLE_QUAD.X2], array[SCRIBBLE_QUAD.Y2] } gives the bottom-left corner of the textbox.