# renderer

## get\_screen\_size(): vec2\_t

Returns the width and height of the game's window

```
var screen_size = renderer.get_screen_size();
```

## create\_font( identifier, font\_name, size, weight, flags )

Creates a new font object

| Type   | Name       | Description                       |
| ------ | ---------- | --------------------------------- |
| string | identifier | A unique identifier for your font |
| string | font\_name | The font's name                   |
| int    | size       | The font's size                   |
| int    | weight     | The font's weight                 |
| int    | flags      | The font's flags                  |

```
var example_font = renderer.create_font( "my_awesome_font", "Tahoma", 12, 0, font_flags.FONTFLAG_NONE );
```

## text( font, x, y, text, flags, color )

Draws a string at the two given points

| Type     | Name  | Description                               |
| -------- | ----- | ----------------------------------------- |
| object   | font  | The font you want the text to be drawn in |
| int      | x     | The position on the x axis                |
| int      | y     | The position on the y axis                |
| string   | text  | The text you want to draw                 |
| int      | flags | The alignment flags you want to use       |
| color\_t | color | The color you want the text to be         |

```
renderer.text( example_font, 100, 100, "Hello, world!", align_flags.ALIGN_LEFT, new color_t( 255, 255, 255, 255 ) );
```

## get\_text\_size( font, text ): vec2\_t

Returns the width and height of the given string

| Type   | Name | Description                                          |
| ------ | ---- | ---------------------------------------------------- |
| object | font | The font you want the text to eventually be drawn in |
| string | text | The text you want to check the size of               |

```
var text_size = renderer.get_text_size( example_font, "Hello, world!" );
```

## line( x0, y0, x1, y1, color )

Draws a line in the given color between the two given points.

| Type     | Name  | Description                       |
| -------- | ----- | --------------------------------- |
| float    | x0    | Starting position on the x axis   |
| float    | y0    | Starting position on the y axis   |
| float    | x1    | Ending position on the x axis     |
| float    | y1    | Ending position on the y axis     |
| color\_t | color | The color you want the line to be |

```
renderer.line( 100, 100, 200, 200, new color_t( 255, 255, 255, 255 ) );
```

## rect( x, y, w, y, color )

Draws a rectangle (not filled) between the two given points.

| Type     | Name  | Description                            |
| -------- | ----- | -------------------------------------- |
| float    | x     | Starting position on the x axis        |
| float    | y     | Starting position on the y axis        |
| float    | w     | How wide the rectangle should be       |
| float    | h     | How tall the rectangle should be       |
| color\_t | color | The color you want the rectangle to be |

```
renderer.rect( 100, 100, 200, 200, new color_t( 255, 255, 255, 255 ) );
```

## rect\_filled( x, y, w, h, color )

Draws a rectangle (filled) between the two given points.

| Type     | Name  | Description                            |
| -------- | ----- | -------------------------------------- |
| float    | x     | Starting position on the x axis        |
| float    | y     | Starting position on the y axis        |
| float    | w     | How wide the rectangle should be       |
| float    | h     | How tall the rectangle should be       |
| color\_t | color | The color you want the rectangle to be |

```
renderer.rect_filled( 100, 100, 200, 200, new color_t( 255, 255, 255, 255 ) );
```

## rect\_filled\_fade( x, y, w, h, color, a0, a1 )

Draws a rectangle (filled) between the two given points that fades from the first alpha, to the second.

| Type     | Name  | Description                            |
| -------- | ----- | -------------------------------------- |
| float    | x     | Starting position on the x axis        |
| float    | y     | Starting position on the y axis        |
| float    | w     | How wide the rectangle should be       |
| float    | h     | How tall the rectangle should be       |
| color\_t | color | The color you want the rectangle to be |
| float    | a0    | The starting alpha                     |
| float    | a1    | The ending alpha                       |

```
renderer.rect_filled_fade( 100, 100, 200, 200, new color_t( 255, 255, 255, 255 ), 255, 155 );
```

## rect\_filled\_gradient( x, y, w, h, color0, color1 )

Draws a rectangle (filled) between the two given points that fades from the first color to the second.

| Type     | Name   |                                  |
| -------- | ------ | -------------------------------- |
| float    | x      | Starting position on the x axis  |
| float    | y      | Starting position on the y axis  |
| float    | w      | How wide the rectangle should be |
| float    | h      | How tall the rectangle should be |
| color\_t | color0 | The starting color               |
| color\_t | color1 | The ending color                 |

```
renderer.rect_filled_gradient( 100, 100, 200, 200, new color_t( 0, 255, 0, 255 ), new color_t( 255, 0, 0, 255 ) );
```

## circle( x, y, radius, segments, color )

Draws a circle (not filled) at the two given points.

| Type     | Name     | Description                                               |
| -------- | -------- | --------------------------------------------------------- |
| float    | x        | The position on the x axis                                |
| float    | y        | The position on the y axis                                |
| int      | radius   | How big the circle should be                              |
| int      | segments | How many segments should be used to the create the circle |
| color\_t | color    | The color you want the circle to be                       |

```
renderer.circle( 100, 100, 25, 32, new color_t( 255, 255, 255, 255 ) );
```

## circle\_filled( x, y, radius, segments, color )

Draws a circle (filled) at the two given points

| Type     | Name     | Description                                               |
| -------- | -------- | --------------------------------------------------------- |
| float    | x        | The position on the x axis                                |
| float    | y        | The position on the y axis                                |
| int      | radius   | How big the circle should be                              |
| int      | segments | How many segments should be used to the create the circle |
| color\_t | color    | The color you want the circle to be                       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pasteware.team/namespaces/renderer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
