function isCursorInBox (x, y, width, height) if not isCursorShowing () then return false end local cursor = {getCursorPosition ()} local cursorx, cursory = (cursor[1] * screen.x), (cursor[2] * screen.y) return cursorx >= x and cursorx <= (x + width) and cursory >= y and cursory <= (y + height) end local cache = { fonts = {}; images = {}; } function getFont(name, size) if not name then return end if not size then return end if not cache.fonts[name] then cache.fonts[name] = {} end if not isElement(cache.fonts[name][size]) then cache.fonts[name][size] = exports['mtrp_assets']:loadFont(name, size) end return cache.fonts[name][size] end function getImg(name) if not name then return end if not cache.images[name] then cache.images[name] = {} end if not isElement(cache.images[name]) then cache.images[name] = exports['mtrp_assets']:loadImg(name) end return cache.images[name] end local _dxDrawImageSpacing = dxDrawImageSpacing; function dxDrawImageSpacing(x, y, width, height, spacing, image, color, ...) local alpha = math.floor(tonumber(bitExtract(color, 24, 8)) or 255) local padding = spacing * 2 if alpha >= 255 then dxSetBlendMode('add') dxDrawImage(x - spacing, y - spacing, width + padding, height + padding, image, color, ...) dxSetBlendMode('blend') return end return dxDrawImage(x - spacing, y - spacing, width + padding, height + padding, image, color, ...) end svgsRectangle = {}; function dxDrawRoundedRectangle(x, y, w, h, radius, color, post) if not svgsRectangle[radius] then svgsRectangle[radius] = {} end if not svgsRectangle[radius][w] then svgsRectangle[radius][w] = {} end if not svgsRectangle[radius][w][h] then local Path = string.format([[ ]], w, h, w, h, w, h, radius) svgsRectangle[radius][w][h] = svgCreate(w, h, Path) end if svgsRectangle[radius][w][h] then dxDrawImage(x, y, w, h, svgsRectangle[radius][w][h], 0, 0, 0, color, post or false) end end function convertNumber(amount) local left, center, right = string.match(math.floor(amount), '^([^%d]*%d)(%d*)(.-)$') return left .. string.reverse(string.gsub(string.reverse(center), '(%d%d%d)', '%1.')) .. right end function registerEvent(event, element, callback) addEvent(event, true) addEventHandler(event, element, callback) end