>D.hamilton |
>D.hamilton |
Line 1: |
Line 1: |
− | == Description ==
| |
− | This function is what runs your program for you. When you write [[setup()]] and [[draw()]] functions in your work space, then you call Run with the names of those functions to loop your program.
| |
| | | |
− |
| |
− | Setup will be called exactly once at the beginning of the program. Draw will be called once per frame for the life of the program.
| |
− |
| |
− |
| |
− | The [[setup()]] and [[draw()]] functions must take no parameters and return nothing.
| |
− |
| |
− | == Example Usage ==
| |
− | <syntaxhighlight lang="c" line='line'>
| |
− | void setup(void)
| |
− | {
| |
− | /* Set the size of the window */
| |
− | size(500, 500);
| |
− | }
| |
− |
| |
− | void draw(void)
| |
− | {
| |
− | /* Set the background color to black every frame */
| |
− | background(0, 0, 0, 255);
| |
− |
| |
− | /* Draw a rectangle at the mouse position */
| |
− | rect(mouseX, mouseY, 50, 50);
| |
− | }
| |
− |
| |
− | int main(void)
| |
− | {
| |
− | /* Run the program */
| |
− | Run(setup, draw);
| |
− | }
| |
− |
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− | === See Also ===
| |
− | * [[setup()]]
| |
− | * [[draw()]]
| |
− | * [[size()]]
| |
− | * [[background()]]
| |
− | * [[rect()]]
| |