# dxUpdateScreenSource (Client)

> Copies the game's screen into a screen source.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxUpdateScreenSource

## Syntax

```lua
bool dxUpdateScreenSource(texture screenSource [, bool resampleNow = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `screenSource` | `texture` | The screen source from `dxCreateScreenSource`. |
| `resampleNow` | `bool` | Copy again even if it was already copied this frame. With a render target set, copies that render target instead of the screen. *(default: `false`)* |

## Returns

`true`. An element that is not a screen source raises an error.

Without `resampleNow`, the copy happens at most once per frame.

## Example

```lua
local screen = dxCreateScreenSource(320, 180)

addEventHandler("onClientRender", root, function()
    dxUpdateScreenSource(screen)
    dxDrawImage(20, 20, 320, 180, screen, 0, 0, 0, tocolor(255, 255, 255, 200))
end)
```

## See also

- [dxCreateScreenSource (Client)](https://wiki.mymp.gg/en/dxCreateScreenSource.md): Creates a screen source: an image that receives a copy of the game's screen on each dxUpdateScreenSource.
- [dxSetRenderTarget (Client)](https://wiki.mymp.gg/en/dxSetRenderTarget.md): Chooses where the next dx functions draw: into a render target or, without one, on the screen.
- [dxDrawImage (Client)](https://wiki.mymp.gg/en/dxDrawImage.md): Draws an image on the screen for one frame.
