Graphics::drawRect

From RAGE Multiplayer Wiki
Revision as of 13:00, 26 October 2018 by Rootcause (talk | contribs) (Replaced HTML with template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Draws a rectangle on the screen.
*The total number of rectangles to be drawn in one frame is apparently limited to 399.

Syntax

mp.game.graphics.drawRect(pos_x, pos_y, width, height, color_r, color_g, color_b, color_a);

Required Arguments

  • pos_x: float (0.0-1.0, 0.0 is the left edge of the screen, 1.0 is the right edge of the screen)
  • pos_y: float (0.0-1.0, 0.0 is the top edge of the screen, 1.0 is the bottom edge of the screen)
  • width: float (0.0-1.0, 1.0 means the whole screen width)
  • height: float (0.0-1.0, 1.0 means the whole screen height)
  • color_r: int
  • color_g: int
  • color_b: int
  • color_a: int (0-255, 0 means totally transparent, 255 means totally opaque)

Return value

  • Undefined

Example

Client-Side
mp.events.add('render', () => {
    if (condition) {
        mp.game.graphics.drawRect(0.35, 0.4, 0.3, 0.2, 215, 55, 55, 155);
    }
});

See also