Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Program D2 */
- #include <stdio.h>
- #include "gfx.h"
- int main()
- {
- int ysize = 1000;
- int xsize = 3000;
- char c;
- int y,x;
- // Open a new window for drawing.
- gfx_open(xsize,ysize,"Example Graphics Program");
- while(1) {
- // Wait for the user to press a character.
- c = gfx_wait();
- x=gfx_xpos();
- y=gfx_ypos();
- if (c==0x01)
- {
- printf("1 - left button ");
- }
- else if (c==0x02)
- {
- printf("2 - middle button ");
- }
- else if (c==0x03)
- {
- printf("3 - right button ");
- }
- else
- {
- printf("%c \n",c);
- printf("Mouse pos xpos is %d and ypos is %d \n", gfx_xpos(),gfx_ypos());
- }
- if ((x >= 200 && x <= 400) && (y >= 100 && y <= 300))
- {//123
- printf("Correct \n");
- //gfx_color(255,255,0);
- //gfx_fillcircle(50,500,100);
- }//121
- if((x>600 && x<750) && (y>600 && y<750))
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement