> For the complete documentation index, see [llms.txt](https://lua2.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua2.fatality.win/api/instances/draw.md).

# draw

<table><thead><tr><th width="288">Usage: draw.{func_or_field}</th></tr></thead><tbody><tr><td></td></tr></tbody></table>

This table describes the rendering system of the software.

{% hint style="info" %}

####

All types and enums described in the child sections must be prefixed with `draw.`. This is done so specific types are not confused with others, such as the separate `color` types present in rendering and the game.
{% endhint %}

## adapter﻿ <a href="#adapter" id="adapter"></a>

<mark style="color:green;">**`Field`**</mark><mark style="color:red;">**`Read only`**</mark>&#x20;

Type: [`Adapter`](/api/instances/draw/adapter.md)

Rendering adapter.

***

## textures﻿ <a href="#textures" id="textures"></a>

<mark style="color:green;">**`Field`**</mark><mark style="color:red;">**`Read only`**</mark>&#x20;

Type: [`Accessor`](/api/instances/draw/types/accessor.md)`<`[`Texture`](/api/instances/draw/managed/texture.md)`>`

A string to [`Texture`](/api/instances/draw/managed/texture.md) map of all managed textures. You can query and push textures with custom IDs. When you add a texture to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

{% hint style="info" %}

Built-in textures:

* `gui_loading`: loading spinner
* `gui_user_avatar`: current user's profile picture. May be `nil` if you don't have any avatar set
* `gui_icon_up`: up chevron
* `gui_icon_down`: down chevron
* `gui_icon_copy`: copy icon
* `gui_icon_paste`: paste icon
* `gui_icon_add`: add icon
* `gui_icon_search`: search icon
* `gui_icon_settings`: settings icon (a cogwheel)
* `gui_icon_bug`: bug icon
* `gui_icon_key.N`: keyboard/mouse key icons. Replace `N` with the char code of a required button
* `icon_rage`: RAGE tab icon
* `icon_legit`: LEGIT tab icon
* `icon_visuals`: VISUALS tab icon
* `icon_misc`: MISC tab icon
* `icon_scripts`: LUA tab icon
* `icon_skins`: SKINS tab icon
* `icon_cloud`: cloud icon
* `icon_file`: file icon
* `icon_refresh`: refresh icon
* `icon_save`: save icon
* `icon_configs`: "Configs" popup icon
* `icon_keys`: keyboard icon
* `icon_info`: "About" popup icon
* `icon_close`: close icon (cross)
* `icon_load`: load icon
* `icon_import`: import icon
* `icon_export`: export icon
* `icon_delete`: delete icon
* `icon_autoload`: "Autoload" icon
* `icon_allow_insecure`: "Allow insecure" icon
* `icon_cloud_upd`: cloud update icon
* `player_texture`: player preview texture
  {% endhint %}

***

## fonts﻿ <a href="#fonts" id="fonts"></a>

<mark style="color:green;">**`Field`**</mark><mark style="color:red;">**`Read only`**</mark>&#x20;

Type: [`Accessor`](/api/instances/draw/types/accessor.md)`<`[`FontBase`](/api/instances/draw/managed/fontbase.md)`>`

A string to [`FontBase`](/api/instances/draw/managed/fontbase.md) map of all managed fonts. You can query and push fonts with custom IDs. When you add a font to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

{% hint style="info" %}

Built-in fonts:

* `gui_debug`: Verdana, 13px
* `gui_title`: Figtree ExtraBold, 23px
* `gui_main`: Figtree Medium, 14px
* `gui_main_shadow`: Figree Medium, 14px, with shadow
* `gui_main_fb`: Segoe UI Semibold, 14px
* `gui_bold`: Figtree ExtraBold, 14px
* `gui_bold_fb`: Segoe UI Black, 14px
* `gui_semi_bold`: Figtree SemiBold, 14px
* `gui_semi_bold_fb`: Segoe UI Bold, 14px
  {% endhint %}

***

## shaders﻿ <a href="#shaders" id="shaders"></a>

<mark style="color:green;">**`Field`**</mark><mark style="color:red;">**`Read only`**</mark>&#x20;

Type: [`Accessor`](/api/instances/draw/types/accessor.md)`<`[`Shader`](/api/instances/draw/managed/shader.md)`>`

A string to [`Shader`](/api/instances/draw/managed/shader.md) map of all managed shader. You can query and push shader with custom IDs. When you add a shader to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

{% hint style="info" %}
Build-in shaders:

* `blur_f`: gaussian blur shader
  {% endhint %}

***

## surface﻿ <a href="#surface" id="surface"></a>

<mark style="color:green;">**`Field`**</mark><mark style="color:red;">**`Read only`**</mark>&#x20;

Type: [`Layer`](/api/instances/draw/layer.md)

The layer you can render on.<br>

***

## GetTime

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns current render time, alias to [`m_flRealTime`](/api/instances/game/cglobalvarsbase.md#real-time) .

**Arguments**

None.

**Returns**

| Type    | Description      |
| ------- | ---------------- |
| `float` | The current time |

**Example**

```lua
local time = draw.GetTime()
```

***

## GetFrameTime

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns current frame time, alias to [`m_flFrameTime`](/api/instances/game/cglobalvarsbase.md#frame-time).

**Arguments**

None.

**Returns**

| Type    | Description    |
| ------- | -------------- |
| `float` | The frame time |

**Example**

```lua
local time = draw.GetFrameTime()
```

***

## GetScale

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns current render DPI scaling multiplier.

**Arguments**

None.

**Returns**

| Type    | Description    |
| ------- | -------------- |
| `float` | The multiplier |

**Example**

```lua
local dpi = draw.GetScale()
```

***

## GetDisplay

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns current render screen size, similar to [`GetScreenSize()`](/api/instances/game/cengineclient.md#getscreensize) .

**Arguments**

None.

**Returns**

| Type                                        | Description     |
| ------------------------------------------- | --------------- |
| [`Vec2`](/api/instances/draw/types/vec2.md) | The screen size |

**Example**

```lua
local size = draw.GetDisplay()
```

***

## CreatePanoramaSvgTexture

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Finds and retrieves SVG data from Panorama and creates a new texture. Useful for retrieving icons (e.g. weapons and utilities) from the game.

**Arguments**

| Name     | Type     | Description                      |
| -------- | -------- | -------------------------------- |
| `path`   | `string` | Path to the SVG                  |
| `height` | `number` | Height of the texture, in pixels |

**Returns**

| Type                                                | Description         |
| --------------------------------------------------- | ------------------- |
| [`Texture`](/api/instances/draw/managed/texture.md) | The created texture |

**Example**

```lua
local tex = draw.CreatePanoramaSvgTexture('icons/equipment/inferno', 26)
```

[^1]: This field is a method and must be invoked using a colon (:)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://lua2.fatality.win/api/instances/draw.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
