Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. /* Program D2 */
  2. #include <stdio.h>
  3. #include "gfx.h"
  4. int main()
  5. {
  6. int ysize = 1000;
  7. int xsize = 3000;
  8. char c;
  9. int y,x;
  10. // Open a new window for drawing.
  11. gfx_open(xsize,ysize,"Example Graphics Program");
  12. while(1) {
  13. // Wait for the user to press a character.
  14. c = gfx_wait();
  15. x=gfx_xpos();
  16. y=gfx_ypos();
  17.  
  18. if (c==0x01)
  19. {
  20. printf("1 - left button ");
  21. }
  22. else if (c==0x02)
  23. {
  24. printf("2 - middle button ");
  25. }
  26. else if (c==0x03)
  27. {
  28. printf("3 - right button ");
  29. }
  30. else
  31. {
  32. printf("%c \n",c);
  33. printf("Mouse pos xpos is %d and ypos is %d \n", gfx_xpos(),gfx_ypos());
  34. }
  35.  
  36. if ((x >= 200 && x <= 400) && (y >= 100 && y <= 300))
  37. {//123
  38. printf("Correct \n");
  39. //gfx_color(255,255,0);
  40. //gfx_fillcircle(50,500,100);
  41. }//121
  42. if((x>600 && x<750) && (y>600 && y<750))
  43. break;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement