Advertisement
Guest User

lll

a guest
Nov 12th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 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 "gfx.h"
  10.  
  11. int main()
  12. {
  13. int ysize = 600;
  14. int xsize = 800;
  15.  
  16. char c;
  17.  
  18. // Open a new window for drawing.
  19. gfx_open(xsize,ysize,"Example Graphics Program");
  20.  
  21. gfx_clear_color(255,255,255);
  22. gfx_clear();
  23. /*
  24. // Set the current drawing color to green.
  25. gfx_color(255,0,0);
  26. // Draw a triangle on the screen.
  27. gfx_line(50,50,100,500);
  28. // gfx_line(200,100,150,150);
  29. // gfx_line(150,150,100,100);
  30.  
  31. gfx_color(0, 255,0);
  32. // Draw a triangle on the screen.
  33. gfx_line(100,50,150,500);
  34. gfx_color(0,0,255);
  35. // Draw a triangle on the screen.
  36. gfx_line(150,50,200,500);
  37. gfx_color(255,255,0);
  38. // Draw a triangle on the screen.
  39. gfx_line(200,50,250,500);
  40. gfx_color(255,255,255);
  41. // Draw a triangle on the screen.
  42. gfx_line(250,50,300,500);
  43. gfx_color(100,100,100);
  44. // Draw a triangle on the screen.
  45. gfx_line(300,50,350,500);
  46. gfx_color(0,0,0);
  47. // Draw a triangle on the screen.
  48. gfx_line(350,50,400,500);
  49. */
  50.  
  51. gfx_color(255,0,0);
  52. gfx_fillcircle(50,50,100);
  53. //gfx_fillrectangle(50,50,100,100);
  54. gfx_color(0,255,0);
  55. gfx_fillcircle(200,100,200);
  56.  
  57. //gfx_fillrectangle(200,100,150,50);
  58. gfx_color(0,0,255);
  59. gfx_fillcircle(400,200,350);
  60.  
  61. //gfx_fillrectangle(400,200,200,20);
  62.  
  63.  
  64.  
  65. while(1) {
  66. // Wait for the user to press a character.
  67. c = gfx_wait();
  68. /* if (c==0x01)
  69. {
  70. printf("1 - left button\n");
  71. }
  72. else if (c==0x02)
  73. {
  74. printf("2 - middle button\n");
  75. }
  76. else if (c==0x03)
  77. {
  78. printf("3 - right button\n");
  79. }
  80. else
  81. printf("%c \n",c);*/
  82. // Quit if it is the letter q.
  83. //printf("MOuse position x pos is %d and y pos is %d \n", gfx_xpos(),gfx_ypos());
  84. if(c=='q') break;
  85. }
  86.  
  87. return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement