graphics.Clear

( Brutus2D 1.4.x, 1.5.x, 1.6, 1.7 )

graphics.Clear - clear the screen

Description

graphics.Clear color

  • color - color to clear with, default is &h00000000 (black)

graphics.Clear clears the screen. It is mostly used to clear the previous frame before drawing a new one. If used without an argument, it will always clear the screen to black. You can make graphics.Clear use another color than black by giving it a hex color as an argument, however, the first two digits of the color reserved for alpha transparency have no effect (see color). Instead of writing out the hex value you can use the return value from Brutus2D's Rgb(red, green, blue) function where you enter the red, green and blue components separately from 0 (dark) to 255 (full color).

Examples

Example of Use

By default, graphics.Clear clears the screen to black (&h00000000).

' press exit to escape

graphics.Initialize
key.Initialize

Do While Not key.Pressed( vk_escape ) And Not key.Pressed( vk_escape )
    graphics.Clear
    'draw stuff here
    graphics.Display
Loop

graphics.Terminate
key.Terminate

White Background

If you graphics.Clear the hex color &h00FFFFFF (white) as an argument, it will clear the screen to white, resulting in a white background.

' press exit to escape

graphics.Initialize
key.Initialize

Do While Not key.Pressed( vk_escape ) And Not key.Pressed( vk_windowx )
    graphics.Clear &h00FFFFFF
    'draw stuff here
    graphics.Display
Loop

graphics.Terminate
key.Terminate

Related Pages

page tags: clear graphics
page_revision: 3, last_edited: 1215023007|%e %b %Y, %H:%M %Z (%O ago)