本文整理汇总了C++中settextstyle函数的典型用法代码示例。如果您正苦于以下问题:C++ settextstyle函数的具体用法?C++ settextstyle怎么用?C++ settextstyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settextstyle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plprint
void plprint(const char* s)
{
#if DOS
extern int newstyle;
extern unsigned text_style, text_size, text_orient;
#endif
char buf[128];
if (text && s[strlen(s) - 1] == '\n') {
IGNORE(strcpy(buf, s));
s = buf;
buf[strlen(s)-1] = '\0';
}
if (console && text) {
#if DOS
if (egagrph == 2) {
if (newstyle) {
settextstyle(text_style,text_orient,text_size);
newstyle = 0;
}
outtext(s);
}else{
IGNORE(fprintf(cdev, "%s", s));
}
#else
#if SUNCORE
hoc_pl_sunplot(s);
#else
#if NRNOC_X11
x11_put_text(s);
#else
#if NeXTstep
if (graphdev == NX)
NeXT_put_text(s);
#else
IGNORE(fprintf(cdev, "%s", s));
IGNORE(fflush(cdev));
#endif
#endif
#endif
#endif
} else if (!text) {
#if GRX
if (egagrph) {
hoc_outtext(s);
}else
#endif
{
IGNORE(fprintf(stdout, "%s", s));
}
}
if (hardplot && hpdev && text && strlen(s)) {
hard_text_preamble();
IGNORE(fprintf(hpdev, "%s", s));
IGNORE(fflush(hpdev));
}
if (text && s == buf) {
plt(1, xlast, ylast-20);
plt(-2, 0.,0.);
}
}
示例2: show_summary
/* shows the summary of typing */
void show_summary(int min, int sec,int acc, int err, int speed)
{
/* min= required minute, sec= required seconds, acc= percentage of accuracy,
err= percentage of pressing b.space, speed= typing speed */
char ch[5];
int j1,m,n,i,x=180,y;
char result[][50]= {"Time Elapsed:- min sec","Accuracy : %","Backspace : %","Speed[cpm]:"};
// draw_brief_window(200,90,380,250,1,6,0); // agerta
draw_brief_window(170,90,410,250,1,6,0);
settextstyle(0,0,1);
color_text(182,94,"Result",15);
settextstyle(2,0,5);//2,0,5 3
setcolor(6);
for(i=0,y=120;i<4;i++,y+=18){
outtextxy(x,y,result[i]);
outtextxy(x+1,y,result[i]);
}
// outtextxy(215,210,"Adjacent speed:"); */
show_number(min,300,120,4,2,5); // min
show_number(min,301,120,4,2,5);
show_number(sec,355,120,4,2,5); //sec
show_number(sec,356,120,4,2,5);
show_number(acc,268,138,4,2,5); // accuracy
show_number(acc,269,138,4,2,5); // accuracy
show_number(err,268,156,4,2,5); // error
show_number(err,269,156,4,2,5); // error
show_number(speed,268,174,4,2,5); // speed
show_number(speed,269,174,4,2,5); // speed
if(!minute && !second){
setfillstyle(1,0);
bar(175,120,405,135);
color_text(250,115,"TIME IS UP",6);
color_text(251,115,"TIME IS UP",6);
}
setcolor(4);
if(min ||sec)
{
if(acc || err || speed){
if(acc<=35)
outtextxy(315,138,"Beginner");
else if(acc>35 && acc<= 60)
outtextxy(315,138,"Intermediate");
else if(acc>60 && acc<= 95 )
outtextxy(315,138,"Advanced");
else
outtextxy(315,138,"Expert");
if(err <=5)
outtextxy(315,156,"Expert");
else if(err>5 && err<=10)
outtextxy(315,156,"Advanced");
else if(err>10 && err<=20)
outtextxy(315,156,"Intermediate");
else
outtextxy(315,156,"Beginner");
if(speed<=100)
outtextxy(315,174,"Beginner");
else if( speed>100 && speed<=160)
outtextxy(315,174,"Intermediate");
else if( speed>160 && speed<=220)
outtextxy(315,174,"Advanced");
else
outtextxy(315,174,"Expert");
}
}
}
示例3: lesson_practice
void lesson_practice(int lesson_no,int num,int MINUTE,int angleINCREASE)
{
/* INCREASE= will control time, MINUTE= given time limit of typing */
int j1,ch1,x1,y1,time_up;
int char_x, char_y,i,choice,dummy_choice,line,z;
int rndm,store; /* 'store' is used to store chars serially in
store array */
prev= -1;
time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
minute=MINUTE, INCREASE= angleINCREASE, second=0;
char_x = 173;
char_y = 72;
tutorial_window();
run_info_window();
hideMouse();
if(!num)
LETTER= 4;
else if(!lesson_no)
LETTER=20;
line = 1;
for(i=1,store=0; line<MAX ;i++,store++)
{
rndm = random(LETTER); // randomly seeks chars
if(!num){
store_chars[store]= lesson[lesson_no-1][rndm];
print_lesson(char_x, char_y, lesson[lesson_no-1][rndm],1);
}
else if(!lesson_no){
store_chars[store]= numeric[num-1][rndm];
print_lesson(char_x, char_y, numeric[num-1][rndm],1);
}
char_x +=8; //for next character
if(i%4==0) // GIVING SPACE AFTER EVERY 4 CHARS
{
char_x +=8;
store++;
store_chars[store]=' ';
}
if(char_x >405) // NEXT LINE
{
char_x = 173;
char_y+= 36;
line++;
}
}
setcolor(4);
outtextxy(542,50,"0");
outtextxy(562,50,":");
outtextxy(574,50,"00");
show_number(minute,550,50,4,0,1);
run_info(pressed,correct,wrong,correction);
user_response(250,130,1,3);
time(&start_time);
settextstyle(2,0,5);
color_text(535,76,"ESC to",3);
color_text(536,76,"ESC to",3);
color_text(524,92,"quit/pause",3);
color_text(525,92,"quit/pause",3);
char_x= 173; char_y= 90; line =1; i=0;
dummy_choice= 'A'; //just to initialize the drawing of a key
increase=0, angle=89;
while(1)
{
gettime (&new_time);
time_up= time_control();
if(time_up)
return;
if(line<7){
color_text(char_x,char_y+1,"_",4);
color_text(char_x,char_y-23,"^",4);
}
if(kbhit())
{
check_kb_up_down(dummy_choice,0);
choice= getch(); // ASSIGN USER INPUT TO 'CHOICE'
dummy_choice= choice;
pressed++;
check_kb_up_down(choice,1);
if(line>6)
{
summary_content();
end_lesson(min,sec,eff,err,speed);
//.........这里部分代码省略.........
示例4: intro2
/*displays the select mode menu */
int intro2(int n,int p)
{
int cur,i;
char ch;
if(n==3)
return 3;
else if(n==2)
{clrscr();
cleardevice();
setcolor(YELLOW);
settextstyle(1,0,6);
outtextxy(180,60,"CONNECT 4");
setcolor(YELLOW);
settextstyle(1,0,3);
outtextxy(190,120,"SELECT A MODE");
settextstyle(1,0,3);
outtextxy(30,180," SINGLE PLAYER");
setcolor(RED);
setfillstyle(1,RED);
fillellipse(20,200,20,20);
cur=0;
setcolor(YELLOW);
outtextxy(30,240," MULTIPLE PLAYER");
outtextxy(30,300," Back to main menu");
outtextxy(10,450,"Navigate using arrow keys.");
ch=getch();
while (ch!=13)
{if (ch==80) //Down Arrow
{setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(20,200+(cur*60),20,20);
++cur;
if (cur>2)
cur = 2;
setcolor(RED);
setfillstyle(1,RED);
fillellipse(20,200+(cur*60),20,20);}
else if(ch==72) //UP Arrow
{setcolor(BLACK);
setfillstyle(1,BLACK);
fillellipse(20,200+(cur*60),20,20);
--cur;
if (cur<0)
cur=0;
setcolor(RED);
setfillstyle(1,RED);
fillellipse(20,200+(cur*60),20,20);}
ch=getch();
}
if((cur==0)||(cur==1))
{if(p==0);
else
{for (i=0;i<23;i++)
cout<<endl;
}
}
if (cur==2)
return(5);
else
return(cur+1);
}
else if(n==1)
return(4);
}
示例5: multiPlayer
/*Checks for winning formations, declares the winner and ends the game */
void multiPlayer ()
{
Player p1,p2;
int r[6][7],c[6][7],ld[6][7],rd[6][7],i,j,res=0,n,win=0,ch,t,cp,flag=0;
char n1[20],n2[20];
for(i=0;i<6;i++)
{for(j=0;j<7;j++)
r[i][j]=c[i][j]=ld[i][j]=rd[i][j]=0;}
setcolor(YELLOW);
settextstyle(1,0,2);
cout<<"Player one: ";
//outtextxy(10,340,"Player one name: ");
gets (p1.name);
strcpy(n1,p1.name);
strcat(n1," wins!");
getch();
//outtextxy(10,370,"Player two name: ");
//cout<<"\nPlayer two name: ";
cout<<"\nPlayer two: ";
gets (p2.name);
strcpy(n2,p2.name);
strcat(n2," wins!");
setcolor(BLUE);
settextstyle(1,0,4);
while(res==0)
{puts(p1.name);
n = dispBoard(r,1);
cp=coinPos(n,r);
if(insRow(n,1,cp,r)==1)
{drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,RED);
delay(DEL);
winDisp();
outtextxy(xc,yc,n1);
++res;
UpdatePStats(p1,'w');
UpdatePStats(p2,'l');
break;}
if(insCol(n,1,cp,c)==1)
{drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,RED);
delay(DEL);
winDisp();
outtextxy(xc,yc,n1);
++res;
UpdatePStats(p1,'w');
UpdatePStats(p2,'l');
break;}
if(insLDia(n,1,cp,ld)==1)
{drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,RED);
delay(DEL);
winDisp();
outtextxy(xc,yc,n1);
++res;
UpdatePStats(p1,'w');
UpdatePStats(p2,'l');
break;}
if(insRDia(n,1,cp,rd)==1)
{drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,RED);
delay(DEL);
winDisp();
outtextxy(xc,yc,n1);
++res;
UpdatePStats(p1,'w');
UpdatePStats(p2,'l');
break;}
clrscr();
puts(p2.name);
n=dispBoard(r,2);
cp=coinPos(n,r);
if (cp<0)
{cout<<"\n\n\Please put coin in proper position";
++res;
break;}
if(insRow(n,-1,cp,r)==-1)
{drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,GREEN);
delay(DEL);
winDisp();
outtextxy(xc,yc,n2);
++res;
UpdatePStats(p2,'w');
UpdatePStats(p1,'l');
break;}
if(insCol(n,-1,cp,c)==-1)
{
drawround(n-1,-1,ray,WHITE);
drawround(n-1,cp,ray,GREEN);
delay(DEL);
winDisp();
outtextxy(xc,yc,n2);
++res;
UpdatePStats(p2,'w');
UpdatePStats(p1,'l');
break;}
//.........这里部分代码省略.........
示例6: scoring
int scoring(int &score,int pos[200][8])
{ char pop[5],count=0,p;
ascii(score,pop,score);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
if(score<0)
{score=0;
}
setfillstyle(1,4);
bar(420,260,540,385);
outtextxy(435,285,"SCORE" );
if(score==0)
{outtextxy(475,330,"0");
}
else if(score>0&&score<10)
{ outtextxy(475,330,pop );
}
else if(score>=10&&score<100)
{ outtextxy(465,330,pop );
}
else if(score>99&&score<1000)
{ outtextxy(450,330,pop);
}
else if(score>999)
{ outtextxy(440,330,pop);
}
for(p=0;p<100;p++)
{
if(pos[p][0]==300&&pos[p][1]==150)
{count++;
}
if(count>0)
{ cleardevice();
setbkcolor(14);
setcolor(1);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
outtextxy(220,110,"GAME OVER !!");
setfillstyle(1,4);
bar(210,170,430,250);
setcolor(15);
outtextxy(230,200,"SCORE : " );
ascii(score,pop,score);
if(score==0)
{outtextxy(475,200,"0");
}
else if(score>0&&score<10)
{ outtextxy(370,200,pop );
}
else if(score>=10&&score<100)
{ outtextxy(365,200,pop );
}
else if(score>99&&score<1000)
{ outtextxy(350,200,pop);
}
else if(score>999)
{ outtextxy(345,200,pop);
}
setcolor(2);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(120,250,"We hope that you enjoyed our game" );
outtextxy(120,290,"to the fullest. Please give your " );
outtextxy(120,330,"prescious feedback on our website " );
setcolor(12);
outtextxy(200,370,"www.catexpo_games.com " );
getch();
closegraph();
exit(0);
}
}
settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
return 0;
}
示例7: main
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
int choice;
while(!kbhit())
{
setcolor(WHITE);
setbkcolor(2);
setcolor(YELLOW);
circle(300,100,30);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(300,100,YELLOW);
setcolor(BLACK);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(292,88,2,6);
fillellipse(308,88,2,6);
ellipse(300,103,185,355,20,8);
ellipse(300,103,185,355,20,9);
ellipse(300,103,185,355,20,10);
setcolor(WHITE);
settextstyle(0, HORIZ_DIR,6);
outtextxy(180,200,"HIT IT");
settextstyle(DEFAULT_FONT, HORIZ_DIR,2);
outtextxy(130,400,"(Press any key to start)");
settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
rectangle(0,0,639,479);
}
sound(500);
delay(100);
nosound();
clearviewport();
setcolor(WHITE);
getch();
do
{
settextstyle(DEFAULT_FONT, HORIZ_DIR, 5);
outtextxy(200,50,"HIT IT");
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(200,150,"1.NEW GAME");
outtextxy(200,200,"2.INSTRUCTIONS");
outtextxy(200,250,"3.CREDITS");
outtextxy(200,300,"4.EXIT");
rectangle(0,0,639,479);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
outtextxy(175,372,"PLEASE ENTER YOUR CHOICE(1-4):");
gotoxy(53,24);
choice = _bios_keybrd(_KEYBRD_READ);
switch(choice)
{
case 561:sound(500);
delay(100);
nosound();
clearviewport();
for(int i=1,r=10;;i++,r+5)
{
game(i);
if(score>=r)
{
setcolor(RED);
setfillstyle(SOLID_FILL,BROWN);
bar(130,200,390,300);
rectangle(130,200,390,300);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
setcolor(WHITE);
outtextxy(145,240,"CONGRATULATIONS");
delay(2000);
clearviewport();
//.........这里部分代码省略.........
示例8: main
void main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "\\tc\\bgi");
cleardevice();
// char str[1]; str[1]='\0';
file.open("Info.TXT",ios::in|ios::binary);
if(!file)
cout<<"File couldnt be opened";
x=20; y=getmaxy()-70;
settextstyle(2,0,5);
setvalues();
board();
coins();
getch();
typeon();
getch();
cleardevice();
x=20; y=200;
pic("ch pic");
typeon();
y+=20;
typeon();
getch();
cleardevice();
pic("ch pic2");
x=20; y=200;
typeon();
getch();
cleardevice();
king(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
rook(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
bishop(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
queen(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
knight(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
pawn(getmaxx()/2-30,30,1);
x=20; y=100;
typeon();
getch();
cleardevice();
pic("ch pic3");
x=20; y=50;
typeon();
getch();
file.close();
closegraph();
}
示例9: gameHandler
//function which centrally controls the execution of game
void gameHandler(){
settextstyle(0,0,6);
outtextxy(180,200,"DX-Ball");
getch();
clearviewport();
brickLen=25,brickBred=15;
for(int i=0;i<20;i++)
for(int j=0;j<8;j++)
isBrick[i][j]=1;
drawBricks();
b.cx=20;
b.cy=240;
b.xIncre=1;
b.yIncre=1;
b.radius=5;
br.size=80;
br.movement=10;
score=0;
livesRemain[0]=' ';
livesRemain[1]=' ';
strcat(livesRemain,"live(s) remaining.");
b.lives=3;
line(500,0,500,480);
settextstyle(0,0,2);
outtextxy(535,200,"Score:");
settextstyle(0,0,2);
setScoreString();
outtextxy(535,230,scoreString);
outtextxy(535,320,"Lives:");
setLivesString();
outtextxy(565,350,livesString);
b.ulimit=0;
b.llimit=0;
b.rlimit=500;
br.llimit=0;
br.rlimit=500;
br.rePositionBar(0);
br.drawBar();
int ch='a';
while(1){
while(!kbhit()){
delay(4);
b.removePreviousBall();
changeScore();
initializeVariables();
whetherBallTouchesBrick();
b.drawBall();
br.removePreviousBar();
br.drawBar();
line(500,0,500,480);
}
ch=getch();
if(ch=='a'){
br.removePreviousBar();
br.rePositionBar('a');
br.drawBar();
}
if(ch=='s'){
br.removePreviousBar();
br.rePositionBar('s');
br.drawBar();
}
if(ch=='p')
ch=getch();
if(ch=='q'){
displayAbout();
getch();
exit(0);
}
}
}
示例10: main
main()
{
int gd=DETECT,gm,maxx,maxy,x,y,xp,yp,button,ch=0,i=1,flag=0;
initgraph(&gd,&gm,"");
maxx=getmaxx();
maxy=getmaxy();
setbkcolor(BLACK);
setlinestyle(SOLID_LINE,1,3);
rectangle(0,56,maxx,maxy);
setviewport(1,1,maxx-1,maxy-1,1);
/*gotoxy(10,1);
printf("1=CIRCLE");
gotoxy(20,1);
printf("2=LINE");*/
setcolor(LIGHTCYAN);
settextstyle(5,0,3);
outtextxy(200,0,"CATCH ME IF YOU CAN");
if(initmouse()==0)
{
closegraph();
restorecrtmode();
printf("mouse driver not loaded");
getch();
exit(1);
}
restrictmouseptr(1,57,maxx-1,maxy-1);
getmousepos(&button,&x,&y);
xp=x;
yp=y;
showmouseptr();
while(!kbhit())
{
setcolor(i);
setlinestyle(SOLID_LINE,0,2);
xp=x;
yp=y;
getmousepos(&button,&x,&y);
while((button & 1)==1)
{
setcolor(RED);
circle(xp,yp,x-xp);
delay(20);
setcolor(BLACK);
circle(xp,yp,x-xp);
getmousepos(&button,&x,&y);
flag=1;
}
if(flag==1)
{
setcolor(RED);
circle(xp,yp,x-xp);
flag=0;
}
if(xp!=x && yp!=y)
{
setcolor(i);
settextstyle(5,0,1);
outtextxy(380,440,"designed by:Soumen Mukherjee");
i++;
if(i==15)
i=1;
}
}
ch=getch();
if(ch==13)
{
closegraph();
restorecrtmode();
exit(1);
}
if(ch==1)
cleardevice();
main();
}
示例11: barra_titulo
//***********************
void barra_titulo(int x1,int y1, int x2,char N []){
setfillstyle(1,1);bar(x1,y1,x2,y1+18);
setcolor(15);settextstyle(0,0,0);outtextxy(x1+26,y1+5,N);
}
示例12: ScreenSaver
void ScreenSaver(void)
{
randomize();
int gDriver=DETECT, gMode,errorcode;
initgraph(&gDriver,&gMode,"");
errorcode=graphresult();
if(errorcode!=grOk)
{
printf("ERROR: %s\nPress any key to EXIT\n",grapherrormsg(errorcode));
getch();
exit(1);
}
//******START***********
int x=1,y=1,i=0,j=0,intsymbol,bkColor=0,Color=2;
char *symbol;
setbkcolor(bkColor);
setcolor(Color);
unsigned int A_Size=imagesize(553,390,625,467);
void *bigTemp=malloc(A_Size);
memset(bigTemp,0,sizeof(bigTemp));
getimage(25,10,85,90,bigTemp);
setcolor(15);
Rect(1,1,100);
T(50,15,14);
setcolor(15);
Line(50,101,266,"v");
Rect(1,370,100);
E(50,390,14);
setcolor(15);
Line(100,420,430,"h");
Rect(530,370,100);
A(580,390,2);
setcolor(15);
Line2(101,50,580,369);
Rect(530,1,100);
M(580,30,14);
setcolor(15);
Paraleli(100,100,100,370,"h");
Paraleli(100,100,530,100,"v");
settextstyle(0,0,2);
unsigned int T_Size=imagesize(25,10,85,90);
unsigned int E_Size=imagesize(25,390,85,465);
unsigned int M_Size=imagesize(545,10,625,90);
unsigned int temp_Size=imagesize(220,250,281,252);
void *T_Array=malloc(T_Size);
void *E_Array=malloc(E_Size);
void *A_Array=malloc(A_Size);
void *M_Array=malloc(M_Size);
void *temp_Array=malloc(temp_Size);
void *temp_A=malloc(A_Size);
memset(T_Array,0,sizeof(T_Array));
memset(E_Array,0,sizeof(E_Array));
memset(A_Array,0,sizeof(A_Array));
memset(M_Array,0,sizeof(M_Array));
memset(temp_Array,0,sizeof(temp_Array));
memset(temp_A,0,sizeof(temp_A));
getimage(25,10,85,90,T_Array);
getimage(25,390,85,465,E_Array);
getimage(553,390,625,467,A_Array);
getimage(545,10,625,90,M_Array);
getimage(220,250,281,252,temp_Array);
///*****WORK WITH BITMAPS************
int i_E,j_E,i_A,j_A,i_M,j_M;
putimage(380,120,M_Array,COPY_PUT);
putimage(380,260,A_Array,COPY_PUT);
for(i=150,j=110,i_E=110,j_E=290,i_A=380,j_A=260,i_M=400,j_M=120;(j<220)&&(i_A>280)&&(i_E<220);j++,i_E++,i_A--)
{
putimage(i,j,T_Array,COPY_PUT);
putimage(i_E,j_E,E_Array,COPY_PUT);
delay(LETTERSPEED);
while((j_E>253)&&(i_M>330))
{
putimage(i_E,j_E,E_Array,COPY_PUT);
j_E--;
putimage(i_M,j_M,M_Array,COPY_PUT);
i_M--;
}
putimage(i_A,j_A,A_Array,COPY_PUT);
}
while(j_M<240)
{
putimage(i_M,j_M,M_Array,COPY_PUT);
j_M++;
if((j_M>200)&&(j_M<220))
i_M--;
}
for(;j_E>120;j_A--,j_E--,j_M--)
{
putimage(i_E,j_E,E_Array,COPY_PUT);
putimage(i_A+random(2),j_A,A_Array,COPY_PUT);
putimage(i_M,j_M,M_Array,COPY_PUT);
}
setcolor(14);
for(;j_E<215;j_E++,j_M++)
{
//.........这里部分代码省略.........
示例13: main
void main(){
int monitor=VGA, modo=VGAHI;
int num[6], secuencia[3],correcto=-1;
int c1,c2,c3,b,x,y,fig=-1,n_res=0,n_ok=0,nv_imagen=-1,n_cuadro=-1,op_menu=0,op_menu1=0,op_menu3=0;
char *animal[9]={"imagen\\bear.bmp","imagen\\fish.bmp","imagen\\frog.bmp","imagen\\lamb.bmp","imagen\\tiger.bmp","imagen\\chipmunk.bmp","imagen\\donkey.bmp","imagen\\mouse.bmp","imagen\\rabbit.bmp"};
unsigned x_pos,y_pos,num_boton;
char r='n',s='n';
initgraph(&monitor,&modo,"\BGI");
cleardevice();
iniciarRaton();
menuprincipal();
mostrarRaton();
do{
x_pos=posicionHorizontal();
y_pos=posicionVertical();
num_boton=botonPresionado();
if(num_boton==1){ //Revisa en el area de que boton, se hizo click
if(x_pos>500 && x_pos<550 && y_pos>170 && y_pos<190 ) op_menu=1;
else if(x_pos>500 && x_pos<550 && y_pos>(170+40) && y_pos<(190+40) ) op_menu=2;
else if(x_pos>500 && x_pos<550 && y_pos>(170+80) && y_pos<(190+80) ) op_menu=3;
else if(x_pos>500 && x_pos<550 && y_pos>(170+120) && y_pos<(190+120)) op_menu=4;
else if(x_pos>500 && x_pos<550 && y_pos>(170+160) && y_pos<(190+160)) op_menu=5;
}
switch(op_menu){
case 1:{
do{
s='n';
cleardevice();
ocultarRaton();
busqueda_animales();
mostrarRaton();
//Llenado de num[] con numeros sin repetir de las imagenes a utilizar
randomize();
for(c1=0;c1<6;c1++){
num[c1]=rand()%9;
c2=0;
while(c2<c1){ //revisa desde num[0] hasta la posicion que se acaba de escoger
if (num[c1]==num[c2])
c2=c1--;
c2++;
}
}
//despliegue de las 6 imagenes seleccionadas
ocultarRaton();
c3=0;
for(c1=17;c1<=249;c1+=116)
for(c2=122;c2<=240;c2+=118)
imagen(c1,c2,animal[num[c3++]]);
mostrarRaton();
do{
x_pos=posicionHorizontal();
y_pos=posicionVertical();
num_boton=botonPresionado();
if(num_boton==1){ //Revisa en el area de que dibujo, se hizo click
if(x_pos> 17 && x_pos<133 && y_pos>122 && y_pos<238) op_menu1=1;
else if(x_pos> 17 && x_pos<133 && y_pos>240 && y_pos<356) op_menu1=2;
else if(x_pos>133 && x_pos<249 && y_pos>122 && y_pos<238) op_menu1=3;
else if(x_pos>133 && x_pos<249 && y_pos>240 && y_pos<356) op_menu1=4;
else if(x_pos>249 && x_pos<365 && y_pos>122 && y_pos<238) op_menu1=5;
else if(x_pos>249 && x_pos<365 && y_pos>240 && y_pos<356) op_menu1=6;
}
//impresion de imagen clickada
if(1<=op_menu1 && op_menu1<=6){
ocultarRaton();
setfillstyle(1,DARKGRAY);
bar(getmaxx()*9/16+20,getmaxy()/4,getmaxx()-30,getmaxy()*3/4);
rectangle(378,getmaxy()/4-1,610,getmaxy()*3/4+1);
imagen(436,180,animal[num[op_menu1-1]]);
rectangle(436,180,550,295); n_res=1; n_cuadro=op_menu1; fig=num[op_menu1-1];
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
setcolor(WHITE);
outtextxy(383,120,"¨Cual es el nombre");
outtextxy(405,140,"de este animal?");
outtextxy(270,440,"opciones");
n_ok=0;
mostrarRaton();
}
// Revision de area textual clickada e impresion de nombre clickado + OK
if(num_boton==1){
if(n_ok==1){
setfillstyle(SOLID_FILL,RED); bar(392,320,518,345);
rectangle(392,320,518,345); setcolor(WHITE);
}
if(x_pos>61 && x_pos<164 && y_pos>382 && y_pos<408){
outtextxy(430,315,"Bear"); nv_imagen=1;
n_ok=1;
}
else if(x_pos>164 && x_pos<267 && y_pos>382 && y_pos<408){
outtextxy(430,315,"Fish"); nv_imagen=2;
n_ok=1;
//.........这里部分代码省略.........
示例14: main
void main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "\\tc\\bgi");
cleardevice();
char name[30]={"ch1"};
king(name);
hand3(375,215,92,30);
int Mstatus = initmouse();
int button,m,n,slot;
int z=0;
settextstyle(2,0,4);
outtextxy(230,130,"LOADING");
/* outtextxy(220,165,"Slot 1");
// rectangle(215,164,300,177);
// rectangle(215,179,300,192);
// rectangle(215,194,300,207);
rectangle(215,209,300,222);
rectangle(215,224,300,237);
rectangle(215,239,300,252);
rectangle(215,254,300,267);
rectangle(215,269,300,282);
rectangle(215,284,300,297);
outtextxy(220,180,"Slot 2");
outtextxy(220,195,"Slot 3");
outtextxy(220,210,"Slot 4");
outtextxy(220,225,"Slot 5");
outtextxy(220,240,"Slot 6");
outtextxy(220,255,"Slot 7");
outtextxy(220,270,"Slot 8");
outtextxy(220,285,"Slot 9");
outtextxy(220,300,"Slot 10");
*/
if(Mstatus == 0 )
outtextxy(50,50, "Mouse Support Not Available");
// changecursor(cursor);
while(!kbhit())
{ showmouseptr();
getmousepos(&button,&m,&n);
if(m>245 && m<325 && n>320 && n<332)
{ setcolor(RED);
outtextxy(250,320,"BACK"); }
else
{ setcolor(WHITE);
outtextxy(250,320,"BACK");
if(m>215 && m<300 && n>164 && n<177)
{ setcolor(RED);
outtextxy(220,165,"Slot 1"); }
else
{ setcolor(WHITE);
outtextxy(220,165,"Slot 1");
if(m>215 && m<300 && n>179 && n<192)
{ setcolor(RED);
outtextxy(220,180,"Slot 2"); }
else
{ setcolor(WHITE);
outtextxy(220,180,"Slot 2");
if(m>215 && m<300 && n>194 && n<207)
{ setcolor(RED);
outtextxy(220,195,"Slot 3"); }
else
{ setcolor(WHITE);
outtextxy(220,195,"Slot 3");
if(m>215 && m<300 && n>209 && n<222)
{ setcolor(RED);
outtextxy(220,210,"Slot 4"); }
else
{ setcolor(WHITE);
outtextxy(220,210,"Slot 4");
if(m>215 && m<300 && n>224 && n<237)
{ setcolor(RED);
outtextxy(220,225,"Slot 5"); }
else
{ setcolor(WHITE);
outtextxy(220,225,"Slot 5");
if(m>215 && m<300 && n>239 && n<252)
{ setcolor(RED);
outtextxy(220,240,"Slot 6"); }
else
{ setcolor(WHITE);
outtextxy(220,240,"Slot 6");
if(m>215 && m<300 && n>254 && n<267)
{ setcolor(RED);
outtextxy(220,255,"Slot 7"); }
else
{ setcolor(WHITE);
outtextxy(220,255,"Slot 7");
if(m>215 && m<300 && n>269 && n<282)
{ setcolor(RED);
outtextxy(220,270,"Slot 8"); }
else
{ setcolor(WHITE);
outtextxy(220,270,"Slot 8");
if(m>215 && m<300 && n>284 && n<297)
//.........这里部分代码省略.........
示例15: main
void main()
{
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "\\tc\\bgi");
cleardevice();
king("ch1");
int Mstatus = initmouse();
int button,m,n,slot;
settextstyle(2,0,4);
outtextxy(230,130,"SAVING");
if(Mstatus == 0 )
outtextxy(50,50, "Mouse Support Not Available");
while(!kbhit())
{ showmouseptr();
getmousepos(&button,&m,&n);
if(m>245 && m<325 && n>320 && n<332)
{ setcolor(RED);
outtextxy(250,320,"BACK"); }
else
{ setcolor(WHITE);
outtextxy(250,320,"BACK");
if(m>215 && m<300 && n>164 && n<177)
{ setcolor(RED);
outtextxy(220,165,"Slot 1"); }
else
{ setcolor(WHITE);
outtextxy(220,165,"Slot 1");
if(m>215 && m<300 && n>179 && n<192)
{ setcolor(RED);
outtextxy(220,180,"Slot 2"); }
else
{ setcolor(WHITE);
outtextxy(220,180,"Slot 2");
if(m>215 && m<300 && n>194 && n<207)
{ setcolor(RED);
outtextxy(220,195,"Slot 3"); }
else
{ setcolor(WHITE);
outtextxy(220,195,"Slot 3");
if(m>215 && m<300 && n>209 && n<222)
{ setcolor(RED);
outtextxy(220,210,"Slot 4"); }
else
{ setcolor(WHITE);
outtextxy(220,210,"Slot 4");
if(m>215 && m<300 && n>224 && n<237)
{ setcolor(RED);
outtextxy(220,225,"Slot 5"); }
else
{ setcolor(WHITE);
outtextxy(220,225,"Slot 5");
if(m>215 && m<300 && n>239 && n<252)
{ setcolor(RED);
outtextxy(220,240,"Slot 6"); }
else
{ setcolor(WHITE);
outtextxy(220,240,"Slot 6");
if(m>215 && m<300 && n>254 && n<267)
{ setcolor(RED);
outtextxy(220,255,"Slot 7"); }
else
{ setcolor(WHITE);
outtextxy(220,255,"Slot 7");
if(m>215 && m<300 && n>269 && n<282)
{ setcolor(RED);
outtextxy(220,270,"Slot 8"); }
else
{ setcolor(WHITE);
outtextxy(220,270,"Slot 8");
if(m>215 && m<300 && n>284 && n<297)
{ setcolor(RED);
outtextxy(220,285,"Slot 9"); }
else
{ setcolor(WHITE);
outtextxy(220,285,"Slot 9");
if(m>215 && m<300 && n>299 && n<312)
{ setcolor(RED);
outtextxy(220,300,"Slot 10"); }
else
{ setcolor(WHITE);
outtextxy(220,300,"Slot 10");
}}}}}}}}}}}
if(button == 1)
{ if(m>245 && m<325 && n>320 && n<332)
{ hidemouseptr();
video(450,150);
// spawnl(P_WAIT,"g:\\exe\\menu1.exe", NULL); // back to main menu
break; }
if(m>215 && m<300 && n>164 && n<177)
{ hidemouseptr();
video(450,150);
slot=1;
save(slot); }
if(m>215 && m<300 && n>179 && n<192)
//.........这里部分代码省略.........