local screen, scale = import 'getClientScreenValues'(); local assets = getResourceFromName('ncrp_assets') and getResourceState(getResourceFromName('ncrp_assets')) == "running" and exports['ncrp_assets'] or false local textures = {} local fonts = {} export('dxDrawImage', function(x, y, w, h, path, ...) local function createTexture(path) if (not path) then return error('Defina o diretório correto da imagem.', 2) end if (not textures[path]) then textures[path] = (type(path) == 'string' and dxCreateTexture(path) or path) end return textures[path] end return dxDrawImage(x, y, w, h, createTexture(path), ...) end) export('dxDrawText', function(text, x, y, w, h, ...) return dxDrawText(text, x, y, (w + x), (y + h), ...) end) export('dxCreateFont', function(path, size, bold, quality) if (not path) then return 'default-bold', error('A fonte precisa de um diretório para ser criada.', 2) end if (not tonumber(size)) then return 'default-bold', error('A fonte precisa de um tamanho para ser criada.', 2) end local indexDefine = path..size..tostring(bold)..tostring(quality) if (not fonts[indexDefine] or not isElement(fonts[indexDefine])) then fonts[indexDefine] = dxCreateFont(path, (size * scale), bold, quality) end return fonts[indexDefine] or "default-bold" end) -- // -- function rgba(r, g, b, a) return tocolor(math.min(255, math.max(0, r)), math.min(255, math.max(0, g)), math.min(255, math.max(0, b)), math.min(255, math.max(0, (a * 256)))) end local interpolates = {} function interpolate(start, finish, time, index) if not (interpolates[index]) then interpolates[index] = start end interpolates[index] = lerp(interpolates[index], finish, time) return interpolates[index] end function interpolateReset(index) interpolates[index] = nil end function lerp (a, b, t) return a + (b - a) * t end function dxDrawSvgRectangle(x, y, w, h, radius, ...) if (not svgRectangles) then svgRectangles = {} end if (not svgRectangles[w]) then svgRectangles[w] = {} end if (not svgRectangles[w][h]) then svgRectangles[w][h] = {} end if (not svgRectangles[w][h][radius]) then local raw = [[ ]] svgRectangles[w][h][radius] = svgCreate(w, h, raw, function(e) if (not e or not isElement(e)) then return end dxSetTextureEdge(e, 'border') end) end if (svgRectangles[w][h][radius]) then dxDrawImage(x, y, w, h, svgRectangles[w][h][radius], ...) end end function isCursorOnPosition(x, y, w, h) if (not isCursorShowing()) then return false end local cursor = Vector2(getCursorPosition()) local cursor = Vector2((cursor.x * screen.x), (cursor.y * screen.y)) return ((cursor.x >= x and cursor.x <= x + w) and (cursor.y >= y and cursor.y <= y + h)) end