DgsBlurBoxSetLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
Line 22: Line 22:


local blurbox = DGS:dgsCreateBlurBox(600,500)
local blurbox = DGS:dgsCreateBlurBox(600,500)
DGS:dgsBlurBoxSetLevel(blurbox,i)
local window = DGS:dgsCreateImage(200,200,600,500,blurbox,false)
local window = DGS:dgsCreateImage(200,200,600,500,blurbox,false)
 
blurLevel = 0
int = 0
setTimer(function()
setTimer(function()
     int = int + 1
     blurLevel = blurLevel + 1
     outputChatBox("Blur box level is now "..int)
     outputChatBox("Blur box level is now "..blurLevel)
end, 1000, 0)
end, 1000, 0)


addEventHandler("onClientRender", root, function()
addEventHandler("onClientRender", root, function()
     DGS:dgsBlurBoxSetLevel(blurbox,int)
     DGS:dgsBlurBoxSetLevel(blurbox,blurLevel)
     if int == 15 then
     if blurLevel >= 15 then
         int = 1
         blurLevel = 0
     end
     end
end)
end)
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 12:57, 6 May 2020

This function sets blur box level.

Syntax

bool dgsBlurBoxSetLevel( element blurBox, int level )

Required Arguments

  • blurBox: A dgs blur box element.
  • level: A int of the blur box level.

Returns

Returns true if successful, false otherwise.

Example

This example change blur box level every 1 second.

DGS = exports.dgs --get exported functions from dgs

local blurbox = DGS:dgsCreateBlurBox(600,500)
local window = DGS:dgsCreateImage(200,200,600,500,blurbox,false)
blurLevel = 0
setTimer(function()
    blurLevel = blurLevel + 1
    outputChatBox("Blur box level is now "..blurLevel)
end, 1000, 0)

addEventHandler("onClientRender", root, function()
    DGS:dgsBlurBoxSetLevel(blurbox,blurLevel)
    if blurLevel >= 15 then
        blurLevel = 0
    end
end)