UNPKG

fivem-js

Version:

Javascript/Typescript wrapper for the FiveM natives

29 lines (28 loc) 985 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResRectangle = void 0; const __1 = require("../../"); const utils_1 = require("../../../utils"); class ResRectangle extends __1.Rectangle { constructor(pos, size, color) { super(pos, size, color); } draw(pos, size, color) { if (!pos) { pos = new utils_1.Size(); } if (pos && !size && !color) { pos = new utils_1.Point(this.pos.X + pos.width, this.pos.Y + pos.height); size = this.size; color = this.color; } const height = __1.Screen.Height; const width = __1.Screen.ScaledWidth; const w = size.width / width; const h = size.height / height; const x = pos.X / width + w * 0.5; const y = pos.Y / height + h * 0.5; DrawRect(x, y, w, h, color.r, color.g, color.b, color.a); } } exports.ResRectangle = ResRectangle;