DxCreateScreenSource

From Multi Theft Auto: Wiki
Revision as of 23:18, 13 June 2011 by Ccw (talk | contribs) (Created page with "{{Client function}} __NOTOC__ {{New feature|3.0110|1.1| Only available in 1.1 }} This function creates a screen source, which is a special type of texture that contains the s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Only available in 1.1 This function creates a screen source, which is a special type of texture that contains the screen as rendered by GTA

Syntax

element dxCreateScreenSource ( int width, int height )

Required Arguments

  • width : The width of the texture in pixels.
  • height : The height of the texture in pixels.

Returns

Returns a texture element if successful, false if invalid arguments were passed to the function.

Example

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        myScreenSource = dxCreateScreenSource ( 640, 480 )          -- Create a screen source texture which is 640 x 480 pixels
    end
)

addEventHandler( "onClientRender", root,
    function()
        if myScreenSource then
            dxUpdateScreenSource( myScreenSource )                  -- Capture the current screen output from GTA
            dxDrawImage( 50,  50,  100, 100, myScreenSource )       -- Now use myScreenSource as a material and draw it lots of times
            dxDrawImage( 150, 350, 150, 100, myScreenSource )
            dxDrawImage( 250, 250, 100, 150, myScreenSource )
            dxDrawImage( 350, 30,  150, 150, myScreenSource )
        end
    end
)

See Also