コード例 #1
0
ファイル: CARRACE.C プロジェクト: gnischay2/Car-Racing-Game
void code()
      {
	    int x1,y1,cl;

	   int x=28,y=4;
	   int p=28,q=4;
	   int r=28,s=4;
	   int i=28;
	   int j=0;
	   char c;
	   textcolor(0);
	   do
	      {

		  if(y+5>17&&x==i)
		     { gover();
			getch();
			exit(1);

		     }
		  if(q+5>17&&p==i)
		     { gover();
		      getch();
		      exit(1);
		     }
		  if(s+5>17&&r==i)
		     { gover();
		       getch();
		       exit(1);
		     }

	       clrscr();
	       gframe();
	       if (j>7)
	       {
		    if(q==17)
		       {  q=4;
			  p=28+(7*(j%3));
		       }
		    textcolor(15);
		    object(p,q);
		    q++;
		}
	   if (j>15)
	      {
		    if(s==17)
		       {  s=4;
			  r=28+(7*((j+1)%3));
		       }
		    textcolor(15);
		    object(r,s);
		    s++;
		}
	   if(y==17)
	     {  y=4;
		x=28+(7*((j+2)%3));
	     }
	   textcolor(15);
//	   object(x,y);
	   y++;



	   textcolor(1);
	   gotoxy(i,18);
	   cprintf("  ^ ^  ");
	   gotoxy(i,19);
	   cprintf("||@*@||");
	   gotoxy(i,20);
	   cprintf("||***||");
	   gotoxy(i,21);
	   cprintf("  ***  ");
	   gotoxy(i,22);
	   cprintf("  ***  ");
	   gotoxy(i,23);
	   cprintf("||***||");
	   gotoxy(i,24);
	   cprintf("||***||");


	  mouseposi(&x,&y,&cl);

	   if(cl==1&&i>34)
	       i=i-7;
	   if(cl==2&&i<36)
	       i=i+7;
	    j++;
	   delay(300) ;

	   }while(!kbhit());


      }
コード例 #2
0
ファイル: install.c プロジェクト: TijmenW/FreeDOS
int
main (int argc, char **argv)
{
  int dat_count;                    /* size of the dat array */
  int i;
  int mono = 0;                     /* running on monochrome monitor */

  dat_t *dat_ary;                   /* the dat file array */
  inst_t ret;                       /* no. of errors, warnings */

  struct text_info ti;              /* (borland) for gettextinfo */
 

  /* Open the language catalog */
  cat = catopen ("install", 0);

  /* Check command line */

  for (i = 1; i < argc; i++)
  {
    if (strcmpi(argv[i], "/mono") == 0)
      mono = 1;
    else if (strcmpi(argv[i], "/nopause") == 0)
      nopauseflag = 1;
    else if (strcmpi(argv[i], "/nolog") == 0)
      wantlog = 0;
    else if ( (strcmpi(argv[i], "/src") == 0) && (i+1 < argc))
    {
      fromdirflag = 1;
      i++;
      strcpy(fromdir+2, argv[i]);
    }
    else if ( (strcmpi(argv[i], "/dst") == 0) && (i+1 < argc))
    {
      destdirflag = 1;
      i++;
      strcpy(destdir+2, argv[i]);
    }
    else
    {
      fprintf (stderr, catgets (cat, SET_USAGE, MSG_USAGE, MSG_USAGE_STR));
      exit (1);
    }
  }

  /* unzip overwrites screen with warning if TZ not set, so check    */
  /* and if not set, then set for us to GMT0, which means no offsets */
  if (getenv("TZ") == NULL) putenv("TZ=GMT0");


  /* Read dat file */

  dat_ary = dat_read ("INSTALL.DAT", &dat_count);
  if (dat_ary == NULL)
  {
    if (dat_count > 0)
    {
      fprintf (stderr, catgets (cat, SET_ERRORS, MSG_ERRALLOCMEMDF, MSG_ERRALLOCMEMDF_STR));
      exit (2);
    }
    else /* Either error reading file, eg no file, or file has no entries */
    {
      fprintf (stderr, catgets (cat, SET_ERRORS, MSG_ERREMPTYDATAFILE, MSG_ERREMPTYDATAFILE_STR));
      exit (3);
    }
  }

  /* Get localized "Yes" and "No" strings */
  getLocalizedYesNo();

  /* register our SIGINT handler (Ctrl-C) */
  registerSIGINTHandler();

  /* Start the install */

  /* save current setting so we can restore them */
  gettextinfo (&ti);

  /* setup screen colors then draw the screen */
  if (mono)
  {
    textbackground (BLACK);
    textcolor (LIGHTGRAY);
  }
  else
  {
    textbackground (BLUE);
    textcolor (WHITE);
  }

  repaint_empty();
  gotoxy (2, 3);
  cat_file ("COPYR", 18);
  pause();

  repaint_empty();
  gotoxy (2, 3);
  cat_file ("OEM", 18);
  pause();

  ret.errors = 0;
  ret.warnings = 0;

  ret = install_top (dat_ary, dat_count);

  /* Finished with install */

  textattr (ti.attribute); /* restore user's screen */
  clrscr();

  if ((ret.errors == 0) && (ret.warnings == 0))
      printf (catgets (cat, SET_GENERAL, MSG_INSTALLOK, MSG_INSTALLOK_STR));
  else
      printf (catgets (cat, SET_GENERAL, MSG_INSTALLERRORS, MSG_INSTALLERRORS_STR), ret.errors, ret.warnings);

  /* Done */

  free (dat_ary);
  free (yes);
  free (no);
  catclose (cat);

  /* restore original SIGINT handler */
  unregisterSIGINTHandler();

  return (0);
}
コード例 #3
0
ファイル: affich.c プロジェクト: Rajekevin/PacMan
void affich(char map[20][38], int score, int bonus, int frame, int vies){


/*NOTE : Map prend 20 de hauteur et 38 de largeur*/
    int i, j;

    system("CLS");//Clean

     textcolor(15);
     printf("Deplacez le pacman a l'aide des touches z(haut), q(gauche), s(bas) et d(droite).\nTentez d'attraper les %c pour gober les fantômes BOUHHH chance\nQuittez avec Echap\n", point);

    for(i=0; i<20; i++)
    {
        for(j=0; j<38; j++)
        {

            if(map[i][j] == 'C')//On colorie le pacman en jaune
            {
                textcolor(14);

            }
            else if(map[i][j] == 'M')   //M désigne les monstres colorié en rouge
            {
                textcolor(12);
                 if(bonus && (frame<35 || frame%3))
                {
                    textcolor(10);
                }


            }
            else if(map[i][j] == '.')//Les points sont symbolisés par la couleur blanche
            {
                textcolor(15);

            }
            else if(map[i][j] == point)
            {
                textcolor(10);

            }
            else
            {
                textcolor(9);

            }

            printf("%c", map[i][j]); //On affiche le terrain

        }

    textcolor(14);
    if(i==10){printf("        score : %d", score);}; //Points++
    if(i==12){printf("        vies : %d", vies);};   //Monstre = -1 Vie


        printf("\n");
    }


textcolor(10);
  if(bonus) //Compte a rebours pour le bonus
    {
        printf("========== BONUS ACTIVE %d ==========", 50 - frame);
    }

 textcolor(15);
Sleep(200);
}
コード例 #4
0
ファイル: plat64.c プロジェクト: StewBC/cc65-Chess
// Called one-time to set up the platform (or computer or whatever)
void plat_Init()
{
	int i;
	char c;

	// Setting this to 0 will not show the "Quit" option in the main menu
	gReturnToOS = 1;
	
	if(gReturnToOS)
	{
		// Save these values so they can be restored
		memcpy(gColor_ram, COLOUR_RAM, SCREEN_HEIGHT*SCREEN_WIDTH);
		sc_ddra = CIA2.ddra;
		sc_pra = CIA2.pra;
		sc_vad = VIC.addr;
		sc_ct2 = VIC.ctrl2;
		sc_vbc = VIC.bordercolor;
		sc_vbg0 = VIC.bgcolor0;
		sc_vbg1 = VIC.bgcolor1;
		sc_vbg2 = VIC.bgcolor2;
		sc_mcp = *MEM_KRNL_PRNT;
		sc_x = wherex();
		sc_y = wherey();
	}
	
	// Set up a user defined font, and move the screen to the appropriate position
	CIA2.ddra |= 0x03;
	CIA2.pra = (CIA2.pra & 0xfc) | (3-(VIC_BASE_RAM / 0x4000));
	VIC.addr = ((((int)(SCREEN_RAM - VIC_BASE_RAM) / 0x0400) << 4) + (((int)(CHARMAP_RAM - VIC_BASE_RAM) / 0x0800) << 1));
	VIC.ctrl2 |= 16;
	VIC.bordercolor = VIC.bgcolor0 = COLOR_LIGHTBLUE;
	VIC.bgcolor1 = COLOR_RED;
	VIC.bgcolor2 = COLOR_GRAY3;

	*MEM_KRNL_PRNT = (int)SCREEN_RAM / 256;

	// Save and set the text color
	sc_txt = textcolor(COLOR_BLUE);
	clrscr();

	// Copy the standard font to where the redefined char font will live
	CIA1.cra = (CIA1.cra & 0xfe);
	*(char*)0x01 = *(char*)0x01 & 0xfb;
	memcpy(CHARMAP_RAM,COLOUR_RAM,256*8);
	*(char*)0x01 = *(char*)0x01 | 0x04;
	CIA1.cra = (CIA1.cra | 0x01);

	// copy the charactes to make the chess pieces font.  
	memcpy(&CHARMAP_RAM[8*CHARMAP_DEST], &gfxTiles[0][0], sizeof(gfxTiles));

	// For the second (white) set, set all 01 bits to 10 so it uses bgcolor2
	for(i=0; i<sizeof(gfxTiles); ++i)
	{
		c = ((char*)&gfxTiles)[i];
		
		if(0x01 == (c & 0x03))
		{
			c &= ~0x03;
			c |= 0x02;
		}
			
		if(0x04 == (c & 0x0c))
		{
			c &= ~0x0c;
			c |= 0x08;
		}
			
		if(0x10 == (c & 0x30))
		{
			c &= ~0x30;
			c |= 0x20;
		}
			
		if(0x40 == (c & 0xc0))
		{
			c &= ~0xc0;
			c |= 0x80;
		}
		CHARMAP_RAM[(8*CHARMAP_DEST)+sizeof(gfxTiles)+i] = c;
	}
}
コード例 #5
0
ファイル: G-SEIDEL.CPP プロジェクト: mathlog/codesmath
//---------------------------------------------------------------------------
void main(void)
{
double  x[Maxec]={0},x0[Maxec]={0},b[Maxec]={0};
double a[Maxec][Maxec+1]={0},s,eps;
int y,i,j,k,n;
Boolean valver=False;
char c,cad[25]={0};

clrscr();
gotoxy(30,1);cout<<"M‚todo de Gauss Seidel";
gotoxy(1,5);cout<<"N£mero de ecuaciones ";
do{
  cin>>n;
  if (n>6)
    cout<<"El sistema debe tener menos de 6 ecuaciones por cuestiones \nde impresion en pantalla\nGracias";
    cout<<"\n\nN£mero de ecuaciones ";
  }while(n>6);
lectura(a,x,b,n);
clrscr();
textcolor(14);
gotoxy(10,12);
cprintf("Si la solucion no converge, presione ESC para terminar");
textcolor(10);
gotoxy(1,24);
cprintf("Presione ENTER para continuar...");
textcolor(7);
enter();
k=0;
y=4;
eps=1e-5;
clrscr();
textcolor(10);
gotoxy(30,1);cout<<"M‚todo de Gauss Seidel";
textcolor(14);
gotoxy(45,24);cprintf("Presione una tecla para continuar...");
textcolor(15);
gotoxy(4,2);printf("k       x1        x2        x3         x4         x5       x6");
do{
   for(i=0;i<n;i++)
     x[i]=x0[i];
   for(i=0; i<n; i++)
     {
      s=0;
      for(j=0; j<n; j++)
	 if((i-j)!=0)
	   s=s+a[i][j]*x0[j];
      x0[i]=(b[i]-s)/a[i][i];
     }
   for(i=0; i<n; i++)
      {
       sprintf(cad,"%.4f",x[i]);
       x[i]=atof(cad);
       sprintf(cad,"%.4f",x0[i]);
       x0[i]=atof(cad);
      }

   for(i=0; i<n; i++)
      {
       if(fabs(x0[i]-x[i]) > eps)
	  valver=False;
       else
	  valver=True;
      }
   k++;
   if (k>ITERA)
     c=27;
   gotoxy(2,y);cout<<k;
   for(i=0; i<n; i++)
      {
       gotoxy(8+i*11,y);printf("%5.4f",x0[i]);
      }
   y++;
   c=getch();
   if(y>22)
     {
      y=4;
      clrscr();
      textcolor(10);
      gotoxy(30,1);cout<<"M‚todo de Gauss Seidel";
      textcolor(14);
      gotoxy(45,24);cprintf("Presione una tecla para continuar...");
      textcolor(15);
      gotoxy(4,2);printf("k       x1        x2        x3         x4         x5       x6");
     }
   if (k>ITERA)
     c=27;
  }while(!(valver==True||c==27));
textcolor(15);
cout<<"\n";
cprintf("DESPUES DE %d ITERACIONES",k);
cout<<"\n";
cprintf("LA SOLUCION DEL SISTEMA ES : \n");   printf("\n");
for(i=0; i<n; i++)
   cprintf(" x(%d) = %10.4f",i+1,x0[i]),cout<<"\n";
getch();
}
コード例 #6
0
ファイル: plat64.c プロジェクト: StewBC/cc65-Chess
// Very simple menu with a heading and a scrolling banner as a footer
char plat_Menu(char **menuItems, char height, char *scroller)
{
	static char *prevScroller, *pScroller, *pEnd;
	int keyMask;
	char i, j, sx, sy, numMenuItems, timerInit = 0, maxLen = 0;

	// If the scroller message chages, cache the new one
	if(prevScroller != scroller)
	{
		prevScroller = scroller;
		pScroller = scroller;
		pEnd = scroller + strlen(scroller);
	}

	// Find the longest entry
	for(numMenuItems=0; menuItems[numMenuItems]; ++numMenuItems)
	{
		char len = strlen(menuItems[numMenuItems]);
		if(len > maxLen)
			maxLen = len;
	}
	
	// Centre on the screen
	sy = MAX_SIZE(0, (SCREEN_HEIGHT / 2) - (height / 2) - 1);
	sx = MAX_SIZE(0, (SCREEN_WIDTH / 2) - (maxLen / 2) - 1);
	maxLen = MIN_SIZE(SCREEN_WIDTH-2, maxLen);

	// Show the title
	textcolor(COLOR_GREEN);
	gotoxy(sx, sy);
	cprintf(" %.*s ",maxLen, menuItems[0]);
	
	// Leave a blank line
	textcolor(COLOR_BLACK);
	gotoxy(sx, ++sy);
	for(j=0; j<maxLen+2; ++j)
		cputc(' ');
	
	// Show all the menu items
	for(i=1; i<numMenuItems; ++i)
	{
		gotoxy(sx, sy+i);
		cprintf(" %.*s ",maxLen, menuItems[i]);
	}
	
	// Pad with blank lines to menu height
	for(;i<height;++i)
	{
		gotoxy(sx, sy+i);
		for(j=0; j<maxLen+2; ++j)
			cputc(' ');
	}

	// Select the first item
	i = 1;
	do
	{
		// Highlight the selected item
		gotoxy(sx, sy+i);
		textcolor(COLOR_WHITE);
		cprintf(">%.*s<",maxLen, menuItems[i]);
		textcolor(COLOR_BLACK);
		
		// Look for user input
		keyMask = plat_ReadKeys(0);
		
		if(keyMask & INPUT_MOTION)
		{
			// selection changes so de-highlight the selected item
			gotoxy(sx, sy+i);
			cprintf(" %.*s ",maxLen, menuItems[i]);
			
			// see if the selection goes up or down
			switch(keyMask & INPUT_MOTION)
			{
				case INPUT_UP:
					if(!--i)
						i = numMenuItems-1;
				break;
			
				case INPUT_DOWN:
					if(numMenuItems == ++i)
						i = 1;
				break;
			}
		}
		keyMask &= (INPUT_SELECT | INPUT_BACKUP);

		// Show the scroller
		gotoxy(sx,sy+height);
		textcolor(COLOR_CYAN);
		cprintf(" %.*s ",maxLen, pScroller);
		
		// Wrap the message if needed
		if((pEnd - pScroller) < maxLen-1)
		{
			gotoxy(sx+(pEnd-pScroller)+1,sy+height);
			cprintf(" %.*s ",maxLen-(pEnd - pScroller)-1, scroller);
		}

		// Only update the scrolling when needed
		if(plat_TimeExpired(SCROLL_SPEED, &timerInit))
		{
			++pScroller;
			if(!*pScroller)
				pScroller = scroller;
		}
	} while(keyMask != INPUT_SELECT && keyMask != INPUT_BACKUP);

	// if backing out of the menu, return 0
	if(keyMask & INPUT_BACKUP)
		return 0;
	
	// return the selection
	return i;
}
コード例 #7
0
ファイル: plat64.c プロジェクト: StewBC/cc65-Chess
/*-----------------------------------------------------------------------*/
void plat_ShowSideToGoLabel(char side)
{
	gotoxy(2+8*BOARD_PIECE_WIDTH,0);
	textcolor(side);
	cprintf("%s",gszSideLabel[side]);
}
コード例 #8
0
ファイル: showscores.c プロジェクト: Nekrofage/QuestUnicorn
void show_scores() {
  int i;
  char key;
  int sc_file;
  char buffer[80];
  SCORE_REC scores;
  textmode(3);
  if (exist("unicorn.sco")) {
    sc_file = open("unicorn.sco",O_RDONLY);
    read(sc_file,&scores,sizeof(SCORE_REC));
    close(sc_file);
    }
  else { 
    strcpy(scores.legend_name[1],"Elan of Marduk");
    strcpy(scores.legend_title[1],"Lord");
    scores.legend_exp[1] = 836e3;
    strcpy(scores.legend_name[2],"Gawaine of Radon");
    strcpy(scores.legend_title[2],"Paladin");
    scores.legend_exp[2] = 3532e3;
    strcpy(scores.legend_name[3],"Jason Thornblade");
    strcpy(scores.legend_title[3],"Ranger Lord");
    scores.legend_exp[3] = 3841e3;
    strcpy(scores.legend_name[4],"Amber of the Vale");
    strcpy(scores.legend_title[4],"High Priestess");
    scores.legend_exp[4] = 1573e3;
    strcpy(scores.legend_name[5],"Kesthler of the Wood");
    strcpy(scores.legend_title[5],"The Great Druid");
    scores.legend_exp[5] = 38963515;
    strcpy(scores.legend_name[6],"Nina the Wise");
    strcpy(scores.legend_title[6],"Wizardess");
    scores.legend_exp[6] = 48083e3;
    strcpy(scores.legend_name[7],"Galter the Feared");
    strcpy(scores.legend_title[7],"Grandfather of Assassins");
    scores.legend_exp[7] = 277837e4;
    strcpy(scores.legend_name[8],"Rasper of Solat");
    strcpy(scores.legend_title[8],"Hierophant of the Cabal");
    scores.legend_exp[8] = 100769e4;
    strcpy(scores.legend_name[9],"Ramoon of Talgon");
    strcpy(scores.legend_title[9],"Cavalier");
    scores.legend_exp[9] = 39748460;
    strcpy(scores.legend_name[10],"Arslon");
    strcpy(scores.legend_title[10],"Grand Master of Flowers");
    scores.legend_exp[10] = 1494197000;
    strcpy(scores.legend_name[11],"Marduk");
    strcpy(scores.legend_title[11],"King of Halkanar");
    scores.legend_exp[11] = 1550292000;
    for (i=1; i<=11; i++) {
      scores.high_exp[i] = 0;
      strcpy(scores.high_name[i]," ");
      strcpy(scores.high_title[i]," ");
      }
    sc_file = open("unicorn.sco",O_WRONLY | O_CREAT | O_TRUNC,0660);
    write(sc_file,&scores,sizeof(SCORE_REC));
    close(sc_file);
    }
  textcolor(10); gotoxy(1,1); txt_write("Legends:"); textcolor(2);
  gotoxy(5,2); txt_write("Fighter    :");
  gotoxy(5,3); txt_write("Paladin    :");
  gotoxy(5,4); txt_write("Ranger     :");
  gotoxy(5,5); txt_write("Cleric     :");
  gotoxy(5,6); txt_write("Druid      :");
  gotoxy(5,7); txt_write("Wizard     :");
  gotoxy(5,8); txt_write("Assassin   :");
  gotoxy(5,9); txt_write("Hierophant :");
  gotoxy(5,10); txt_write("Cavalier   :");
  gotoxy(5,11); txt_write("Monk       :");
  gotoxy(5,12); txt_write("Noble      :");
  textcolor(10); gotoxy(1,14); txt_write("High Scores:"); textcolor(2);
  gotoxy(5,15); txt_write("Fighter    :");
  gotoxy(5,16); txt_write("Paladin    :");
  gotoxy(5,17); txt_write("Ranger     :");
  gotoxy(5,18); txt_write("Cleric     :");
  gotoxy(5,19); txt_write("Druid      :");
  gotoxy(5,20); txt_write("Wizard     :");
  gotoxy(5,21); txt_write("Assassin   :");
  gotoxy(5,22); txt_write("Hierophant :");
  gotoxy(5,23); txt_write("Cavalier   :");
  gotoxy(5,24); txt_write("Monk       :");
  gotoxy(5,25); txt_write("Noble      :");
  for (i=1; i<=11; i++) {
    if (score1 == i) textcolor(11); else textcolor(14);
    gotoxy(18,i+1);
    sprintf(buffer,"%10.0f",scores.legend_exp[i]);
    txt_write(buffer);
    gotoxy(30,i+1); txt_write(scores.legend_name[i]);
    gotoxy(55,i+1); txt_write(scores.legend_title[i]);
    }
  for (i=1; i<=11; i++) {
    if (score2 == i) textcolor(11); else textcolor(14);
    gotoxy(18,i+14);
    sprintf(buffer,"%10.0f",scores.high_exp[i]);
    txt_write(buffer);
    gotoxy(30,i+14); txt_write(scores.high_name[i]);
    gotoxy(55,i+14); txt_write(scores.high_title[i]);
    }
  key = 0;
  while (key != 13) key = inkey();
  }
コード例 #9
0
ファイル: log.cpp プロジェクト: randybatiquin/freerose
// This function logs based on flags
void Log( enum msg_type flag, const char *Format, ... )
{
	va_list ap;	      // For arguments
    va_start( ap, Format );

	//Messag type for logging - T3
	char msgtype[20] = "";

    // Timestamp
    time_t rtime;
    time(&rtime);
    char *timestamp = ctime(&rtime);
    timestamp[ strlen(timestamp)-1 ] = ' ';

    //no timestamp for the log either.
    if(flag!=MSG_QUERY&&flag!=MSG_LOAD)
    {
        textcolor(WHITE);
        if(PRINT_LOG)
            printf("%s", timestamp );
    }
	if(PRINT_LOG)
	{
        switch (flag) {
            case MSG_NONE:
                textcolor(WHITE);
                vprintf( Format, ap );
            break;
            case MSG_STATUS:
                textcolor(GREEN);
                sprintf(msgtype,"%s","[STATUS]: ");
                printf("%s",msgtype);
            break;
            case MSG_SQL:
                textcolor(CYAN);
                sprintf(msgtype,"%s","[SQL]: ");
                printf("%s",msgtype);
            break;
            case MSG_INFO:
                textcolor(LIGHTGREEN);
                sprintf(msgtype,"%s","[INFO]: ");
                printf("%s",msgtype);
            break;
            case MSG_NOTICE:
                textcolor(LIGHTCYAN);
                sprintf(msgtype,"%s","[NOTICE]: ");
                printf("%s",msgtype);
            break;
            case MSG_WARNING:
                textcolor(YELLOW);
                sprintf(msgtype,"%s","[WARNING]: ");
                printf("%s",msgtype);
            break;
            case MSG_DEBUG:
                textcolor(LIGHTBLUE);
                sprintf(msgtype,"%s","[DEBUG]: ");
                printf("%s",msgtype);
            break;
            case MSG_ERROR:
                textcolor(RED);
                sprintf(msgtype,"%s","[ERROR]: ");
                printf("%s",msgtype);
            break;
            case MSG_FATALERROR:
                textcolor(LIGHTRED);
                sprintf(msgtype,"%s","[FATAL ERROR]: ");
                printf("%s",msgtype);
            break;
            case MSG_HACK:
                textcolor(LIGHTRED);
                sprintf(msgtype,"%s","[HACK]: ");
                printf("%s",msgtype);
            break;
            case MSG_LOAD:
                textcolor(BROWN);
                sprintf(msgtype,"%s","[LOADING]: ");
                printf("%s",msgtype);
            break;
            case MSG_GMACTION:
                textcolor(MAGENTA);
                sprintf(msgtype,"%s","[GM ACTION]: ");
                printf("%s",msgtype);
            break;
            case MSG_START:
                textcolor(MAGENTA);
                vprintf( Format, ap );
                printf( "\r\n" );
            break;
            case MSG_CHAT:
                textcolor(WHITE);
                sprintf(msgtype, "%s","[Chat]: ");
                printf("%s",msgtype);
            break;
            case MSG_TRADE:
                textcolor(GREEN);
                sprintf(msgtype, "%s","[Trade]: ");
                printf("%s",msgtype);
            break;
            case MSG_CLAN:
                textcolor(YELLOW);
                sprintf(msgtype, "%s","[Clan]: ");
                printf("%s",msgtype);
            break;
            case MSG_PARTY:
                textcolor(LIGHTBLUE);
                sprintf(msgtype, "%s","[Party]: ");
                printf("%s",msgtype);
            break;
            case MSG_WHISPER:
                textcolor(RED);
                sprintf(msgtype, "%s","[SHOUT]: ");
                printf("%s",msgtype);
            break;
            case MSG_GROUP:
                textcolor(LIGHTGRAY);
                sprintf(msgtype, "%s","[Group]: ");
                printf("%s",msgtype);
            break;
            case MSG_MESSENGER:
                textcolor(CYAN);
                sprintf(msgtype, "%s","[Chatbox]: ");
                printf("%s",msgtype);
            break;
	   }
    }
    else
    {
        if(flag==MSG_CONSOLE)
        {
			textcolor(LIGHTRED);
			printf("[CONSOLE]: ");
        }
    }
	if(PRINT_LOG || flag==MSG_CONSOLE)
    	textcolor(LIGHTGRAY);
	if(flag!=MSG_QUERY && (PRINT_LOG || flag==MSG_CONSOLE))
	{
    	vprintf( Format, ap );
    	printf( (flag==MSG_LOAD) ? "\r" : "\n" );
    }
	FILE *fh = NULL;
    switch(LOG_THISSERVER)
    {
        case LOG_LOGIN_SERVER:
            fh = fopen(LOG_DIRECTORY LOG_FILENAME_LOGINFILE, "a+" );
        break;
        case LOG_CHARACTER_SERVER:
            fh = fopen(LOG_DIRECTORY LOG_FILENAME_CHARFILE, "a+" );
        break;
        case LOG_WORLD_SERVER:
            fh = fopen(LOG_DIRECTORY LOG_FILENAME_WORLDFILE, "a+" );
        break;
        case LOG_SAME_FILE:
            fh = fopen(LOG_DIRECTORY LOG_DEFAULT_FILE, "a+" );
        break;
    }
    if(flag==MSG_QUERY)
    {
        if(fh!=NULL)
            fclose(fh);
        fh = fopen(LOG_DIRECTORY "queries.txt", "a+" );
    }
    if ( fh != NULL )
    {
        fprintf( fh, "%s- %s- ", timestamp , msgtype); //T3
        vfprintf( fh, Format, ap );
        fputc( '\n', fh );
        fclose( fh );
    }
    va_end  ( ap );
    fflush( stdout );
}
コード例 #10
0
ファイル: Find the word a Game.cpp プロジェクト: hmht/CPP
void main()
{
int i,no,j,z;
textattr(1<<4|14);
clrscr();
cprintf("Asume A Word!\n\n\rStep 1:\n\r=======\n\rTabel 1:\n\n\r");
textattr(1<<4|12);
for(i=0;i<5;i++)
cprintf("%d ",i+1);
textattr(7<<4);
for(i=0;i<30;i++)
 {
 if(i%5==0)
 printf("\n");
 cprintf("%c ",arr[i]);
 }
textattr(1<<4|14);
gotoxy(1,15);
cprintf("\n\n\rEnter Total Number of letters in word:");
cscanf("%d",&no);
cprintf("                                            ");
for(i=0;i<no;i++)
{
gotoxy(1,15);
cprintf("\n\n\rEnter Letter %d Coloumn number:",i+1);
scanf("%d",&pos1[i]);
pos1[i]-=1;
}
clrscr();
cprintf("Step 2:\n\rTabel 2:\n\r");
textattr(1<<4|12);
for(i=0;i<6;i++)
cprintf("%d ",i+1);
textattr(7<<4);
for(i=0;i<no;i++)
 {
 printf("\n");
 for(j=pos1[i];j<30;j+=5)
    cprintf("%c ",arr[j]);
 }
textattr(1<<4|14);
for(i=0;i<no;i++)
{
gotoxy(1,15);
cprintf("\n\n\rEnter the  %d Letter's Coloumn number:",i+1);
scanf("%d",&pos2[i]);
pos2[i]-=1;
}
clrscr();
gotoxy(30,13);
cprintf("We Got U! ");
gotoxy(30,15);
cprintf("SURPRISED!");
textcolor(WHITE+BLINK);
gotoxy(30,14);
for(i=0;i<no;i++)
{
cprintf("%c",arr[pos2[i]*5+pos1[i]]);
}
textcolor(YELLOW+BLINK);
cprintf("\n\n\n\n\n\n\n\n\rPress Esc To Exit...");
while(getch()!=27);
}
コード例 #11
0
ファイル: block.cpp プロジェクト: hayatofujii/bomball
void minibloco::imprime() {
	textcolor(backcolor*16 + color);
	printf("%c", ascii);
}
コード例 #12
0
ファイル: optcolor.c プロジェクト: tridge/junkcode
void closewindow(int x1,int y1,int x2,int y2)
{
textcolor(LIGHTGRAY);
textbackground(BLACK);
puttext(x1,y1,x2+1,y2+1,screenbuffer);
}
コード例 #13
0
ファイル: QUIZ.C プロジェクト: TVilaboa/InvestigacionC
int main(){
    int i;
    char ch;
     for(i=0;i<15;i++){
	if(ch==27)
	    exit(1);
	clrscr();
	textcolor(LIGHTGREEN);
	quizbox(28,1,50,3,2);
	gotoxy(30,2);
	textcolor(YELLOW);
	cprintf("***** QUIZ %d *****",i+1);   //Quiz No. currently executed

	quizbox(23,5,57,11,2);
	textcolor(LIGHTMAGENTA);
	switch(i){
	   //Here formating code is redundant u can make a function and call it
	   //each time...
	   case 0 :  gotoxy(29,6);
		     //Question 1
		     //Enter ur Question instead of "Find Hexadecimal to Binary?"
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","9.1A");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);  //For Testing Current Score
		     //This Comments will be followed to Rest of Questions...
		     //You can also increase or decrease questions...in quiz
		     break;
	   case 1 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","BA4");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 2 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","C8");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 3 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","15");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 4 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","D89F");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 5 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","64AC");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 6 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","9A6");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 7 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","CDAC");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 8 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","DEAF");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 9 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","CAFE");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 10 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","FADE");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 11:  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","FEE");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 12 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","5C");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 13 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","FACE");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   case 14 :  gotoxy(29,6);
		     cprintf("Find Hexadecimal to Binary?");
		     gotoxy(29,7);
		     cprintf("For below Given Number!");
		     gotoxy(35,8);
		     cprintf(" %-8s","AEC");
		     gotoxy(30,9);
		     cprintf("��������������������");
		     scorecard(i);
		     break;
	   }
	   textcolor(LIGHTGRAY);
	   gotoxy(55,2);
	   cprintf("Escape to Return");
	   gotoxy(55,3);
	   cprintf("Any key to continue...");
	   flushall();
	   ch=getch();
	}
}
コード例 #14
0
ファイル: CARRACE.C プロジェクト: gnischay2/Car-Racing-Game
void menu()
	{
		       int h;
		       clrscr();
		       textcolor(5);
		       fr1(1,2,24,79);
		       textcolor(5);
		       fr1(3,4,22,77);
		       gotoxy(31,2);
		       textcolor(5);
		       printf("CAR RACE GAME");
		       gotoxy(36,9);
		       textcolor(0);
		       cprintf("MAIN MENU");
		       textcolor(5);
		       fr1(10,30,18,55);
		       gotoxy(35,12);
		       textcolor(1);
		       cprintf("1.");
		       textcolor(8);
		       cprintf("Play Game");
		       gotoxy(35,13);
		       textcolor(1);
		       cprintf("2.");
		       textcolor(8);
		       cprintf("Instruction");
		       gotoxy(35,14);
		       textcolor(1);
		       cprintf("3.");
		       textcolor(8);
		       cprintf("Developer");
		       gotoxy(35,15);
		       textcolor(1);
		       cprintf("4.");
		       textcolor(8);
		       cprintf("Highest Record");
		       gotoxy(35,16);
		       textcolor(1);
		       cprintf("5.");
		       textcolor(8);
		       cprintf("Exit");
		       gotoxy(14,25);
		       textcolor(RED);
		       cprintf ("Press Any Highlighted Key Word To Select Your Choice.... =");
		       scanf("%d",&h);
		       choice=h;

     }
コード例 #15
0
ファイル: ctk-conio.c プロジェクト: Inscribe/msp430xf1611
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_window(struct ctk_window *window, unsigned char focus,
		unsigned char clipy1, unsigned char clipy2,
		unsigned char draw_borders)
{
#if CTK_CONF_WINDOWS
  unsigned char x, y;
  unsigned char x1, y1, x2, y2;
  unsigned char h;

  if(window->y + CTK_CONF_MENUS >= clipy2) {
    return;
  }
    
  x = window->x;
  y = window->y + CTK_CONF_MENUS;
  x1 = x + 1;
  y1 = y + 1;
  x2 = x1 + window->w;
  y2 = y1 + window->h;

  if(draw_borders) {

    /* Draw window frame. */  
    if(focus & CTK_FOCUS_WINDOW) {
      (void)textcolor(WINDOWCOLOR_FOCUS);
    } else {
      (void)textcolor(WINDOWCOLOR);
    }

    if(y >= clipy1) {
      cputcxy(x, y, (char)CH_ULCORNER);
      gotoxy(wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2, wherey());
      chline(window->w - (wherex() - x) - 2);
      cputcxy(x2, y, (char)CH_URCORNER);
    }

    h = window->h;
  
    if(clipy1 > y1) {
      if(clipy1 - y1 < h) {
	h = clipy1 - y1;
	y1 = clipy1;
      } else {
	h = 0;
      }
    }

    if(clipy2 < y1 + h) {
      if(y1 >= clipy2) {
	h = 0;
      } else {
	h = clipy2 - y1;
      }
    }

    cvlinexy(x, y1, h);
    cvlinexy(x2, y1, h);  

    if(y + window->h >= clipy1 && y + window->h < clipy2) {
      cputcxy(x, y2, (char)CH_LLCORNER);
      chlinexy(x1, y2, window->w);
      cputcxy(x2, y2, (char)CH_LRCORNER);
    }
  }

  draw_window_contents(window, focus, clipy1, clipy2, x1, x2, y + 1, y2);

#else /* CTK_CONF_WINDOWS */

  draw_window_contents(window, focus, clipy1, clipy2, 0, window->w, 0, window->h);

#endif /* CTK_CONF_WINDOWS */
}
コード例 #16
0
/*-----------------------------------------------------------------------------------*/
int
main(int argc, char **argv)
{
  /*  irqload_init();*/

#ifdef WITH_UIP
  uip_init();
  uip_main_init();
  resolv_init();

#ifdef WITH_TFE
  cs8900a_init();
#endif /* WITH_TFE */


#ifdef WITH_RS232
  rs232dev_init();
#endif /* WITH_RS232 */

#ifdef WITH_TAPDEV
  tapdev_init();
#endif /* WITH_TAPDEV */


#endif /* WITH_UIP */

	conio_init();
    textcolor(1);bgcolor(0);
	clrscr();
	conio_update();
  //joy_load_driver(joy_stddrv);
#if 0
{
 int i,j;
 clrscr();
 textcolor(0);bgcolor(1);
 while(1)
 {
	gotoxy(0,0);
	cprintf("%d\n",i++);
	conio_update();

 	if(kbhit())
	{
		cprintf("       ");
	    cprintf("%02x",cgetc());
		cprintf("\n");
	}
	else
	{
		cprintf("pressed: ---------\n");
	}

	j=joy_read(0);
	cprintf("%08x\n",j);
 }
}
#endif

  ek_init();
  dispatcher_init();
  ctk_init();

  contiki_init();

  programs_init();

  ctk_redraw();
  ek_run();

  clrscr();

  return 0;

  argv = argv;
  argc = argc;
}
コード例 #17
0
ファイル: ctk-conio.c プロジェクト: Inscribe/msp430xf1611
/*-----------------------------------------------------------------------------------*/
static void
draw_widget(struct ctk_widget *w,
	    unsigned char x, unsigned char y,
	    unsigned char clipx, unsigned char clipy,
	    unsigned char clipy1, unsigned char clipy2,
	    unsigned char focus)
{
  unsigned char xpos, ypos, xscroll;
  unsigned char i, j;
  char c, *text;
  unsigned char wfocus;
#if CTK_CONF_ICONS
  unsigned char len;
#endif /* CTK_CONF_ICONS */

  wfocus = 0;
  if(focus & CTK_FOCUS_WINDOW) {    
    (void)textcolor(WIDGETCOLOR_FWIN);
    if(focus & CTK_FOCUS_WIDGET) {
      (void)textcolor(WIDGETCOLOR_FOCUS);
      wfocus = 1;
    }
#if CTK_CONF_WINDOWS
  } else if(focus & CTK_FOCUS_DIALOG) {
    (void)textcolor(WIDGETCOLOR_DIALOG);
    if(focus & CTK_FOCUS_WIDGET) {
      (void)textcolor(WIDGETCOLOR_FOCUS);
      wfocus = 1;
    }
#endif /* CTK_CONF_WINDOWS */
  } else {
    (void)textcolor(WIDGETCOLOR);
  }
  
  xpos = x + w->x;
  ypos = y + w->y;
    
  switch(w->type) {
  case CTK_WIDGET_SEPARATOR:
    if(ypos >= clipy1 && ypos < clipy2) {
      chlinexy(xpos, ypos, w->w);
    }
    break;
  case CTK_WIDGET_LABEL:
    text = w->widget.label.text;
    for(i = 0; i < w->h; ++i) {
      if(ypos >= clipy1 && ypos < clipy2) {
	gotoxy(xpos, ypos);
	cputsn(text, w->w);
	if(w->w - (wherex() - xpos) > 0) {
	  cclear(w->w - (wherex() - xpos));
	}
      }
      ++ypos;
      text += w->w;
    }
    break;
  case CTK_WIDGET_BUTTON:
    if(ypos >= clipy1 && ypos < clipy2) {
      revers(wfocus != 0);
      cputcxy(xpos, ypos, '[');
      cputsn(w->widget.button.text, w->w);
      cputc(']');
      revers(0);
    }
    break;
  case CTK_WIDGET_HYPERLINK:
    if(ypos >= clipy1 && ypos < clipy2) {
      revers(wfocus == 0);
      gotoxy(xpos, ypos);
      (void)textcolor(WIDGETCOLOR_HLINK);
      cputsn(w->widget.button.text, w->w);
      revers(0);
    }
    break;
  case CTK_WIDGET_TEXTENTRY:
    text = w->widget.textentry.text;
    xscroll = 0;
    if(w->widget.textentry.xpos >= w->w - 1) {
      xscroll = w->widget.textentry.xpos - w->w + 1;
    }
    for(j = 0; j < w->h; ++j) {
      if(ypos >= clipy1 && ypos < clipy2) {
	if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
	   w->widget.textentry.ypos == j) {
	  revers(0);
	  cputcxy(xpos, ypos, '>');
	  c = 1;
	  for(i = 0; i < w->w; ++i) {
	    if(c != 0) {
	      c = text[i + xscroll];
	    }
	    revers(i == w->widget.textentry.xpos - xscroll);
	    if(c == 0) {
	      cputc(' ');
	    } else {
	      cputc(c);
	    }
	  }
	  revers(0);
	  cputc('<');
	} else {
	  revers(wfocus != 0 && j == w->widget.textentry.ypos);
	  cvlinexy(xpos, ypos, 1);
	  gotoxy(xpos + 1, ypos);          
	  cputsn(text, w->w);
	  i = wherex();
	  if(i - xpos - 1 < w->w) {
	    cclear(w->w - (i - xpos) + 1);
	  }
	  cvline(1);
	}
      }
      ++ypos;
      text += w->widget.textentry.len + 1;
    }
    revers(0);
    break;
#if CTK_CONF_ICONS
  case CTK_WIDGET_ICON:
    if(ypos >= clipy1 && ypos < clipy2) {
      revers(wfocus != 0);
#if CTK_CONF_ICON_TEXTMAPS
      if(w->widget.icon.textmap != NULL) {
	for(i = 0; i < 3; ++i) {
	  gotoxy(xpos, ypos);
	  if(ypos >= clipy1 && ypos < clipy2) {
	    cputc(w->widget.icon.textmap[0 + 3 * i]);
	    cputc(w->widget.icon.textmap[1 + 3 * i]);
	    cputc(w->widget.icon.textmap[2 + 3 * i]);
	  }
	  ++ypos;
	}
      }
#endif /* CTK_CONF_ICON_TEXTMAPS */
  
      len = (unsigned char)strlen(w->widget.icon.title);
      if(xpos + len >= sizex) {
	xpos = sizex - len;
      }

      gotoxy(xpos, ypos);
      if(ypos >= clipy1 && ypos < clipy2) {
	cputs(w->widget.icon.title);
      }
      revers(0);
    }
    break;
#endif /* CTK_CONF_ICONS */

  default:
    break;
  }
}
コード例 #18
0
ファイル: hack.c プロジェクト: Senevri/conio2hack
void roguelike() {
	enum { KEY_ESC = 27, KEY_ENTER = '\r', KEY_BACKSPACE = 8, 
		CTRL_S = 19, CTRL_P = 16, CTRL_Q = 17, CTRL_B = 2,
		KEY_UP = 72, KEY_DOWN = 80, KEY_LEFT = 75, KEY_RIGHT = 77};	
	

	char screenmap[info.screenheight][info.screenwidth+1]; //y then x
	memset(screenmap, ' ', (info.screenwidth+1)*info.screenheight);

	struct creature * critters = create_creature("playa", '@', LIGHTGRAY, 16+((info.screenwidth-16)/2), info.screenheight/2);
	struct creature * head = critters;
	head->next = create_creature("monsu", 'M', RED, 16+20, 20);

	/* store player for convenience*/
	struct creature * player = critters;

	
	//construct terrain
//	for (int i = 0; i <2; i++){
//		terrain[i].character = symbols[i][0];
//		terrain[i].color = symbols[i][1];
//	}
	for (int i = 3; i <256; i++){
		// zero unused values
		//
		terrain[i].name="undefined";
		terrain[i].character = 0;
		terrain[i].color = 0;

	}


	int val; // getch value 
	clrscr();
	char * title[] = {"Roguelike", "Press Any Key"};
	for (int i=0; i!=2; i++){
		gotoxy((info.screenwidth-(strchr(title[i], '\0')-title[i]))/2, -3+i+info.screenheight/2);
		printf("%s", title[i]);
	}
	getch();
	clrscr();
	
	for (int i = 0; i < info.screenheight-1; i++){
		screenmap[i][15] = '|';
		screenmap[i][0] = '*';
		screenmap[i][info.screenwidth-1] = '*';
		screenmap[i][info.screenwidth]='\0';
	}
	for (int i = 0; i < info.screenwidth; i++){
		screenmap[0][i] = '*';
		screenmap[info.screenheight-2][i] = '*';		
	}
	//let's make a lawn
	
	for (int y=1; y < info.screenheight-2; y++) {
		for (int x=16; x < info.screenwidth-1; x++) {
			screenmap[y][x] = (90 < rand() % 100) ? WATER : GRASS;
		}
	}
	// a wall.... 
	//
	
	for (int x=20; x<30;x++){
		screenmap[5][x] = WALL;
		screenmap[15][x] = WALL;
	} 
	for (int y=5; y<15;y++){
		screenmap[y][20] = WALL;
		screenmap[y][30] = WALL;
	} 

	textcolor(WHITE);
	full_refresh(&screenmap[0][0], terrain);
	draw_creatures(head);
	gotoxy(0,0);
	_setcursortype(_NOCURSOR);
	_setcursortype(0);
	while((val=getch())!=CTRL_Q) {
		erase_creatures(head, &screenmap[0][0], terrain);
		player = handle_input(val, player, (char *)screenmap);
		head = update_creature_position(head, player->name, player->x, player->y);
		draw_creatures(head);
		textcolor(WHITE);		
		putchxy(2, 2, ':');
		printf("Test");
		_setcursortype(_NOCURSOR);
		_setcursortype(0);
    }
	_setcursortype(_NORMALCURSOR);
	textcolor(YELLOW);
}
コード例 #19
0
ファイル: plat64.c プロジェクト: StewBC/cc65-Chess
// Draw a tile with background and piece on it for positions 0..63
void plat_DrawSquare(char position)
{
	char piece, color, dx, dy;
	char y = position / 8, x = position & 7;
	char* drawDest = (char*)SCREEN_RAM+SCREEN_WIDTH+(y*SCREEN_WIDTH*BOARD_PIECE_HEIGHT)+(x*BOARD_PIECE_WIDTH)+1;
	char blackWhite = !((x & 1) ^ (y & 1));
	
	if(blackWhite)
		color = COLOR_WHITE;
	else
		color = COLOR_BLACK;
	
	// Unsofisticated draw			
	for(dy=0; dy<BOARD_PIECE_HEIGHT; ++dy)
	{
		for(dx=0; dx<BOARD_PIECE_WIDTH; ++dx)
		{
			*drawDest = BOARD_BLOCK;
			*(drawDest+COLOR_OFFSET) = 8+color; // Color's > 8 are multi-color mode colors
			drawDest += 1;
		}
		drawDest += (SCREEN_WIDTH - BOARD_PIECE_WIDTH);
	}

	// Show the attack numbers
	if(gShowAttackBoard)
	{
		textcolor(COLOR_RED);
		gotoxy(1+x*BOARD_PIECE_WIDTH,(y+1)*BOARD_PIECE_HEIGHT);
		cprintf("%d",(gpAttackBoard[giAttackBoardOffset[position][0]]));
		textcolor(COLOR_YELLOW);
		gotoxy(1+x*BOARD_PIECE_WIDTH+3,(y+1)*BOARD_PIECE_HEIGHT);
		cprintf("%d",(gpAttackBoard[giAttackBoardOffset[position][1]]));
		gotoxy(1+x*BOARD_PIECE_WIDTH,1+y*BOARD_PIECE_HEIGHT);
		cprintf("%02X",gChessBoard[y][x]);
		gotoxy(1+x*BOARD_PIECE_WIDTH+3,1+y*BOARD_PIECE_HEIGHT);
		cprintf("%d",(gChessBoard[y][x]&PIECE_WHITE)>>7);
	}
	
	drawDest -= ((BOARD_PIECE_HEIGHT * SCREEN_WIDTH)-1);
	
	// Get the piece data to draw the piece over the tile
	piece = gChessBoard[y][x];
	color = piece & PIECE_WHITE;
	piece &= PIECE_DATA;
	
	if(piece)
	{
		// The white pieces are 36 characters after the start of the black pieces 
		// (6 pieces at 6 characters each to draw a piece)
		if(color)
			color = 36;
			
		color += CHARMAP_DEST+(piece-1)*6;

		drawDest[0] = color;
		drawDest[1] = color+3;
		drawDest[SCREEN_WIDTH] = color+1;
		drawDest[SCREEN_WIDTH+1] = color+4;
		drawDest[2*SCREEN_WIDTH] = color+2;
		drawDest[2*SCREEN_WIDTH+1] = color+5;
	}
}
コード例 #20
0
ファイル: hack.c プロジェクト: Senevri/conio2hack
static inline void draw_creature(struct creature * creature) {
	textcolor(creature->sym.color);
	putchxy(creature->x, creature->y, creature->sym.character);
}
コード例 #21
0
ファイル: plat64.c プロジェクト: StewBC/cc65-Chess
/*-----------------------------------------------------------------------*/
void plat_ShowMessage(char *str, char color)
{
	gotoxy(1+(8*BOARD_PIECE_WIDTH),SCREEN_HEIGHT-1);
	textcolor(color);
	cprintf("%.*s",SCREEN_WIDTH-1-(8*BOARD_PIECE_WIDTH),str);
}
コード例 #22
0
int searchbook(void)
{
status("Search By <n>Name <a>Author <i>ISBN  <b>Book No");
for(;;)
{
	ch=tolower(getch());
	if (ch=='n'|| ch==13)
	{
		status("");
		gotoxy(15,8+36);textcolor(RED);cprintf("Book Name : ");
		i=input(29,8+36,tempo,30);

		rewind(fp); // moves file pointer to beginning
			while(fread(&book,rec_size,1,fp)==1)
				{
				if(strcmp(book.author,tempo)==0)
				{
				status("");
				clsview();
				oneatime_show();
				return 1;
				}
				else return 0;
				}
	}
	else if(ch=='a')
	{
		status("");
		gotoxy(15,8+36);textcolor(RED);cprintf("Author Name : ");

		i=input(29,8+36,tempo,30);
		rewind(fp); // moves file pointer to beginning
			while(fread(&book,rec_size,1,fp)==1)
				{
				if(strcmp(book.author,tempo)==0)
				{
				status("");
				clsview();
				oneatime_show();
				return 1;
				}
				else return 0;
				}
	}
	else if (ch==27){status(""); status("Search cancelled!");break;}

	else if (ch=='i'|| ch==13)
			{
			status("");
			gotoxy(15,8+36);textcolor(RED);cprintf("Book ISBN : ");
			i=input(28,8+36,tempo,30);

			rewind(fp); // moves file pointer to beginning
			while(fread(&book,rec_size,1,fp)==1)
				{
				if(strcmp(book.isbn,tempo)==0)
				{
				status("");
				clsview();
				oneatime_show();
				return 1;
				}
				else return 0;
				}
	}

	else if (ch=='b'|| ch==13)
		{
		status("");
		gotoxy(15,8+36);textcolor(RED);cprintf("Book No : ");
		i=input(26,8+36,tempo,30);

		rewind(fp); // moves file pointer to beginning
		recold=recno;
		recno=0;
		while(fread(&book,rec_size,1,fp)==1)
			{       recno++;
			if(strcmp(book.bookno,tempo)==0)
			{
			status("");
			clsview();
			oneatime_show();
			return 1;
			}
			else {recno=recold;return 0;}
	}		}
	else {sound(1000);delay(300);nosound();}
}//For Loop
ch='n';
return 0;

}
コード例 #23
0
ファイル: js_conio.c プロジェクト: kindy/synchronet-bbs-1
static JSBool js_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
{
	jsval idval;
    jsint		tiny;
	int32		i=0;
	JSBool		b;
	jsrefcount	rc;

    JS_IdToValue(cx, id, &idval);
    tiny = JSVAL_TO_INT(idval);

	switch(tiny) {
		case PROP_WSCROLL:
			JS_ValueToBoolean(cx, *vp, &_wscroll);
			break;
		case PROP_DIRECTVIDEO:
			JS_ValueToBoolean(cx, *vp, &directvideo);
			break;
		case PROP_HOLD_UPDATE:
			JS_ValueToBoolean(cx, *vp, &hold_update);
			break;
		case PROP_PUTTEXT_CAN_MOVE:
			JS_ValueToBoolean(cx, *vp, &puttext_can_move);
			break;
		case PROP_ESCDELAY:
			if(cio_api.ESCDELAY) {
				if(!JS_ValueToInt32(cx, *vp, (int32*)cio_api.ESCDELAY))
					return JS_FALSE;
			}
			break;
		case PROP_TEXTATTR:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textattr(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_WHEREX:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			gotoxy(i, cio_textinfo.cury);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_WHEREY:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			gotoxy(cio_textinfo.curx, i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTMODE:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textmode(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTBACKGROUND:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textbackground(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTCOLOR:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textcolor(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_CLIPBOARD:
			{
				size_t	len;
				char	*bytes;

				JSVALUE_TO_MSTRING(cx, *vp, bytes, &len);
				HANDLE_PENDING(cx);
				if(!bytes)
					return JS_FALSE;
				rc=JS_SUSPENDREQUEST(cx);
				copytext(bytes, len+1);
				free(bytes);
				JS_RESUMEREQUEST(cx, rc);
			}
			break;
		case PROP_HIGHVIDEO:
			JS_ValueToBoolean(cx, *vp, &b);
			rc=JS_SUSPENDREQUEST(cx);
			if(b)
				highvideo();
			else
				lowvideo();
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_LOWVIDEO:
			JS_ValueToBoolean(cx, *vp, &b);
			rc=JS_SUSPENDREQUEST(cx);
			if(b)
				lowvideo();
			else
				highvideo();
			JS_RESUMEREQUEST(cx, rc);
			break;
	}

	return(JS_TRUE);
}
コード例 #24
0
void bye(void) //The last thank you screen
{
clrscr();
textcolor(RED);
box(8,3,72,47,"");
textcolor(GREEN);
box(9,4,71,46,"");
textcolor(BLUE);
box(10,5,70,45,"THANK YOU");

textcolor(YELLOW);
gotoxy(25,7);
cprintf("OUR SPECIAL THANKS GOES TO");
gotoxy(20,8);
textcolor(GREEN);
cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
gotoxy(25,9);
cprintf("       OUR FAMILY");
gotoxy(25,11);
cprintf("       OUR FRIENDS");
gotoxy(25,13);
cprintf("         OUR SIRS");
gotoxy(11,15);
cprintf("  HIMALAYA COLLEGE OF ENGINEERING (T.U) - 0977-01-4438702");
gotoxy(25,17);
cprintf("          and");
gotoxy(25,19);
cprintf("       OUR USERS");
textcolor(YELLOW);
gotoxy(25,22);
cprintf("   SPECIAL CREDITS TO");
textcolor(GREEN);
gotoxy(25,23);
cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");

textcolor(RED);
box(27,24,47,26,"");
gotoxy(29,25);
cprintf("THE `SAJEB' GROUP");

textcolor(YELLOW);
gotoxy(25,28);
cprintf("       Samir Thapa");
gotoxy(25,29);
cprintf("<Procedural Fn. Development>");
textcolor(DARKGRAY);gotoxy(25,30);
cprintf("   [email protected]");

textcolor(YELLOW);
gotoxy(25,32);
cprintf("     Janak Raj Pathak");
gotoxy(25,33);
cprintf("     <File Handling>");
textcolor(DARKGRAY);gotoxy(25,34);
cprintf("   [email protected]");

textcolor(YELLOW);
gotoxy(25,36);
cprintf("      Bhupal Sapkota");
gotoxy(22,37);
cprintf("<Interface Design & Overall Development>");
textcolor(DARKGRAY);gotoxy(25,38);
cprintf("    [email protected]");

textcolor(WHITE);
gotoxy(25,43);
cprintf("  <PRESS ANY KEY TO END>");
fclose(fp); //File is closed at last
getch();exit(EXIT_SUCCESS); //exit(0)
}
コード例 #25
0
ファイル: test_6.c プロジェクト: Yukariko/is_proj_15
void start()
{
	int x, y, i;
	char c;

	textcolor(0x0005);
	for(i=0;i<8;i+=2) // C
	{
		Sleep(30);
		gotoxy(12-i,2);
		printf("◆");
	}
	for(i=0;i<1;i++)
	{
		Sleep(30);
		gotoxy(4,3);
		printf("◆");
	}
	for(i=0;i<3;i++)
	{
		Sleep(30);
		gotoxy(3,4+i);
		printf("◆");
	}
	for(i=0;i<1;i++)
	{
		Sleep(30);
		gotoxy(4,7);
		printf("◆");
	}
	for(i=0;i<8;i+=2) 
	{
		Sleep(30);
		gotoxy(6+i,8);
		printf("◆");
	}

	for(i=0;i<7;i++) // R
	{
		Sleep(30);
		gotoxy(16,2+i);
		printf("◆");
	}
	for(i=0;i<6;i+=2)
	{
		Sleep(30);
		gotoxy(18+i,2);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		Sleep(30);
		gotoxy(23,3+i);
		printf("◆");
	}
	for(i=0;i<6;i+=2)
	{
		Sleep(30);
		gotoxy(22-i,5);
		printf("◆");
	}
	for(i=0;i<3;i++)
	{
		Sleep(30);
		gotoxy(23+i,6+i);
		printf("◆");
	} 

	for(i=0;i<1;i++) // A
	{
		Sleep(30);
		gotoxy(33,2);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		Sleep(30);
		gotoxy(32-i,3+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		Sleep(30);
		gotoxy(29,7+i);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		Sleep(30);
		gotoxy(34+i,3+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		Sleep(30);
		gotoxy(37,7+i);
		printf("◆");
	}
	for(i=0;i<5;i+=2)
	{
		Sleep(30);
		gotoxy(31+i,6);
		printf("◆");
	}

	for(i=0; i<10; i+=2) //Z
	{
		Sleep(30);
		gotoxy(41+i,2);
		printf("◆");
	}

	for(i=0; i<5; i++)
	{
		Sleep(30);
		gotoxy(47-i,3+i);
		printf("◆");
	}

	for(i=0; i<10; i+=2)
	{
		Sleep(30);
		gotoxy(41+i,8);
		printf("◆");
	}

	for(i=0;i<4;i++) // Y
	{
		Sleep(30);
		gotoxy(53+i,2+i);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		Sleep(30);
		gotoxy(61-i,2+i);
		printf("◆");
	}
	for(i=0;i<3;i++)
	{
		Sleep(30);
		gotoxy(57,6+i);
		printf("◆");
	}

	textcolor(0x000C);
	Sleep(400);

	for(i=0;i<1;i++) // A
	{
		gotoxy(14,12);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		gotoxy(13-i,13+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		gotoxy(10,17+i);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		gotoxy(15+i,13+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		gotoxy(18,17+i);
		printf("◆");
	}
	for(i=0;i<7;i+=2)
	{
		gotoxy(10+i,16);
		printf("◆");
	}

	Sleep(400);

	for(i=0;i<10;i+=2) // T
	{
		gotoxy(22+i,12);
		printf("◆");
	}
	for(i=0;i<6;i++)
	{
		gotoxy(26,13+i);
		printf("◆");
	}

	Sleep(400);

	for(i=0;i<10;i+=2) // T
	{
		gotoxy(34+i,12);
		printf("◆");
	}
	for(i=0;i<6;i++)
	{
		gotoxy(38,13+i);
		printf("◆");
	}

	Sleep(400);

	for(i=0;i<1;i++) // A
	{
		gotoxy(49,12);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		gotoxy(48-i,13+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		gotoxy(45,17+i);
		printf("◆");
	}
	for(i=0;i<4;i++)
	{
		gotoxy(50+i,13+i);
		printf("◆");
	}
	for(i=0;i<2;i++)
	{
		gotoxy(53,17+i);
		printf("◆");
	}
	for(i=0;i<7;i+=2)
	{
		gotoxy(45+i,16);
		printf("◆");
	}

	Sleep(400);

	for(i=0;i<8;i+=2) // C
	{
		gotoxy(66-i,12);
		printf("◆");
	}
	for(i=0;i<1;i++)
	{
		gotoxy(58,13);
		printf("◆");
	}
	for(i=0;i<3;i++)
	{
		gotoxy(57,14+i);
		printf("◆");
	}
	for(i=0;i<1;i++)
	{
		gotoxy(58,17);
		printf("◆");
	}
	for(i=0;i<8;i+=2) 
	{
		gotoxy(60+i,18);
		printf("◆");
	}

	Sleep(400);

	for(i=0; i<7; i++) //K
	{
		gotoxy(70,12+i);
		printf("◆");
	}
	for(i=0; i<4; i++)
	{
		gotoxy(77-i,12+i);
		printf("◆");
	}
	for(i=0; i<1; i++)
	{
		gotoxy(72,15);
		printf("◆");
	}
	for(i=0; i<3; i++)
	{
		gotoxy(75+i,16+i);
		printf("◆");
	}

	textcolor(0x0007);
	for(i=0; i<5; i++) printf("\n");
	printf("                                press any key...\n");
	while(1){
		if(kbhit())
		{
			c=getch();
			system("cls");
			return;
		}



		//어두운 회색으로 바꾸기 

		textcolor(0x0008);
		Sleep(200);

		for(i=0;i<1;i++) // A
		{
			gotoxy(33,2);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(32-i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(29,7+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(34+i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(37,7+i);
			printf("◆");
		}
		for(i=0;i<5;i+=2)
		{
			gotoxy(31+i,6);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<7;i++) // R
		{
			gotoxy(16,2+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(18+i,2);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(23,3+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(22-i,5);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(23+i,6+i);
			printf("◆");
		} 

		for(i=0; i<10; i+=2) //Z
		{
			gotoxy(41+i,2);
			printf("◆");
		}

		for(i=0; i<5; i++)
		{
			gotoxy(47-i,3+i);
			printf("◆");
		}

		for(i=0; i<10; i+=2)
		{
			gotoxy(41+i,8);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<8;i+=2) // C
		{
			gotoxy(12-i,2);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,3);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(3,4+i);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,7);
			printf("◆");
		}
		for(i=0;i<8;i+=2) 
		{
			gotoxy(6+i,8);
			printf("◆");
		}

		for(i=0;i<4;i++) // Y
		{
			gotoxy(53+i,2+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(61-i,2+i);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(57,6+i);
			printf("◆");
		}

		//밝은 회색으로 바꾸기 

		textcolor(0x0007);
		Sleep(200);

		for(i=0;i<1;i++) // A
		{
			gotoxy(33,2);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(32-i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(29,7+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(34+i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(37,7+i);
			printf("◆");
		}
		for(i=0;i<5;i+=2)
		{
			gotoxy(31+i,6);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<7;i++) // R
		{
			gotoxy(16,2+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(18+i,2);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(23,3+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(22-i,5);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(23+i,6+i);
			printf("◆");
		} 

		for(i=0; i<10; i+=2) //Z
		{
			gotoxy(41+i,2);
			printf("◆");
		}

		for(i=0; i<5; i++)
		{
			gotoxy(47-i,3+i);
			printf("◆");
		}

		for(i=0; i<10; i+=2)
		{
			gotoxy(41+i,8);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<8;i+=2) // C
		{
			gotoxy(12-i,2);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,3);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(3,4+i);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,7);
			printf("◆");
		}
		for(i=0;i<8;i+=2) 
		{
			gotoxy(6+i,8);
			printf("◆");
		}

		for(i=0;i<4;i++) // Y
		{
			gotoxy(53+i,2+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(61-i,2+i);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(57,6+i);
			printf("◆");
		}
		//보라색으로 바꾸기

		textcolor(0x0005);
		Sleep(200);

		for(i=0;i<1;i++) // A
		{
			gotoxy(33,2);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(32-i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(29,7+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(34+i,3+i);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(37,7+i);
			printf("◆");
		}
		for(i=0;i<5;i+=2)
		{
			gotoxy(31+i,6);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<7;i++) // R
		{
			gotoxy(16,2+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(18+i,2);
			printf("◆");
		}
		for(i=0;i<2;i++)
		{
			gotoxy(23,3+i);
			printf("◆");
		}
		for(i=0;i<6;i+=2)
		{
			gotoxy(22-i,5);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(23+i,6+i);
			printf("◆");
		} 

		for(i=0; i<10; i+=2) //Z
		{
			gotoxy(41+i,2);
			printf("◆");
		}

		for(i=0; i<5; i++)
		{
			gotoxy(47-i,3+i);
			printf("◆");
		}

		for(i=0; i<10; i+=2)
		{
			gotoxy(41+i,8);
			printf("◆");
		}

		Sleep(300);

		for(i=0;i<8;i+=2) // C
		{
			gotoxy(12-i,2);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,3);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(3,4+i);
			printf("◆");
		}
		for(i=0;i<1;i++)
		{
			gotoxy(4,7);
			printf("◆");
		}
		for(i=0;i<8;i+=2) 
		{
			gotoxy(6+i,8);
			printf("◆");
		}

		for(i=0;i<4;i++) // Y
		{
			gotoxy(53+i,2+i);
			printf("◆");
		}
		for(i=0;i<4;i++)
		{
			gotoxy(61-i,2+i);
			printf("◆");
		}
		for(i=0;i<3;i++)
		{
			gotoxy(57,6+i);
			printf("◆");
		}

	}
}
コード例 #26
0
void setscreen(void) // THE DIVISION OF SCREEN TO DIFFERENT SECTIONS
{
textbackground(BLACK);
clrscr();
//Body box
//SETS USER DATA DISPLAY AREA FOR one on one view or tabview
if(view==1)//Admin
  {textcolor(BLUE);box(1,1,80,49,"THE LIBRARY : ADMIN");}
else //GUEST
  {textcolor(BLUE);box(1,1,80,49,"THE LIBRARY : GUEST");}

//Title box
textcolor(BLUE);box(2,2,79,4,"");
textcolor(YELLOW);len=strlen(title);gotoxy(77/2-len/2,3);cprintf(title);

textcolor(DARKGRAY);
box(6-2,8+34,6+49,47,"Status/Help");

//HELP BOX
textcolor(LIGHTGREEN);
box(57,6,79,8,"Record No.");

//General Keys box
box(x+51,y+2,79,y+10,"General Keys");
textcolor(WHITE);
gotoxy(x+52,y+4);
cprintf("next- <spc/r-arrow>");
gotoxy(x+52,y+6);
cprintf("    back- <l-arrow>");
gotoxy(x+52,y+8);
cprintf("        home- <esc>");

//Procedural keys
textcolor(LIGHTGREEN);
box(x+51,y+12,79,y+22,"Precedural Keys");
if (view==1) textcolor(WHITE);
else textcolor(DARKGRAY);
gotoxy(x+52,y+14);
cprintf("      add book- <a>");
gotoxy(x+52,y+16);
cprintf("     edit info- <e>");
gotoxy(x+52,y+18);
cprintf("        delete- <d>");
gotoxy(x+52,y+20);
cprintf(" issue/unissue- <i/u>");

//Sepcial Function Keys
textcolor(LIGHTGREEN);
box(x+51,y+24,79,y+34,"Special Fn Keys");
textcolor(WHITE);
gotoxy(x+52,y+26);
cprintf("     find book- <f>");
if(tabview==0) textcolor(DARKGRAY);
else textcolor(WHITE);
gotoxy(x+52,y+28);
cprintf("     sort book- <s>");
textcolor(WHITE);
gotoxy(x+52,y+30);
cprintf("export to html- <x>");
gotoxy(x+52,y+32);
cprintf("   toggle view- <t>");

//Developed by
textcolor(LIGHTGREEN);
box(x+51,43,79,48,"Developed By");
textcolor(YELLOW);
gotoxy(x+52,44);
cprintf("  (C) SAJEB GROUP");
gotoxy(x+52,45);
cprintf("Phone 0977-01-4438702");
gotoxy(x+52,46);
cprintf("     HCOE,KALOPUL");
gotoxy(x+52,47);
cprintf("      2062 BCT");
}
コード例 #27
0
ファイル: deplacements.c プロジェクト: Vskilet/PacMan-C
void deplacements(char terrain[20][38], coordonees *PacMan, coordonees *fantomeA, coordonees *fantomeB, coordonees *fantomeC, coordonees *fantomeD)
{
    char entree, pointA = ' ', pointB = ' ', pointC = ' ', pointD = ' ';
    int directionA = 0, directionB = 0, directionC = 0, directionD = 0;
    int score=0, bonus = 0, frame = 0;
    int c;
    int vies;


    for(vies = 3 ; vies > 0 ; vies--)
    {

        //Le PacMan se déplace à l'aide des touches z,q,s et d. Le jeu peut être quitté avec Esc

        affichage(terrain, score, bonus, frame, vies);

        entree = getch(); //Cette commande permet au jeu de ne pas démarer tout de suite, mais d'attendre que le joueur soit pret

        do
        {

            /*On récupère les entrées au clavier grace à la fonction GetKeyState qui est dans windows.h
              Les tests empèchent le joueur de diriger PacMan vers un mur (cela ralentirai le jeu)*/
            if(GetKeyState(0x5A) < 0 && (terrain[PacMan->i - 1][PacMan->j] == ' ' || terrain[PacMan->i - 1][PacMan->j] == '.' || terrain[PacMan->i - 1][PacMan->j] == 'M'))
            {
                entree = 'z';
            }

            if(GetKeyState(0x51) < 0 && (terrain[PacMan->i][PacMan->j - 1] == ' ' || terrain[PacMan->i][PacMan->j - 1] == '.' || terrain[PacMan->i][PacMan->j - 1] == 'M'))
            {
                entree = 'q';
            }

            if(GetKeyState(0x53) < 0 && (terrain[PacMan->i + 1][PacMan->j] == ' ' || terrain[PacMan->i + 1][PacMan->j] == '.' || terrain[PacMan->i + 1][PacMan->j] == 'M'))
            {
                entree = 's';
            }

            if(GetKeyState(0x44) < 0 && (terrain[PacMan->i][PacMan->j + 1] == ' ' || terrain[PacMan->i][PacMan->j + 1] == '.' || terrain[PacMan->i][PacMan->j + 1] == 'M'))
            {
                entree = 'd';
            }

            if(GetKeyState(VK_ESCAPE) < 0)
            {
                entree = 'Q';
            }


            //En fonction de la touche appuiée on déplace le PacMan

            switch(entree)
            {

                case 's':

                    if(terrain[PacMan->i + 1][PacMan->j] == '.') //Si PacMan se dirige vers un point on supprime le point et on incrémente le score
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        score = score + 1;
                    }
                    else if(terrain[PacMan->i + 1][PacMan->j] == ' ') //Si il n'y a rien on déplace juste PacMan
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';

                    }
                    else if(terrain[PacMan->i + 1][PacMan->j] == 'M' && !bonus) //Si c'est un fantôme et que le bonus n'est pas activé c'est perdu
                    {
                        entree = 'Q';
                    }
                    else if(terrain[PacMan->i + 1][PacMan->j] == 'M' && bonus) //Si c'est un fantôme et que le bonus est activé, PacMan mange le fantôme et gagne 10 points
                    {
                        terrain[PacMan->i][PacMan->j] = ' '; //La réaparition de PacMan est gérée plus loin car il y a plusieurs fantômes et qu'il faut les gérer au cas par cas
                        PacMan->i = PacMan->i + 1;
                        score += 10;
                    }
                    else if(terrain[PacMan->i + 1][PacMan->j] == point) //Si la case est un bonus on active le bonus
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        bonus = 1;
                    }
                    break;

                case 'q':

                    if(terrain[PacMan->i][PacMan->j - 1]=='.')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        score = score + 1;
                    }
                    else if(terrain[PacMan->i][PacMan->j - 1]==' ')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';

                    }
                    else if(terrain[PacMan->i][PacMan->j - 1]=='M' && !bonus)
                    {
                        entree = 'Q';
                    }
                    else if(terrain[PacMan->i][PacMan->j - 1]=='M' && bonus)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j - 1;
                        score += 10;
                    }
                    else if(terrain[PacMan->i][PacMan->j - 1]==point)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        bonus = 1;
                    }
                    break;

                case 'z':

                    if(terrain[PacMan->i - 1][PacMan->j] == '.')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        score = score + 1;
                    }
                    else if(terrain[PacMan->i - 1][PacMan->j] == ' ')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';

                    }
                    else if(terrain[PacMan->i - 1][PacMan->j] == 'M' && !bonus)
                    {
                        entree = 'Q';
                    }
                    else if(terrain[PacMan->i - 1][PacMan->j] == 'M' && bonus)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i - 1;
                        score += 10;
                    }
                    else if(terrain[PacMan->i - 1][PacMan->j] == point)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->i = PacMan->i - 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        bonus = 1;
                    }
                    break;

                case 'd':

                    if(terrain[PacMan->i][PacMan->j + 1]=='.')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        score = score + 1;
                    }
                    else if(terrain[PacMan->i][PacMan->j + 1]==' ')
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';

                    }
                    else if(terrain[PacMan->i][PacMan->j + 1]=='M' && !bonus)
                    {
                        entree = 'Q';
                    }
                    else if(terrain[PacMan->i][PacMan->j + 1]=='M' && bonus)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j + 1;
                        score += 10;
                    }
                    else if(terrain[PacMan->i][PacMan->j + 1]==point)
                    {
                        terrain[PacMan->i][PacMan->j] = ' ';
                        PacMan->j = PacMan->j + 1;
                        terrain[PacMan->i][PacMan->j] = 'C';
                        bonus = 1;
                    }
                    break;


            }

            /*On gère les fantômes au cas par cas, il n'y a pas de condition bonus car le seul moyen
              pour que les coordonées de PacMan soient identiques à celle d'un fantôme est que le bonus soit activé*/

            if(PacMan->i == fantomeA->i && PacMan->j == fantomeA->j)
            {
                terrain[fantomeA->i][fantomeA->j] = 'C';
                fantomeA->i = 13;
                fantomeA->j = 15;
                pointA = ' ';
                terrain[fantomeA->i][fantomeA->j] = 'M';
            }
            else if(PacMan->i == fantomeB->i && PacMan->j == fantomeB->j)
            {
                terrain[fantomeB->i][fantomeB->j] = 'C';
                fantomeB->i = 13;
                fantomeB->j = 17;
                pointB = ' ';
                terrain[fantomeB->i][fantomeB->j] = 'M';
            }
            else if(PacMan->i == fantomeC->i && PacMan->j == fantomeC->j)
            {
                terrain[fantomeC->i][fantomeC->j] = 'C';
                fantomeC->i = 13;
                fantomeC->j = 19;
                pointC = ' ';
                terrain[fantomeC->i][fantomeC->j] = 'M';
            }
            else if(PacMan->i == fantomeD->i && PacMan->j == fantomeD->j)
            {
                terrain[fantomeD->i][fantomeD->j] = 'C';
                fantomeD->i = 13;
                fantomeD->j = 21;
                pointD = ' ';
                terrain[fantomeD->i][fantomeD->j] = 'M';
            }

            //Deplacement des fantomes
            directionA = ia(*PacMan, *fantomeA, terrain, directionA);
            directionB = ia(*PacMan, *fantomeB, terrain, directionB);
            directionC = ia(*PacMan, *fantomeC, terrain, directionC);
            directionD = ia(*PacMan, *fantomeD, terrain, directionD);

            pointA = deplacementFantome(directionA, fantomeA, pointA, terrain, &entree, bonus);
            pointB = deplacementFantome(directionB, fantomeB, pointB, terrain, &entree, bonus);
            pointC = deplacementFantome(directionC, fantomeC, pointC, terrain, &entree, bonus);
            pointD = deplacementFantome(directionD, fantomeD, pointD, terrain, &entree, bonus);

            //On affiche la nouvelle frame ainsi générée
            affichage(terrain, score, bonus, frame, vies);

            //compteur de frame
            if(bonus)
            {
                frame++;
            }

            //On réinitialise le bonus après 50 frames
            if(frame>50)
            {
                bonus=0;
                frame=0;
            }

        }while(entree != 'Q');

        if(vies-1>0)
        {

            system("CLS");

            do {

                textcolor(12);
                printf("\n\n\n                              OUILLE !\n\n\n\n");
                textcolor(15);
                printf("Tu as perdu une vie, pour continuer appuye sur la touche espace");
                if(vies>1)
                {
                    printf("\nIl te reste %d vies", vies-1);
                }
                else
                {
                    printf("\nIl te reste %d vie", vies-1);
                }
                c = getch();
                system("CLS");

            }while (c != ' '); //On valide par espace

            terrain[PacMan->i][PacMan->j] = ' ';
            terrain[1][1] = 'C';
            PacMan->i = 1;
            PacMan->j = 1;
        }


    }



    //On vide le buffer clavier car la fonction GetKeyState garde toutes les entrées en mémoire et les ressorts au getch suivant

    system("CLS");

    do {

        textcolor(12);
        printf("\n\n\n                              GAME OVER\n\n\n\n");
        textcolor(15);
        printf("Pour sauvegarder et afficher votre score appuyer sur la touche espace");
        c = getch();
        system("CLS");

    } while (c != ' '); //On valide par espace

    fscore(score);



}
コード例 #28
0
//Programa Principal
int main(void)
{
	char jogador[20], palavra[20], dica[20], corpo[20], achou[20], arquivo[20], aux_letra[20], letra;  
    int creditos, pontos, flag, tam_palavra, tam_letra, i_arquivo, i;
	system("title Jogo Da Forca"); //Título na Janela
	intr();
	textcolor(red);
	printf("\n\t\tDigite seu nome: ");
	textcolor(blue);
	gets(jogador);
	textcolor(lightgreen);
	printf("\n\t\tPE%cA PARA OUTRA PESSOA DIGITAR...", 128);
	getchar();
	clrscr();
	textcolor(yellow);
	printf("\n\t\tPALAVRA CHAVE: ");
	textcolor(cyan);
	gets(palavra);
	textcolor(lightgreen);
	printf("\n\t\tDICA: ");
	textcolor(red);
	gets(dica);
	clrscr();
//Reset variáveis
	i_arquivo=0;
    creditos=6;
    pontos=0;
    tam_palavra=strlen(palavra);
    for (i=0; i<tam_palavra; i++) {
       if (palavra[i]==' ') {
          achou[i]=' ';
          pontos++;
       }
       else {
          palavra[i]=toupper(palavra[i]);
          achou[i]='_';
       }
    }  
    for (i=0; i<20; i++) {
       arquivo[i]=' ';
    }
    for (i=0; i<6; i++) {
       corpo[i]=' ';
    }
    for (i=0; jogador[i]!='\0'; i++) {
       jogador[i]=toupper(jogador[i]);
    }
    for (i=0; dica[i]!='\0'; i++) {
       dica[i]=toupper(dica[i]);
    }
    clrscr();
    textcolor(yellow);
    printf ("JOGO DA FORCA 1.0\n\n");
    mostra_forca(corpo, creditos);
    printf ("\n\n");
    mostra_achou(achou, tam_palavra);
    printf ("\n\n");
    puts (dica);
    printf ("\n");
    
    while ((creditos>0)&&(pontos<tam_palavra)) {
       flag=0;
       textcolor(cyan);
       printf ("LETRA: ");
       gets (aux_letra);
       tam_letra=strlen(aux_letra);
       if (tam_letra!=1) {
          printf ("DIGITE \"UMA\" LETRA!\n");
          getch ();
          flag=1;
       }
       else {
          letra=toupper(aux_letra[0]);  
          arquivo[i_arquivo]=letra;
          if (letras_usadas (arquivo, i_arquivo)) { 
             printf ("ESTA LETRA JA FOI!");
             getch ();
             arquivo[i_arquivo]=' ';
             flag=1;
          }
          else {
             arquivo[i_arquivo]=letra;
             i_arquivo++;  
             for (i=0; i<tam_palavra; i++) {
                if (letra==palavra[i]) {
                   achou[i]=letra;
                   flag=1;
                   pontos++;
                }
             }
          }
       }
       
       if (flag==0) {
          printf ("ESTA LETRA NAO TEM!", jogador);
          getch ();
          creditos--;
          switch (creditos) { 
             case 0: corpo[0]='\\'; break;
             case 1: corpo[1]='/'; break;
             case 2: corpo[2]='-'; break;
             case 3: corpo[3]='-'; break;
             case 4: corpo[4]='|'; break; 
             case 5: corpo[5]='O'; break;  
          }
       }
       
       //Status do jogo
       system ("cls");
       printf ("JOGO DA FORCA 1.0\n\n");
       mostra_forca(corpo, creditos);
       printf ("\n\n");
       mostra_achou(achou, tam_palavra);
       printf ("\n\n");
       puts (dica);
       printf ("\n");
       printf ("LETRAS JA USADAS: ");
       for (i=0; i<=i_arquivo; i++) {
          printf ("%c ", toupper(arquivo[i]));
       }   
       printf ("\n\n");
       
       //Resultado Final   
       if (pontos==tam_palavra) {
          printf ("%s, VOCE GANHOU!\n", jogador);
       }
       if (creditos==0) {
       	  textcolor(red);
          printf ("%s, VOCE PERDEU!\n", jogador);
          textcolor(cyan);
		  printf ("A PALAVRA ERA ");
		  textcolor(yellow);
          puts (palavra); 
          printf ("\n");
       }
    }
    getch ();
}      
コード例 #29
0
ファイル: foreground.c プロジェクト: jedld/dex-os
void fg_updateinfo()
{
int refreshrate=100; //determines how long in milliseconds until the task manager refreshes its display
int loop;
int choice = 0;
 //Create a screen buffer that we can use   
 fg_out = Dex32CreateDDL();
 
 //register myself
 fg_fginfo = fg_register(fg_out,getprocessid());
 
 fg_myslot = fg_fginfo->id;
 
 //prevent F5 and F6 from setting this process as the foreground
 fg_fginfo->ignore = 1; 
 
 Dex32SetProcessDDL(fg_out,getprocessid());
 fg_started = 1;

 while(1)
    {
        sleep(50);
        if (fg_state)
        {
        dd_swaptomemory(fg_out);
        clrscr();
        textbackground(BLUE);
        textcolor(WHITE);
        printf("%-79s\n","Dex32- Virtual Console Management");
        textbackground(BLACK);
        
        //Display processes in memory
        fg_showmenu(choice);
        
        dd_swaptohardware(fg_out);
        
        if (kb_keypressed())
        {
           unsigned char c = getch();
           if (c-'0' >= 0 && c-'0' <= 9)
                {
                 int choice = c - '0';
                 if (fg_vconsoles[choice]!=0)
                 if (!fg_vconsoles[choice]->ignore)
                 fg_setforeground(choice);
                 
                }
           else
           if (c == KEY_UP)
                {
                 if (choice>0) choice -- ;
                }
           else 
           if (c == KEY_DOWN)
                {
                 if (choice<FG_MAXCONSOLE -1) choice++;
                }
           else
           if (c== '\n')
                {
                  if (fg_vconsoles[choice]!=0)
                  if (!fg_vconsoles[choice]->ignore)
                  fg_setforeground(choice);
                };      
        };
        };
    };
};
コード例 #30
0
ファイル: pencalib.c プロジェクト: Aliandrana/cc65
/*
** There is a delay between when the VIC sends its signal, and when the display
** shows that signal.  There is another delay between the display and when
** the lightpen says that it saw that signal. Each display and pen is different.
** Therefore, the driver must be calibrated to them.  A white bar is painted on
** the screen; and, a line is drawn down the middle of it.  When the user clicks
** on that line, the difference between its position and where the VIC thinks
** that the pen is pointing becomes an offset that is subtracted from what the
** VIC sees.
*/
void __fastcall__ pen_calibrate (unsigned char *XOffset)
{
    unsigned char oldBg = bgcolor (COLOR_BLUE);
    unsigned char oldText = textcolor (COLOR_GRAY3);
    unsigned char oldRev = revers (1);
    unsigned char sprite0Color = VIC.spr_color[0];
    unsigned char width, width2, height, height4, height8;
    struct mouse_info info;

    screensize (&width, &height);
    width2 = width / 2;
    height4 = height / 4;
    height8 = height4 * 8;

    /* Draw a bar and line. */

    clrscr ();
    cclearxy (0, height4, height4 * width);
    cvlinexy (width2, height4 + 1, height4 - 2);
    revers (0);

    /* Print instructions. */

    cputsxy (width2 - (sizeof COMMAND1) / 2, height / 2 + 1, COMMAND1);
    cputsxy (width2 - (sizeof COMMAND2) / 2, height / 2 + 3, COMMAND2);

    VIC.spr_color[0] = COLOR_GRAY2;
    mouse_show ();
    mouse_move (width2 * 8, height8 / 2);

    for (;;) {
        /* Wait for the main button to be released. */

        do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));

        /* Wait for the main button to be pressed. */

        do {
            mouse_info (&info);
        } while (!(info.buttons & MOUSE_BTN_LEFT));

        /* Find out if the pen is on or off the bar. */

        if (info.pos.y < height8 || info.pos.y >= height8 * 2) {
            break;
        }

        /* On the bar; adjust the offset. */
        /* Characters are eight pixels wide.
        ** The VIC-II sees every other pixel;
        ** so, we use half of the difference.
        */

        *XOffset += (info.pos.x - (width2 * 8 + 8/2)) / 2;
    }

    /* Off the bar; wait for the main button to be released. */

    do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));

    mouse_hide ();
    VIC.spr_color[0] = sprite0Color;
    revers (oldRev);
    textcolor (oldText);
    bgcolor (oldBg);
    clrscr ();
}