Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "gfx.h"
- int main()
- {
- int ysize = 600;
- int xsize = 800;
- int a,b;
- char c;
- char title[]="Matching Game ";
- char begin[]="Start";
- char information[]="Info";
- char direct[]="yes";
- char next[]= "next";
- char read_info[]="Welcome to Matching The Box";
- char read_info2[]="To start this game u need to left click the start button.";
- char read_info3[]="Below are key words:";
- char read_info4[]="p =box 1";
- char read_info5[]="o =box 2";
- char read_info6[]="i =box 3";
- char read_info7[]="u =box 4";
- char read_info8[]="y =box 5";
- char read_info9[]="t =box 6";
- char read_info10[]="r =box 7";
- char read_info11[]="e =box 8";
- char read_info12[]="w =box 9";
- char read_info13[]="q =box 10";
- char read_info14[]="l =box 11";
- char read_info15[]="k =box 12";
- char read_info16[]="x =Quit";
- char read_info17[]="left click = choose any boxes";
- char read_info18[]="right click = Quit";
- char read_info19[]="Next here's how the game works:";
- char read_info20[]="LEVEL 1:";
- char read_info21[]="A total of 5 pairs of white boxes randomly arranged will be displayed.";
- char read_info22[]="5 boxes on the right side and 5 boxes on the left side.";
- char read_info23[]="Behind each white box, there would be another colour.";
- char read_info24[]="As the user manages to find both boxes of same colour, the box of that respective color will disappear.";
- char read_info25[]="Failed to do so, the boxes will turn white again.";
- char read_info26[]="Level 1 ends when user manages to match all 5 pairs.";
- char read_info27[]="LEVEL 2:";
- char read_info28[]="A total of 6 pairs of white boxes randomly arranged will be displayed. ";
- char read_info29[]="4 boxes would be arranged in 3 respective rows.";
- char read_info30[]="Behind each white box, there would be another colour.";
- char read_info31[]="As the user manages to find both boxes of same colour, that two choosen boxes will disappear.";
- char read_info32[]="Failed to do so, the boxes will turn white again. ";
- char read_info33[]="Level 2 ends when user manages to match all 6 pairs.";
- char read_info34[]="LEVEL 3:";
- char read_info35[]="A total of 6 pairs of white shapes randomly arranged will be displayed.";
- char read_info36[]="4 boxes would be arranged in 3 respective rows.";
- char read_info37[]="Behind each white box, there would be another colour and shape.";
- char read_info38[]="As the user manages to find both box of same colour and shape, that two choosen boxes will disappear.";
- char read_info39[]="Failed to do so, the boxes will turn white again. ";
- char read_info40[]="Level 3 ends when user manages to match all 6 pairs.";
- // Open a new window for drawing.
- gfx_open(xsize,ysize,"Example Graphics Program");
- gfx_clear_color(0,0,0);
- gfx_clear();
- //title's button
- gfx_color(255,100,0);
- gfx_fillrectangle(260,50,200,100);
- gfx_color(0,0,0);
- gfx_text(title,320,100);
- //begin's button
- gfx_color(255,0,0);
- gfx_fillcircle(320,250,100);
- gfx_color(255,0,0);
- gfx_fillcircle(340,250,100);
- gfx_color(255,0,0);
- gfx_fillcircle(360,250,100);
- gfx_color(255,0,0);
- gfx_fillcircle(380,250,100);
- gfx_color(255,0,0);
- gfx_fillcircle(400,250,100);
- gfx_color(0,0,0);
- gfx_text(begin,345,250);
- //info's button
- gfx_color(255,0,0);
- gfx_fillcircle(320,400,100);
- gfx_color(255,0,0);
- gfx_fillcircle(340,400,100);
- gfx_color(255,0,0);
- gfx_fillcircle(360,400,100);
- gfx_color(255,0,0);
- gfx_fillcircle(380,400,100);
- gfx_color(255,0,0);
- gfx_fillcircle(400,400,100);
- gfx_color(0,0,0);
- gfx_text(information,345,400);
- while(1)
- {
- c = gfx_wait();
- //while((x>x1)&&(x<x2)&&(y>y1)&&(y<y2))
- a=gfx_xpos();
- b=gfx_ypos();
- /*//to start the game
- if((c==0x01)&&(a>320)&&(a<400)&&(b>250)&&(b<350))
- {
- gfx_color(255,255,255);
- gfx_text(direct,345,400);
- }*/
- //to read the info
- if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
- {
- gfx_clear();
- gfx_color(255,255,255);
- gfx_text(read_info,250,50);
- gfx_text(read_info2,250,70);
- gfx_text(read_info3,250,100);
- gfx_text(read_info4,250,120);
- gfx_text(read_info5,250,140);
- gfx_text(read_info6,250,160);
- gfx_text(read_info7,250,180);
- gfx_text(read_info8,250,200);
- gfx_text(read_info9,250,220);
- gfx_text(read_info10,250,240);
- gfx_text(read_info11,250,260);
- gfx_text(read_info12,250,280);
- gfx_text(read_info13,250,300);
- gfx_text(read_info14,250,320);
- gfx_text(read_info15,250,340);
- gfx_text(read_info16,250,360);
- gfx_text(read_info17,250,380);
- gfx_text(read_info18,250,400);
- //usleep(300000);
- //gfx_color(255,100,0);
- //gfx_fillcircle(400,400,100);
- gfx_color(255,255,255);
- gfx_text(next,345,400);
- }
- //info part2
- if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
- {
- gfx_clear();
- gfx_text(read_info19,100,50);
- gfx_text(read_info20,100,80);
- gfx_text(read_info21,100,100);
- gfx_text(read_info22,100,120);
- gfx_text(read_info23,100,140);
- gfx_text(read_info24,100,160);
- gfx_text(read_info25,100,180);
- gfx_text(read_info26,100,200);
- gfx_text(read_info27,100,290);
- gfx_text(read_info28,100,310);
- gfx_text(read_info29,100,330);
- gfx_text(read_info30,100,350);
- gfx_text(read_info31,100,370);
- gfx_text(read_info32,100,390);
- gfx_text(read_info33,100,410);
- //usleep(300000);
- }
- gfx_color(255,0,0);
- gfx_fillcircle(400,400,100);
- gfx_color(0,0,0);
- gfx_text(next,345,400);
- //info part3
- if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
- {
- gfx_clear();
- gfx_text(read_info34,100,80);
- gfx_text(read_info35,100,100);
- gfx_text(read_info36,100,120);
- gfx_text(read_info37,100,140);
- gfx_text(read_info38,100,160);
- gfx_text(read_info39,100,180);
- gfx_text(read_info40,100,200);
- //usleep(300000);
- }
- if(c=='q') break;
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement