Guest User

Untitled

a guest
Jan 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. /*
  2. A simple example of using the gfx library.
  3. CSE 20211
  4. 9/7/2011
  5. by Prof. Thain
  6. */
  7.  
  8. #include <stdio.h>
  9. #include "gfx2.h"
  10. #include "myGfxShapes.h"
  11.  
  12.  
  13.  
  14. int main()
  15. {
  16. int i = 10;
  17. int ysize = 300;
  18. int xsize = 300;
  19.  
  20. char c;
  21.  
  22. // Open a new window for drawing.
  23. gfx_open(xsize,ysize,"Example Graphics Program");
  24.  
  25. // Set the current drawing color to green.
  26. gfx_color(0,0,255);
  27.  
  28. // Draw a triangle on the screen.
  29. /*gfx_line(100,100,200,100);
  30. gfx_line(200,100,150,150);
  31. gfx_line(150,150,100,100);
  32. gfx_color(120,120,0);
  33. drawSquare(150,150,32);
  34. gfx_color(0,255,0);
  35. drawSquare(150,150,16);
  36. gfx_color(0,0,255);
  37. drawSquare(240,99,50);*/
  38.  
  39.  
  40. // created a for loop to create 5 squares that are different sizes and collors
  41. for(int k=0; k<=5; k++)
  42. {
  43. gfx_color(i,i,255);
  44. drawSquare(150,150,i);
  45. i = i + 30;
  46. }
  47.  
  48. while(1) {
  49. // Wait for the user to press a character.
  50. c = gfx_wait();
  51.  
  52. // Quit if it is the letter q.
  53. if(c=='q') break;
  54. }
  55.  
  56. return 0;
  57. }
Add Comment
Please, Sign In to add comment