Surface.rectangle
From Spheriki
Draw a filled rectangle with a given color on the surface.
Contents |
Usage
- surface Sphere Surface object. The surface to draw the rectangle on.
- x1, y1 numbers. Coordinates of the top-left of the rectangle, in pixels.
- x2, y2 numbers. Coordinates of the bottom-right of the rectangle, in pixels.
- color Sphere Color object. The desired color of the rectangle.
Examples
This draws a white square on a surface. This won't appear on the screen until you blit to the surface itself.
var black = CreateColor(0, 0, 0); var white = CreateColor(255, 255, 255); var s = CreateSurface(100, 100, black); s.rectangle(25, 25, 75, 75, white); // White square is now on the surface s.
Notes
- Like the rest of the surface-drawing functions, this only draws onto the surface. To see the results, you need to draw the surface onto the screen using Surface.blit().