Skip to content
Vadim Grigoruk edited this page Nov 22, 2026 · 1 revision

rrect(x, y, width, height, color, radius=-1, exponent=2)

Parameters

  • x, y : coordinates of the top left corner of the rectangle
  • width : the width of the rectangle in pixels
  • height : the height of the rectangle in pixels
  • color : the index of the color in the palette that will be used to fill the rectangle; see fill patterns
  • radius : corner radius in pixels. -1 (default) uses half of the shorter side, giving a capsule; 0 draws a plain rect
  • exponent : shape of the corners. 2 (default) is a circle; values below 2 make the corners more pointed, values above 2 make them squarer. Clamped to 0.3...8

Description

This function draws a filled rounded rectangle (a superellipse capsule) at the specified position.

See also:

  • rrectb - draw only the border of the rounded rectangle

Example

function TIC()
    cls(0)

    -- capsule: radius defaults to half the shorter side
    rrect(10, 10, 60, 24, 12)

    -- circular corners
    rrect(80, 10, 60, 40, 11, 10, 2)

    -- squarer corners
    rrect(150, 10, 60, 40, 9, 10, 4)
end

Home
Tips for newcomers

Built-in Editors

Code | Sprites | Maps | SFX | Music

Console

All commands

save | export | load | import | menu | config | surf | shelf | demo | eval 

Platform

RAM | VRAM | Display | Palette | Bits per Pixel (BPP) | .tic Format | Supported Languages

Other

Tutorials | Code Snippets | Libraries | External Tools | FFT


API

All API functions

Callbacks

TIC | BOOT | MENU | BDR

  • SCN (deprecated)
  • OVR (deprecated)

Input

btn | btnp | btnr | key | keyp | keyr | mouse

Drawing

circ | circb | clip | cls | elli | ellib | font | line | map | paint | pix | print | rect | rectb | rrect | rrectb | spr | tri | trib | ttri | fill patterns

Sound

music | sfx | FFT | VQT

Memory

memcpy | memset | mget | mset | peek | poke | pmem | sync | vbank

System

exit | reset | time | tstamp | trace

Clone this wiki locally