Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- A simple example of using the gfx library.
- CSE 20211
- 9/7/2011
- by Prof. Thain
- */
- #include <stdio.h>
- #include "gfx2.h"
- #include "myGfxShapes.h"
- int main()
- {
- int i = 10;
- int ysize = 300;
- int xsize = 300;
- char c;
- // Open a new window for drawing.
- gfx_open(xsize,ysize,"Example Graphics Program");
- // Set the current drawing color to green.
- gfx_color(0,0,255);
- // Draw a triangle on the screen.
- /*gfx_line(100,100,200,100);
- gfx_line(200,100,150,150);
- gfx_line(150,150,100,100);
- gfx_color(120,120,0);
- drawSquare(150,150,32);
- gfx_color(0,255,0);
- drawSquare(150,150,16);
- gfx_color(0,0,255);
- drawSquare(240,99,50);*/
- // created a for loop to create 5 squares that are different sizes and collors
- for(int k=0; k<=5; k++)
- {
- gfx_color(i,i,255);
- drawSquare(150,150,i);
- i = i + 30;
- }
- while(1) {
- // Wait for the user to press a character.
- c = gfx_wait();
- // Quit if it is the letter q.
- if(c=='q') break;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment