本文整理汇总了C++中setcolor函数的典型用法代码示例。如果您正苦于以下问题:C++ setcolor函数的具体用法?C++ setcolor怎么用?C++ setcolor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setcolor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy,i,j,f;
float ar,rr,a;
float x [4],y[4];
/* initialize graphics and local
variables */
initgraph(&gdriver, &gmode, "");
/* read result of initi
alization */
errorcode = graphresult();
if (errorcode != grOk) /* an error
occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error
code */
}
setcolor(13);
midx = getmaxx() / 2;
midy = getmaxy() / 2;
ar=6.283185307/d;
rr=midy;
for(f=1;f<=d;f++)
{
x[0]=midx;
y[0]=midy;
a=(f-1)*ar;
x[1]=cos(a)*rr+midx;
y[1]=sin(a)*rr+midy;
a=f*ar;
x[2]=cos(a)*rr+midx;
y[2]=sin(a)*rr+midy;
x[3]=x[0];
y[3]=y[0];
for(j=1;j<=r;j++)
{
for(i=0;i<3;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
if(f%2==1)
{
for(i=3;i>0;i--)
{
x[i]+=(x[i-1]-x[i])/z;
y[i]+=(y[i-1]-y[i])/z;
}
x[0]=x[3];
y[0]=y[3];
}
else
{
for(i=0;i<3;i++)
{
x[i]+=(x[i+1]-x[i])/z;
y[i]+=(y[i+1]-y[i])/z;
}
x[3]=x[0];
y[3]=y[0];
}//end if else
}//end for j
}
getch();
closegraph();
}
开发者ID:kariminf,项目名称:Arcaika,代码行数:72,代码来源:OPART2.CPP
示例2: colorcombo_init
void
colorcombo_init ()
{
if (!flag_basiccolorname)
{
flag_basiccolorname = "darkgreen";
}
#define setcolor(idx, cname) \
colorcombo[idx].name = # cname; colorcombo[idx].color = cname;
setcolor (0, darkgreen);
setcolor (1, darkorange);
setcolor (2, yellowgreen);
setcolor (3, seagreen);
setcolor (4, darkskyblue);
setcolor (5, indianred);
setcolor (6, maroon);
setcolor (7, khaki);
setcolor (8, seagreen);
setcolor (9, chocolate);
setcolor (10, darkorchid);
set_basiccolorpixel (flag_basiccolorname);
}
开发者ID:CecilHarvey,项目名称:netmaj,代码行数:25,代码来源:bdcolor.c
示例3: monitor_tools
void monitor_tools(int n,int t)
{
getmousepos(&button,&mousex,&mousey);
for(;mousey<20;getmousepos(&button,&mousex,&mousey))
{
if((mousex/20>0)&&(mousex/20)<=n&&(mousex/20)!=button_track)
{
button_track=mousex/20;
top_panel_buttons(n,button_track,2);
if(t==0)
{
hidemouseptr();
settextstyle(0,0,1);
if(cur_color==0)
setcolor(WHITE);
else
setcolor(BLACK);
hover_text(mousex/20);
showmouseptr();
}
}
else if(mousex<20&&button==1&&t!=0)
{
cur_panel=0;
t=0;
cur_style=1;
n=tool_but_num;
button_hover(2,2,18,18);
top_panel_default();
top_panel_buttons(tool_but_num,0,1);
button_click((2+cur_tool*20),2,(18+cur_tool*20),18);
}
else if(t==0&&mousex>619&&button==1)
{
button_hover(620,2,638,18);
ask_exit();
}
else if(((mousex/20)==0||(mousex/20>(n+1)))&&button_track!=-1)
{
button_track=-1;
top_panel_buttons(n,0,2);
if(t==0)
button_click((2+cur_tool*20),2,(18+cur_tool*20),18);
else if(t==1)
button_click((2+cur_style*20),2,(18+cur_style*20),18);
}
if((mousex/20>0)&&(mousex/20)<=n&&button==1)
{
if(t==0)
{
if(button_track!=18)
cur_tool=button_track;
button_hover((2+button_track*20),2,(18+button_track*20),18);
if(button_track==18)
{
cur_panel=2;
draw_color();
}
draw_style();
break;
}
else
{
cur_style=button_track;
button_hover((2+cur_style*20),2,(18+cur_style*20),18);
}
}
}
}
开发者ID:karthikbellur,项目名称:drawmeinDOS,代码行数:70,代码来源:gui.c
示例4: drawfriendreq
static void drawfriendreq(int x, int y, int width, int height)
{
setcolor(C_TITLE);
setfont(FONT_SELF_NAME);
drawstr(LIST_RIGHT + SCALE * 5, SCALE * 10, "Friend Request");
}
开发者ID:notadecent,项目名称:uTox,代码行数:6,代码来源:ui.c
示例5: drawsettings
static void drawsettings(int x, int y, int width, int height)
{
setcolor(C_TITLE);
setfont(FONT_SELF_NAME);
drawstr(LIST_RIGHT + SCALE * 5, SCALE * 10, "User Settings");
}
开发者ID:notadecent,项目名称:uTox,代码行数:6,代码来源:ui.c
示例6: MelhorProvaVVM
void MelhorProvaVVM(int old, int nnew)
{
register int i, ncol, nlin,
escala, y0,
y1, y2;
int y_ini0, y_ini1;
int cor;
int janelaAtiva;
float far *apt;
float far *aptaux;
register float flux, sum_flux;
float sum[4];
char *p_ch;
char setaE[2],
setaD[2];
setaE[0] = 27;
setaD[0] = 26;
setaE[1] = setaD[1] = '\0';
#ifndef MODO_VGA_640X480_HIG
setactivepage(1);
setvisualpage(1);
#else MODO_VGA_640X480_HIG
LimpaTela();
#endif MODO_VGA_640X480_HIG
setviewport ( 0, 0, MAXX, MAXY, 1 );
clearviewport ();
cor = getcolor();
setcolor (bea_color[12]);
CriaJanelaGrafica( MANOB1,
0,
0,
(int) ((MAXX * 49L)/100),
(int) ((MAXY * 90L)/100),
0, "MANOBRA %02d", old );
clearviewport();
CriaJanelaGrafica( MANOB2,
(int) ((MAXX * 51L)/100),
0,
MAXX,
(int) ((MAXY * 90L)/100),
0,
"MANOBRA %02d", nnew );
clearviewport();
setcolor (cor);
AtivaJanelaGrafica(MANOB1,0);
setcolor ( bea_color[14] );
getviewsettings (&vp);
DesenhaEixos( DELTA_X(2), DELTA_X(96),
DELTA_Y(4), DELTA_Y(98),
DELTA_X(6), DELTA_Y(22),
DELTA_X(22),DELTA_Y(14) );
sum_flux = 0.0;
escala = DELTA_Y(14);
coluna = DELTA_X( 8);
y0 = y_ini0 = DELTA_Y(76);
y2 = y1 = y_ini1 = DELTA_Y(92);
apt = inicVVM2;
aptaux = inicVVM2Int;
sum[0] = sum[1] =
sum[2] = sum[3] = 0.0;
ScalaVVMBetter();
for ( i = 0;
(*apt != FIM_1) &&
(apt < inicVVM2 + NUMMAXPONTOSINF);
apt++, i++ )
{
flux = *aptaux; aptaux++;
#ifdef VVM_ALCAP_
sum_flux += flux / SampleRatio;
sum[0] = (.01 * sum_flux) + (.19 * sum[1]) +
(.30 * sum[2]) + (.50 * sum[3]);
sum[3] = sum[2];
sum[2] = sum[1];
sum[1] = sum[0];
#else VVM_ALCAP_
sum_flux = sum_flux;
//.........这里部分代码省略.........
开发者ID:imcchaves,项目名称:beatriceimc,代码行数:101,代码来源:VENTVOL.C
示例7: landing
void landing(){
x = 0;
y = 0;
cleardevice();
while( x < 500 ){
cleardevice();
line( 280, 304, 639, 304);
x++;
setcolor(9);
if( x < 200 ){
y += 1;
//flight outline
line( x, y, x+20, y+20 );
line( x, y, x, y+40 );
line( x+20, y+20, x+80, y+20 );
line( x+80, y+20, x+100, y+40 );
line( x, y+40, x+100, y+40 );
floodfill( x+75, y+27, 9);
//inner rectangle
setcolor(10);
rectangle( x+70, y+24, x+80, y+30 );
floodfill( x+75, y+27, 10);
}
else if( x < 250 ){
y += 1;
line( x, y, x+20, y+20 );
line( x, y, x, y+40 );
line( x+20, y+20, x+80, y+20 );
line( x+80, y+20, x+100, y+40 );
line( x, y+40, x+100, y+40 );
floodfill( x+75, y+27, 9);
//inner rectangle
setcolor(10);
rectangle( x+70, y+24, x+80, y+30 );
floodfill( x+75, y+27, 10);
//wheel
line(x+30, y+40, x+20, y+44 );
line(x+80, y+40, x+70, y+44 );
setcolor(125);
circle( x+25, y+44, 3);
floodfill( x+25, y+44, 5);
circle( x+75, y+44, 3);
floodfill( x+75, y+44, 5);
}
else{
line( x, y, x+20, y+20 );
line( x, y, x, y+40 );
line( x+20, y+20, x+80, y+20 );
line( x+80, y+20, x+100, y+40 );
line( x, y+40, x+100, y+40 );
floodfill( x+75, y+27, 9);
//inner rectangle
setcolor(10);
rectangle( x+70, y+24, x+80, y+30 );
floodfill( x+75, y+27, 10);
//wheel
line(x+30, y+40, x+30, y+46 );
line(x+80, y+40, x+80, y+46);
setcolor(125);
circle( x+30, y+50, 3);
floodfill( x+30, y+50, 5);
circle( x+80, y+50, 3);
floodfill( x+80, y+50, 5);
}
delay(1);
}
x = 0;
y = 0;
printf("\n\n\t\tYour flight has been landed safely!!!!\n");
getchar();
}
开发者ID:sachin-pandit,项目名称:Hobby-Projects,代码行数:80,代码来源:landing.c
示例8: introd
void introd()
{
int x,y,j,c,e,g,da;
cleardevice();
for(int ii=0;ii<=210;ii++)
{
sound(ii*10);
c=random(12);
setcolor(c);
circle(320,240,ii);
delay(50);
setcolor(BLACK);
circle(320,240,ii);
nosound();
}
for(int r=0;r<=640;r+=50)
{
sound(r+40);
setcolor(3);
line(1,r,640,r);
line(r,1,r,640);
line(1,1,840,640);
line(650,1,1,480);
delay(80);
nosound();
}
for(int t=0;t<=230;t+=8)
{
sound(t*10);
setcolor(3);
circle(320,240,t);
setcolor(3);
ellipse(320,240,0,360,t,80);
ellipse(320,240,0,360,80,t);
delay(80);
nosound();
}
for(int z=0;z<80;z++)
{
sound(500+z);
da=random(12);
setcolor(da);
circle(320,240,z);
delay(50);
nosound();
}
for(int q=80;q<340;q++)
{
sound(500*q);
setcolor(0);
circle(320,240,q);
delay(50);
nosound();
}
do
{
j=random(12);
setcolor(j);
settextstyle(3,0,6);
outtextxy(250,330,"SRIRAM");
outtextxy(240,80,"KARTHIK");
settextstyle(3,1,6);
outtextxy(150,140,"DEEPAK");
outtextxy(430,140,"SRIHARI");
}while(!kbhit());
getch();
}
开发者ID:yeskarthik,项目名称:Project-Shark,代码行数:67,代码来源:MENU2.CPP
示例9: main
main()
{
int i,ar,in,inp;
/*modo grafico*/
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"..\\bgi");
errorcode=graphresult();
if (errorcode!= grOk)
{
printf("Error grafico: %s/n",grapherrormsg(errorcode));
printf("Presione cualquier tecla:");
getch();
exit(1);
}
getch();
/* >>>>>>>>>>>>> INTRODUCCION <<<<<<<<<<<<<<<<*/
/* Background */
setcolor(1);
for (i=240; i>=0; i--)
{
/*delay(50);*/
rectangle(i,i,getmaxx()-i,getmaxy()-i);
}
setcolor(14);
rectangle(0,0,getmaxx(),getmaxy());
rectangle(1,1,getmaxx()-1,getmaxy()-1);
rectangle(2,2,getmaxx()-2,getmaxy()-2);
rectangle(3,3,getmaxx()-3,getmaxy()-3);
rectangle(4,4,getmaxx()-4,getmaxy()-4);
rectangle(5,5,getmaxx()-5,getmaxy()-5);
settextstyle(SMALL_FONT,VERT_DIR,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(20,420,"UNIVERSIDAD");
outtextxy(20,270,"SANTA");
outtextxy(20,115,"VINA");
outtextxy(614,420,"UNIVERSIDAD");
outtextxy(614,270,"SANTA");
outtextxy(614,115,"VINA");
setcolor(9);
rectangle(6,6,getmaxx()-6,getmaxy()-6);
rectangle(7,7,getmaxx()-7,getmaxy()-7);
rectangle(8,8,getmaxx()-8,getmaxy()-8);
rectangle(9,9,getmaxx()-9,getmaxy()-9);
rectangle(10,10,getmaxx()-10,getmaxy()-10);
rectangle(11,11,getmaxx()-11,getmaxy()-11);
settextstyle(SMALL_FONT,VERT_DIR,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(20,365,"TECNICA");
outtextxy(20,237,"MARIA");
outtextxy(20,91,"DEL");
outtextxy(614,365,"TECNICA");
outtextxy(614,237,"MARIA");
outtextxy(614,91,"DEL");
setcolor(4);
rectangle(12,12,getmaxx()-12,getmaxy()-12);
rectangle(13,13,getmaxx()-13,getmaxy()-13);
rectangle(14,14,getmaxx()-14,getmaxy()-14);
rectangle(15,15,getmaxx()-15,getmaxy()-15);
rectangle(16,16,getmaxx()-16,getmaxy()-16);
rectangle(17,17,getmaxx()-17,getmaxy()-17);
settextstyle(SMALL_FONT,VERT_DIR,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(20,315,"FEDERICO");
outtextxy(20,140,"SEDE");
outtextxy(20,71,"MAR");
outtextxy(614,315,"FEDERICO");
outtextxy(614,140,"SEDE");
outtextxy(614,71,"MAR");
/*fin background */
setcolor(4);
for(i=0; i<=133; i++)rectangle(50+i,50+i,580-i,190-i);
/*line (col1,fila1,col2,fila2) */
setcolor(14);
line(50,50,50,190);
line(51,50,51,190);
line(52,50,52,190);
line(580,50,580,190);
line(581,50,581,190);
line(582,50,582,190);
line(50,50,580,50);
line(50,51,580,51);
line(50,52,580,52);
//.........这里部分代码省略.........
开发者ID:coto,项目名称:assembler,代码行数:101,代码来源:GRAFICO.C
示例10: intro
void intro()
{
int midx,midy,maxx,maxy,maxcol;
midx = getmaxx() / 2;
midy = getmaxy() / 2;
maxx = getmaxx();
maxy = getmaxy();
maxcol= getmaxcolor();
/* select the fill style */
setfillstyle(10, maxcol);
/* fill the screen with the pattern */
bar(0, 0, maxx, maxy);
rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30) ;
rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25) ;
settextjustify(CENTER_TEXT, CENTER_TEXT);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 3); ///6 IS SIZE
setcolor(4);
outtextxy(315,125,"WELCOME");
outtextxy(310,170,"TO");
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 5);
outtextxy(324,250,"EULER's PATH FINDER");
getch();//delay(1200);
clrscr();
setfillstyle(10, maxcol);
/* fill the screen with the pattern */
bar(0, 0, maxx, maxy);
setcolor(15);
rectangle(midx/4,midy/4,7*midx/4+10,7*midy/4-30) ;
rectangle(midx/4-5,midy/4-5,7*midx/4+15,7*midy/4-25) ;
settextjustify(CENTER_TEXT, CENTER_TEXT);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 5);
setcolor(4);
outtextxy(330,200,"INTRODUCTION");
settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
outtextxy(325,250,"(If you don't want an introduction press Esc)");
if((getch())=='z')
return;
else
{
setfillstyle(10, maxcol);
bar(0, 0,maxx, midy/4-5);
bar(0, 0,midx/4-15, maxy);
bar(0, 7*midy/4-25,maxx, maxy);
bar(7*midx/4+15, 0,maxx, maxy);
setfillstyle(0, maxcol);
bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25) ;
rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30) ;
rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25) ;
settextjustify(CENTER_TEXT, CENTER_TEXT);
settextstyle(4, HORIZ_DIR, 4);
setcolor(4);
outtextxy(315,100,"INTRODUCTION");
settextstyle(1, HORIZ_DIR, 2);
outtextxy(350,160,"LEONARD EULAR was a Swiss mathmatician.");
outtextxy(330,185,"He is considered to be father of graph theory.");
outtextxy(330,210,"He solved the very famous Koingsberg bridge ");
outtextxy(330,235,"problem in 1736 in his very first paper of GT.");
/* draw ellipse */
line(240,260,480,260);
ellipse(300, 300, 0, 360, 40, 15);
ellipse(430,300,0,360,40,15);
line(340,300,390,300);
line(342,302,390,302);
line(240,340,480,340);
line(430,285,430,260);
line(432,285,432,260);
line(430,315,430,340);
line(432,315,432,340);
line(280,260,295,285);
line(282,260,297,285);
line(320,260,305,285);
line(318,260,303,285);
line(280,340,295,315);
line(282,340,297,315);
line(320,340,305,315);
line(318,340,303,315);
outtextxy(300,298,"A");
outtextxy(430,298,"B");
getch();//delay(2500);
clrscr();
setfillstyle(10, maxcol);
/* fill the screen with the pattern */
bar(0, 0,maxx, midy/4-5);
bar(0, 0,midx/4-15, maxy);
bar(0, 7*midy/4-25,maxx, maxy);
bar(7*midx/4+15, 0,maxx, maxy);
setfillstyle(0, maxcol);
bar(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25) ;
rectangle(midx/4-10,midy/4,7*midx/4+10,7*midy/4-30) ;
rectangle(midx/4-15,midy/4-5,7*midx/4+15,7*midy/4-25) ;
settextjustify(CENTER_TEXT, CENTER_TEXT);
settextstyle(4, HORIZ_DIR, 4);
outtextxy(290,95,"WHAT IS EULAR GRAPH??");
settextstyle(1, HORIZ_DIR, 2);
outtextxy(363,145,"In a graph G,if a closed walk contains ") ;
outtextxy(310,170,"all the edges of the grapg G,the walk is ");
//.........这里部分代码省略.........
开发者ID:skyllar,项目名称:Graph-Puzzle-Solver,代码行数:101,代码来源:graph_puzzle_solver.C
示例11: utox_draw_text_multiline_within_box
int utox_draw_text_multiline_within_box(int x, int y, /* x, y of the top left corner of the box */
int right, int top, int bottom,
uint16_t lineheight,
const char_t *data, uint16_t length, /* text, and length of the text*/
uint16_t h, uint16_t hlen,
uint16_t mark, uint16_t marklen,
_Bool multiline )
{
uint32_t c1, c2;
_Bool greentext = 0, link = 0, draw = y + lineheight >= top;
int xc = x;
char_t *a = data, *b = a, *end = a + length;
while(1) {
if(a != end) {
if(*a == '>' && (a == data || *(a - 1) == '\n')) {
c1 = setcolor(COLOR_MAIN_QUOTETEXT);
greentext = 1;
}
if((a == data || *(a - 1) == '\n' || *(a - 1) == ' ') && ((end - a >= 7 && memcmp(a, "http://", 7) == 0) || (end - a >= 8 && memcmp(a, "https://", 8) == 0))) {
c2 = setcolor(COLOR_MAIN_URLTEXT);
link = 1;
}
if(a == data || *(a - 1) == '\n') {
char_t *r = a;
while (r != end && *r != '\n') {
r++;
}
if (*(r - 1) == '<') {
if (greentext) {
setcolor(COLOR_MAIN_REDTEXT);
} else {
greentext = 1;
c1 = setcolor(COLOR_MAIN_REDTEXT);
}
}
}
}
if(a == end || *a == ' ' || *a == '\n') {
int count = a - b, w = textwidth(b, count);
while(x + w > right) {
if(multiline && x == xc) {
int fit = textfit(b, count, right - x);
if(draw) {
drawtexth(x, y, b, fit, b - data, h, hlen, lineheight);
drawtextmark(x, y, b, fit, b - data, mark, marklen, lineheight);
}
count -= fit;
b += fit;
y += lineheight;
draw = (y + lineheight >= top && y < bottom);
} else if(!multiline) {
int fit = textfit(b, count, right - x);
if(draw) {
drawtexth(x, y, b, fit, b - data, h, hlen, lineheight);
drawtextmark(x, y, b, fit, b - data, mark, marklen, lineheight);
}
return y + lineheight;
} else {
y += lineheight;
draw = (y + lineheight >= top && y < bottom);
int l = utf8_len(b);
count -= l;
b += l;
}
x = xc;
w = textwidth(b, count);
}
if(draw) {
drawtexth(x, y, b, count, b - data, h, hlen, lineheight);
drawtextmark(x, y, b, count, b - data, mark, marklen, lineheight);
}
x += w;
b = a;
if(link) {
setcolor(c2);
link = 0;
}
if(a == end) {
if(greentext) {
setcolor(c1);
greentext = 0;
}
break;
}
if(*a == '\n') {
if(greentext) {
setcolor(c1);
greentext = 0;
}
y += lineheight;
draw = (y + lineheight >= top && y < bottom);
b += utf8_len(b);
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:uTox,代码行数:101,代码来源:text.c
示例12: main
main()
{
int mode=VGAHI,driver=VGA;
char ch;
unsigned int l;
int i,gi,gj,j,flag=1;/*i,j是循环变量,flag是标记变量,-1:向x负半轴移动,+1:向x正半轴移动*/
double qx,qy,k,b=0.0,speech=0.4,x,y;
double r=2.0,bx=60.0,byy=270.0;
double pianx=100.0,piany=100.0,tx=20.0,ty=10.0,jx=2.0,jy=2.0;
int mx=0,my=0,mb,sum;/*sum纪录砖块的数目*/
FILE * p;
if((p = fopen("record.dat", "r")) == NULL)
{
p=fopen("record.dat","w");
fprintf(p,"0 0 0 0 0\n");
rewind(p);
}
fclose(p);
initgraph(&driver,&mode,"C:\\tc");
setbkcolor(BLUE);
Msinit();
Setmouse((int)(pianx+1+bx/2),(int)((tx+jx)*8+pianx-1-bx/2),(int)byy+piany,(int)byy+piany);
star: cleardevice();/*程序重载的介入点*/
setcolor(RED);
outtextxy(30,20,"^_^ Welcome to Play Hitting Brick Game! ^_^");
sum=0;
qx=100.0+pianx-10;qy=180.0+pianx-10;k=0.33;
setcolor(7);
rectangle((int)(pianx-2),(int)(piany-2),(int)((tx+jx)*8+2+pianx),302+piany);
setcolor(1);
rectangle((int)(pianx-1),(int)(piany-1),(int)((tx+jx)*8+1+pianx),301+piany);
/*读取盘面情况*/
p=fopen("record.dat", "r");
for(i=0;i<5;i++)
fscanf(p,"%x ",&zhuan[i]);
fclose(p);
/*画砖块*/
for(i=0;i<5;i++)
{
l=1;
for(j=0;j<16;j++)
{
if((zhuan[i]&l)==0)
{
Draw((int)((jx+tx)*((16*i+j)%8)+pianx+jx),(int)((jy+ty)*((int)((16*i+j)/8))+piany+jy),(int)tx,(int)ty);
sum+=1;
}
l=l*2;
}
}
gotoxy(5,4);
printf("Press any key to start game...Q key to quit...");
ch=getch();
if(ch=='q'||ch=='Q')
quitgame();
else
{
gotoxy(5,4);
printf(" ");
}
for(;;)
{
setfillstyle(1, 0);
bar(mx-bx/2,my,mx+bx/2,my+5);
Msread(&mx, &my, &mb);
Draw(mx-bx/2,my,bx,5);
setcolor(0);
mycircle(qx,qy,r,0);
/*判断求是否反弹*/
if(qx-r<=pianx+1 || qx+r>=(tx+jx)*8+pianx-1)
{
flag=-flag;
k=-k;
}
if(qy-r<=piany+1)
k=-k;
for(gi=0;gi<5;gi++)
{
l=1;
for(gj=0;gj<16;gj++)
{
if((zhuan[gi]&l)==0)
{
j=(16*gi+gj)/8;
i=(16*gi+gj)%8;
x=(jx+tx)*i+jx+tx/2+pianx;
y=(jy+ty)*j+jy+ty/2+piany;
/*边判断1*/
if(qy>=y-ty/2 && qy<=y+ty/2 &&(pow(qx+r-x+tx/2,2)<1 || pow(qx-r-x-tx/2,2)<1))
{
flag=-flag;
k=-k;
zhuan[gi]=zhuan[gi]|l;
sum-=1;
//.........这里部分代码省略.........
开发者ID:bearjb,项目名称:studyc,代码行数:101,代码来源:183.C
示例13: main
void main()
{
int Gd = DETECT, Gm;
int Drv;
char GrErr;
/* Find out which driver the user wants */
printf("Which driver would you like to use?\n");
printf(" 0) Svga16\n");
printf(" 1) Svga256\n");
printf(" 2) Svga32k\n");
printf(" 3) Svga64k\n");
printf(" 4) SvgaTC\n");
printf(" 5) SvgaS3\n");
printf(" 6) Tweak256\n");
printf(" 7) Tweak16\n");
printf("\n> ");
scanf("%d",&Drv);
switch(Drv)
{
case 0: installuserdriver("Svga16",DetectVGA16);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Svga16_fdriver); */
break;
case 1: installuserdriver("Svga256",DetectVGA256);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Svga256_fdriver); */
break;
case 2: installuserdriver("Svga32k",DetectVGA32k);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Svga32k_fdriver); */
break;
case 3: installuserdriver("Svga64k",DetectVGA64k);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Svga64k_fdriver); */
break;
case 4: installuserdriver("SvgaTC",DetectVGA24bit);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(SvgaTC_fdriver); */
break;
case 5: installuserdriver("SvgaS3",DetectVGAS3);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(SvgaS3_fdriver); */
break;
case 6: installuserdriver("Twk16",DetectTwk16);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Twk16_fdriver); */
break;
case 7: installuserdriver("Twk256",DetectTwk256);
/* If driver is linked with file, remove comments */
/* registerfarbgidriver(Twk256_fdriver); */
break;
}
initgraph(&Gd,&Gm,"");
/* Test if mode was initialized successfully */
GrErr = graphresult();
if (GrErr != grOk) {
printf("Graphics error: %s\n",grapherrormsg(GrErr));
exit(1);
}
/* Draw an 'X' on the screen */
setcolor(RealDrawColor(WhitePixel()));
line(0,0,getmaxx(),getmaxy());
line(0,getmaxy(),getmaxx(),0);
getch();
closegraph();
}
开发者ID:cout,项目名称:sfdemo,代码行数:76,代码来源:INITSVGA.C
示例14: Ventilation
//.........这里部分代码省略.........
y1 = y1;
y2 = y2;
#endif VVM_ALCAP_
if (flagvvm)
{
*apt = VentVolMax;
/* --------------------------- */
/* Um ponto chega a cada 5ms */
/* Totalizando 2400 ptos em 12s*/
/* Os 12s medem DELTA_X(88), */
/* logo a coluna atual depende */
/* de NumSinal segundo a formu-*/
/* la abaixo: */
/* --------------------------- */
ncol = (int) ( (((long) NumeroSinal) * DELTA_X(88))/2400 +
DELTA_X( 6) );
if ( ncol != coluna )
{
cor = getcolor();
/* -------------------------- */
/* Tracado do Volume Expirado */
/* -------------------------- */
nlin = (int) ((y_ini0 - (((long) escala ) * VentVolMax)/10));
moveto(coluna, y0);
lineto( coluna, nlin );
y0 = nlin;
#ifdef VVM_ALCAP_
setcolor (bea_color[ 7]);
/* ----------------------------- */
/* Tracado do Volume (Invertido) */
/* ----------------------------- */
nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2));
moveto(coluna, y1);
lineto( coluna, nlin );
y1 = nlin;
setcolor (bea_color[11]);
/* -------------------------------------------------- */
/* Tracado Valor Medio Filtrado do Volume (Invertido) */
/* -------------------------------------------------- */
nlin = (int) ((y_ini1 + (((long) escala ) * (sum[0]))/2));
moveto(coluna, y2);
lineto( coluna, nlin );
y2 = nlin;
#endif VVM_ALCAP_
setcolor (cor);
coluna = ncol;
}
++NumeroSinal;
}
++apt;
++aptaux;
开发者ID:imcchaves,项目名称:beatriceimc,代码行数:66,代码来源:VENTVOL.C
示例15: main
void main()
{
int gd=DETECT,gm,x,y,x1,y1,ff,yy,flag=0,flag2=0,ch;
initgraph(&gd,&gm,"");
x1=getmaxx();
y1=getmaxy();
x=630/2;
y=6;
x1=2;
setcolor(WHITE);
setbkcolor(BLACK);
while(1)
{
setcolor(YELLOW);
rectangle(2,2,638,478);
setcolor(WHITE);
settextstyle(4,0,2);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(getmaxx()/2,getmaxy()/2,"Designed by : Soumen mukherjee");
setcolor(WHITE);
circle(x,y,5);
circle(x,y,4);
setcolor(LIGHTRED);
circle(x,y,3);
circle(x,y,2);
delay(25);
setcolor(BLACK);
circle(x,y,5);
circle(x,y,4);
circle(x,y,3);
circle(x,y,2);
if((y<476 && flag==0) || y<0 )
y+=x1;
if(y==476 || y>476)
{
flag=1;
sound(4500);
delay(5);
nosound();
}
if((y>6 && flag==1) || y>476)
y-=x1;
if(y==6 || y<6)
{
flag=0;
sound(4500);
delay(5);
nosound();
}
if(flag2==1)
{
x+=x1;
if(x>630)
{
x=629;
flag2=2;
sound(4500);
delay(5);
nosound();
}
}
if(flag2==2)
{
x-=x1;
if(x<5)
{
x=6;
flag2=1;
sound(4500);
delay(5);
nosound();
}
}
if(kbhit())
{
ch=getch();
if(ch==13)
break;
if(ch==77)
{
x+=5;
if(x>630)
x=629;
flag2=1;
}
if(ch==75)
{
x-=5;
if(x==5)
x=6;
flag2=2;
}
if(ch==72)
{
x1+=2;
if(x1==60)
//.........这里部分代码省略.........
开发者ID:soumen1102,项目名称:testProject,代码行数:101,代码来源:BALL.C
示例16: GraficoVVMSecund
void GraficoVVMSecund (void)
{
register int i, ncol, nlin,
escala, y0,
y1, y2;
int y_ini0, y_ini1;
int cor;
float far *apt;
float far *aptaux;
register float flux, sum_flux;
float sum[4];
inicVVM2 = inicVVM1;
inicVVM2Int = inicVVM1Int;
AtivaJanelaGrafica(GRAF2,0);
setcolor ( bea_color[14] );
clearviewport();
getviewsettings (&vp);
DesenhaEixos( DELTA_X( 5), DELTA_X(97),
DELTA_Y( 4), DELTA_Y(80),
DELTA_X( 4), DELTA_Y(20),
DELTA_X(22), DELTA_Y(11) );
sum_flux = 0.0;
escala = DELTA_Y(11);
coluna = DELTA_X( 9);
y0 = y_ini0 = DELTA_Y(60);
y2 = y1 = y_ini1 = DELTA_Y(75);
apt = inicVVM2;
aptaux = inicVVM2Int;
sum[0] = sum[1] =
sum[2] = sum[3] = 0.0;
ScalaVVMSecund();
for ( i = 0;
(*apt != FIM_1) &&
(apt < inicVVM2 + NUMMAXPONTOSINF);
apt++, i++ )
{
flux = *aptaux; aptaux++;
#ifdef VVM_ALCAP_
sum_flux += flux / SampleRatio;
sum[0] = (.01 * sum_flux) + (.19 * sum[1]) +
(.30 * sum[2]) + (.50 * sum[3]);
sum[3] = sum[2];
sum[2] = sum[1];
sum[1] = sum[0];
#else VVM_ALCAP_
sum_flux = sum_flux;
flux = flux;
y_ini1 = y_ini1;
y0 = y0;
y1 = y1;
y2 = y2;
#endif VVM_ALCAP_
ncol = (int) ( (((long) i) * DELTA_X(88))/2400 + DELTA_X( 9) );
if ( ncol != coluna )
{
cor = getcolor();
/* -------------------------- */
/* Tracado do Volume Expirado */
/* -------------------------- */
nlin = (int) ((y_ini0 - (((long) escala ) * (*apt))/10));
moveto(coluna, y0);
lineto( coluna, nlin );
y0 = nlin;
#ifdef VVM_ALCAP_
setcolor (bea_color[ 7]);
/* ----------------------------- */
/* Tracado do Volume (Invertido) */
/* ----------------------------- */
nlin = (int) ((y_ini1 + (((long) escala ) * (sum_flux))/2));
moveto(coluna, y1);
lineto( coluna, nlin );
y1 = nlin;
//.........这里部分代码省略.........
开发者ID:imcchaves,项目名称:beatriceimc,代码行数:101,代码来源:VENTVOL.C
示例17: drawball
void drawball()
{
setfillcolor(color);
setcolor(color);
fillellipse((int)x, (int)y, (int)r, (int)r);
}
开发者ID:AlexiaChen,项目名称:ConnectFive,代码行数:6,代码来源:egemouseball.cpp
示例18: VentVol
void VentVol ( void )
{
int opcao1, opcao2;
float far *apt1;
float far *apt2;
float far *apt3;
float far *apt4;
inicVVM1 = ApontVVM;
inicVVM1Int = ApontVVMInt;
menuVVM[0] = "EXECUTAR TESTE";
menuVVM[1] = " RETORNAR ";
AmbienteVentVolMax();
getviewsettings(&vp);
if (*inicVVM1 != NULL)
{
teste1VVM = TRUE ;
GraficoVVMSecund();
grafSecundVVM = TRUE;
}
else
{
ManobVVMAtiva = 1;
NumManobVVM = 0;
teste1VVM = grafSecundVVM = FALSE;
}
teste2VVM = FALSE;
do {
Abortou = FALSE;
LimpaBufferTeclado();
opcao1 = MenuVentVolMax();
if (opcao1 == EXECUTAR)
{
DesativaJanelaGrafica(MENU_3);
if ((teste1VVM)&&(!grafSecundVVM))
{
GraficoVVMSecund();
grafSecundVVM = TRUE;
}
else if (teste2VVM)
{
MelhorProvaVVM (ManobVVMAtiva, NumManobVVM);
teste2VVM = FALSE;
teste1VVM = TRUE ;
#ifdef MODO_VGA_640X480_HIG
AmbienteVentVolMax();
#endif MODO_VGA_640X480_HIG
GraficoVVMSecund();
}
AtivaJanelaGrafica(GRAF1,0);
setcolor ( bea_color[14] );
clearviewport();
ProcuraZero();
if (ZeroOk)
{
inicVVM2 = inicVVM1;
inicVVM1 = (inicVVM1 == areaTampao) ? areaVVM : areaTampao;
inicVVM2Int = inicVVM1Int;
inicVVM1Int = (inicVVM1Int == areaTampaoInt) ? areaVVMInt : areaTampaoInt;
clearviewport();
getviewsettings(&vp);
DesenhaEixos( DELTA_X( 4), DELTA_X(96),
DELTA_Y( 4), DELTA_Y(98),
DELTA_X( 2), DELTA_Y(24),
DELTA_X(22), DELTA_Y(14) );
ScalaVVM();
DesativaJanelaGrafica(GRAF1);
AtivaJanelaGrafica(MENU_3, 0);
setcolor ( bea_color[14] );
menuVVM[0] = " INICIAR ";
menuVVM[1] = " ANULAR ";
do {
++NumManobVVM;
testVVMOk = FALSE;
LimpaBufferTeclado();
opcao2 = MenuVentVolMax();
if (opcao2 == INICIAR)
{
DesativaJanelaGrafica(MENU_3);
AtivaJanelaGrafica(GRAF1, 0);
setcolor ( bea_color[14] );
/* --------------- */
//.........这里部分代码省略.........
开发者ID:imcchaves,项目名称:beatriceimc,代码行数:101,代码来源:VENTVOL.C
示例19: drawMillStand
// function definition to create trunk of the mill
void drawMillStand(int x,int y)
{
setcolor(LCYAN); // setting a color for the co-ordinate axes
line(fx(x),fy(y),fx(x),Y); // drawing the stand
} // end of function
开发者ID:ImRohitSingh,项目名称:Computer-Graphics,代码行数:6,代码来源:WindMill.cpp
示例20: main
void main(void)
{
int key,
v,
h;
int oldv=0,oldh=0;
int x1,y1,x2,y2;
int x;
turnon();
graphics_setup();
setcolor(c7);
initrat(&rat);
key = checkinput();
h=rat.horiz;
v=rat.verti;
oldh=h;
oldv=v;
r1=0.0;
r2=0.0;
r3=0.0;
msz=-150;
newpos();
while(!(key==ESC))
{
key = checkinput();
h = rat.horiz;
v = rat.verti;
if(oldh!=h)
{
if(oldh<h)
{
if(r1+0.1>6.28319)
r1=0.0;
else
r1+=0.1;
}
else
{
if(r1-0.1<0.0)
r1=6.28319;
else
r1-=0.1;
}
newpos();
}
if(oldv!=v)
{
if(oldv>v)
{
if(r3+0.1>6.28319)
r3=0.0;
else
r3+=0.1;
}
else
{
if(r3-0.1<0.0)
r3=6.28319;
else
r3-=0.1;
}
newpos();
}
resetrat(&rat);
h=rat.horiz;
v=rat.verti;
oldh=h;
oldv=v;
switch(key)
{
case UP: msz+=10;
newpos();
break;
case DOWN: msz-=10;
newpos();
break;
case LEFT: if(r2+0.1>6.28319)
r2=0.0;
else
r2+=0.1;
newpos();
break;
case RIGHT: if(r2-0.1<0.0)
r2=6.28319;
else
r2-=0.1;
newpos();
break;
/* case PGUP: hand[0]=x;
hand[1]=y-17;
hand[2]=x;
hand[3]=y+8;
hand[4]=x-10;
hand[5]=y-12;
hand[6]=x;
hand[7]=y;
hand[8]=x+10;
hand[9]=y-12;
//.........这里部分代码省略.........
开发者ID:krattai,项目名称:flosh,代码行数:101,代码来源:VRTOOL.C
注:本文中的setcolor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论