void LivePrint(int **matrix, dimension_t dimension, settings_t settings) { int i,j; int temp, column=MAZECOLUMN; switch (settings.levelSize) { case SMALL: column+=32;break; case MEDIUM: column+=20;break; } for (i=0;i<dimension.x;i++) { temp = MAZEROW; for (j=0;j<dimension.y;j++) { if(matrix[j][i]==BLANK) { if (settings.wallColor==LIGHT) changeColor(LIGHTBLANK); else changeColor(DARKBLANK); positionCursor(column,temp++); printf (" "); positionCursor(column,temp++); printf (" "); positionCursor(column,temp++); printf (" "); changeColor(119); } else { if (settings.wallColor==LIGHT) changeColor(LIGHTWALL); else changeColor(DARKWALL); positionCursor(column,temp++); printf ("\260\260\260"); positionCursor(column,temp++); printf ("\261\261\261"); positionCursor(column,temp++); printf ("\262\262\262"); } } column+=3; } }
void highscores () { FILE *list,*list1; highscore_t *highscores, *highscores1; int input, i=1; int row=25, rowTemp=row+55, columnTemp=22, column=22; backgroundImage (TEXT); positionCursor(43,11); printf (" _ _ _____ _____ _ _ _____ _____ ____ _____ ______ \n"); positionCursor(43,12); printf (" | | | |_ _/ ____| | | | / ____|/ ____/ __ \\| __ \\| ____|\n"); positionCursor(43,13); printf (" | |__| | | || | __| |__| | | (___ | | | | | | |__) | |__ \n"); positionCursor(43,14); printf (" | __ | | || | |_ | __ | \\___ \\| | | | | | _ /| __| \n"); positionCursor(43,15); printf (" | | | |_| || |__| | | | | ____) | |___| |__| | | \\ \\| |____ \n"); positionCursor(43,16); printf (" |_| |_|_____\\_____|_| |_| |_____/ \\_____\\____/|_| \\_\\______|\n"); positionCursor(43,17); printf (" "); positionCursor (35,19); printf ("REAL TIME"); positionCursor (100,19); printf ("POSITIONAL"); list = fopen ("highscore.bin","rb"); highscores = readFromFile (list); list1 = fopen ("highscore1.bin","rb"); highscores1 = readFromFile (list1); while (1) { if((highscores==null)||(highscores1==null)) break; positionCursor (row,column); printf ("%d. %.2f %s | ", i, highscores->score, highscores->name); printf(ctime(&(highscores->date))); positionCursor (rowTemp,column); column+=2; printf ("%d. %.2f %s | ", i++, highscores1->score, highscores1->name); printf(ctime(&(highscores1->date))); highscores=highscores->succ; highscores1=highscores1->succ; } dealocateList(highscores); fclose(list); fclose(list1); while (1) { input=controls(_getch()); if ((input==PAUSE)||(input==EXIT)) break; } }
int main(void) { uint8_t byteBuffer[14+6]; int data[7+3]; initUSART(); i2c_init(); // init I2C interface // clear screen transmitByte(0x1b); printString("[2J"); //search_i2c(); /* configure NineAxis registers*/ if (init_nineAxis() & init_nineAxisMag()) { char b; while ((b = receiveByte()) != 'x') transmitByte(b); while (1) { read_nineAxis(59,byteBuffer,14); read_NineAxisMag(0x03,byteBuffer+14,6); //swapBuffer(byteBuffer, 14+6); convertBuffer(byteBuffer, data, 7+3); // clear screen transmitByte(0x1b); printString("[2J"); positionCursor(1,8); printString("9-Axis readings"); positionCursor(3,14); printString("X"); positionCursor(3,24); printString("Y"); positionCursor(3,34); printString("Z"); positionCursor(5,4); printString("accel:"); positionCursor(7,5); printString("gyro:"); positionCursor(9,6); printString("mag:"); positionCursor(11,5); printString("temp:"); positionCursor(5,10); printInt(data[0]); positionCursor(5,20); printInt(data[1]); positionCursor(5,30); printInt(data[2]); positionCursor(7,10); printInt(data[4]); positionCursor(7,20); printInt(data[5]); positionCursor(7,30); printInt(data[6]); positionCursor(9,10); printInt(data[7]); positionCursor(9,20); printInt(data[8]); positionCursor(9,30); printInt(data[9]); positionCursor(11,10); float tempc = data[3]/340.0 + 35; float tempf = tempc * 1.8 + 32; printInt((int) tempc); transmitByte(0xc2); transmitByte(0xb0); // degree symbol printString("C ("); printInt((int) tempf); transmitByte(0xc2); transmitByte(0xb0); // degree symbol printString("F)"); _delay_ms(1000); } } return(0); }
void startAnimation () { //***debug**mode****on/off**** int DEBUGGING=FALSE; //**************************** int blink=0; changeColor(ARROW); system ("CLS"); changeColor(ARROW); positionCursor(50,20); printf ("RESIZE WINDOW TO FULL SCREEN \n" " \n" " -/++/-` \n" " `syyhhhhho. \n" " `/yyyyhhhhhho- \n" " :hsoyyyyhhhhhhs: \n" " :ddmsoyyhhhhhhhhy/` \n" " :hmmmyoshhhhhhhhhh/` \n" " :ymmmhoshhhhhhhhdh+. \n" " -smmmhoohhhhhhddddo. \n" " .odmmdoohhhhhhhddds- \n" " `+ddddsoyhhhhhhddhy: \n" " `/hdddsoyhhyhhddddh/` ` \n" " :yddhsoyhhhhdddddh+` `:sd- \n" " -sdhhyoshhhhddddddo/sdmmmy \n" " -shhhyoshdddddddddddmmmm: \n" " `.+hhhyoohdddddddddmmmmh` \n" " `/sooydddddddddmmmmmm+ \n" " ``/ydddddddddddddmmmmmd` \n" " yysosssshddddddddddmmmms \n" " -hhhhhhhysosssshdddddmmmm- \n" " `-:+oyhhhhhhhhsosssshdmmy \n" " `.:/oshhhhhhhhyssss- \n" " .-/+syhhhhhhy` \n" " `-:+oy+ "); if (!DEBUGGING) Sleep(3200); changeColor(ETF); system ("CLS"); changeColor(ETF); positionCursor(0,9); printf (" ``.-:://+oosssyyyyyyyysso++/:.` \n" " +dmNNNNMMMMMMMNNNmdddhhhyyyyyyyyhhhhyo:. \n" " .NMMMMyo+/:-..`````` ````.-//` \n" " +MMMMh .--://++oosssyyyyyys. -so. \n" " dMMMM+ :NNMMMMMMMMMMMMMMNNNd- :do` \n" " -MMMMN. odhhyso++oMMMN/-.```` `.. \n" " yMMMMh `` `:ohMMMMNNmmho:. \n" " .NMMMM/ `omNMMdmMMMMyoyhmNh+. `os- \n" " oMMMMm` /mMMmo-`-NMMMm. ``-odms- -mN/ \n" " `mMMMMo +NMMs. +MMMMh` `/dNs` -mN/ \n" " +MMMMN. -NMMo yMMMMo `+Nd- :NN/ \n" " `mMMMMy yMMm` .mMMMN-``.--:/hMNssyNMN: \n" " +MMMMN- mMMy `.--yMMMMNdmmNNMMMMMMMMMMMm. \n" " `mMMMMh mMMd/oshdmmNNMMMMMMMMMMMMMMMMMNhyomMh` \n" " +MMMMM/:/oshNMMMMMMMMMMMMMMMMMMMNmdhyo+:+MN. :NM+ \n" " `mMMMMMMMMMMMMMMMMMMMMNmmdydMMMMd.` -MM- yMN. \n" " +MMMMMMMMMNNNMMMmso/:-.`` .NMMMM: +MM. .NMs \n" " `NMMMMNs+:-..dMMm: sMMMMh .mMd oho \n" " oMMMMM- .hMMNo. .NMMMM- -dMN- \n" " .NMMMMy `omMMmo-` yMMMMy .omMm/ \n" " sMMMMM. .smMMNhs/-.`:MMMMMhNMNy- `-+. \n" " .NMMMMs .+hNMMMNNmdMMMMMMms: .NM+ \n" " yMMMMN. .:oyhdmmmMMMMh...:+sh+ mMy \n" " -MMMMMo ``.dMMMNdmNMMMMh hMd \n" " hMMMMm` ``.-/oyhmMMMMMMMMMNmds yMd \n" " /MMMMM/ smNMMMMMMMMMNmdyo/-` ``:hMd \n" " `mMMMMh +MMMMNNmdy+/-` `./shmMMNy \n" " oMMMMN. .dyo/:.` ``-/shmMMMMNds:` \n" " .NMMMMo ``.:oydNMMMMMNds/. \n" " yMMMMm ``-/oydmMMMMMMNmho:. \n" " :MMMMM- ``.:+shdNMMMMMMNNmyo/. \n" " `mMMMMy/+shmNMMMMMMMNNmhs/:. \n" " oMMMMMMMMMMMMNNdyo/-` \n" " .MMMMMMNdhs+:.` \n" " sso/-. \n"); if (!DEBUGGING) Sleep(2000); changeColor(GROUND); system ("CLS"); changeColor(GROUND); positionCursor(0,20); printf (" ______ _ ______ _ \n" " / _____|_)_ / _____) (_)_ \n" " | / ___ _| |_ | / ___ ____ ____ _| |_ \n" " | | (___) | _) | | / _ \\| \\| \\| | _) \n" " | \\____/| | |__ | \\____| |_| | | | | | | | | |__ \n" " \\_____/|_|\\___) \\______)___/|_|_|_|_|_|_|_|\\___)\n" " \n" " _______ _______ ______ \n" " (_______|_______) /\\ | ___ \\ \n" " _ _____ / \\ | | _ | | \n" " | | | ___) / /\\ \\| || || | \n" " | |_____| |_____| |__| | || || | \n" " \\______)_______)______|_||_||_| \n"); positionCursor(62,34); printf ("---PRESENTS YOU---"); if (!DEBUGGING) Sleep(2000); system ("CLS"); backgroundImage(WELCOME); if (!DEBUGGING) while (1) { switch (blink) { case 0:{positionCursor (62,40);printf (" -- Press any key -- ");Sleep(500);blink=1;break;} case 1:{positionCursor (62,40);printf (" ");Sleep(500);blink=0;break;} } if(_kbhit()) { positionCursor (62,40); printf (" "); break; } } backgroundImage(MENU); }
void printFormattedMatrix(int **matrix, dimension_t dimension,settings_t settings) { int i,j; int temp, column=MAZECOLUMN; switch (settings.levelSize) { case SMALL: column+=32;break; case MEDIUM: column+=20;break; } for (i=0;i<dimension.x;i++) { temp=MAZEROW; for (j=0;j<dimension.y;j++) { if(matrix[j][i]==BLANK) { if (settings.wallColor==LIGHT) changeColor(LIGHTBLANK); else changeColor(DARKBLANK); positionCursor(column,temp++); printf (" "); positionCursor(column,temp++); printf (" "); positionCursor(column,temp++); printf (" "); changeColor(119); } else if (matrix[j][i]==PLAYER) { if (settings.character==DAZY) { if (settings.wallColor==LIGHT) changeColor(LIGHTDAZY); else changeColor(DARKDAZY); positionCursor(column,temp++); printf (" \225 "); positionCursor(column,temp++); printf ("/|\\"); positionCursor(column,temp++); printf ("/ \\"); changeColor(119); } else { if (settings.wallColor==LIGHT) changeColor(LIGHTLAZY); else changeColor(DARKLAZY); positionCursor(column,temp++); printf (" \17 "); positionCursor(column,temp++); printf ("/()"); positionCursor(column,temp++); printf ("/ \\"); changeColor(119); } } else if (matrix[j][i]==MUMMY) { if (settings.wallColor==LIGHT) changeColor(LIGHTMUMMY); else changeColor(DARKMUMMY); positionCursor(column,temp++); printf ("\\@/"); positionCursor(column,temp++); printf (" | "); positionCursor(column,temp++); printf ("/ \\"); changeColor(119); } else if (matrix[j][i]==HINT) { if (settings.wallColor==LIGHT) changeColor(106); else changeColor(58); positionCursor(column,temp++); printf ("..."); positionCursor(column,temp++); printf ("..."); positionCursor(column,temp++); printf ("..."); changeColor(119); } else if (matrix[j][i]==EXIT) { if (settings.wallColor==LIGHT) changeColor(LIGHTEXIT); else changeColor(DARKEXIT); positionCursor(column,temp++); printf ("\260\260\262"); positionCursor(column,temp++); printf ("\260\260\262"); positionCursor(column,temp++); printf ("\260\260\262"); changeColor(119); } else if (matrix[j][i]==ENTRANCE) { if (settings.wallColor==LIGHT) changeColor(LIGHTENTRANCE); else changeColor(DARKENTRANCE); positionCursor(column,temp++); printf ("\262\260\261"); positionCursor(column,temp++); printf ("\262\260\261"); positionCursor(column,temp++); printf ("\262\260\261"); changeColor(119); } else { if (settings.wallColor==LIGHT) changeColor(LIGHTWALL); else changeColor(DARKWALL); positionCursor(column,temp++); printf ("\260\260\260"); positionCursor(column,temp++); printf ("\261\261\261"); positionCursor(column,temp++); printf ("\262\262\262"); } } column+=3; } }
void printMovement (int beforeRow, int beforeColumn, int afterRow, int afterColumn, int whatToPrint, int *wave, settings_t settings) { int row, size; switch (settings.levelSize) { case SMALL: size=32;break; case MEDIUM: size=20;break; case LARGE: size=0;break; } if (settings.wallColor==LIGHT) changeColor(LIGHTBLANK); else changeColor(DARKBLANK); row=beforeRow*3; positionCursor(MAZECOLUMN+(beforeColumn*3)+size,MAZEROW+row++);printf(" "); positionCursor(MAZECOLUMN+(beforeColumn*3)+size,MAZEROW+row++);printf(" "); positionCursor(MAZECOLUMN+(beforeColumn*3)+size,MAZEROW+row);printf(" "); if (whatToPrint==PLAYER) { row=afterRow*3; if (settings.character==DAZY) { if (settings.wallColor==LIGHT) changeColor(LIGHTDAZY); else changeColor(DARKDAZY); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf(" \225 "); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf("/|\\"); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row);printf("/ \\"); changeColor(119); } else { if (settings.wallColor==LIGHT) changeColor(LIGHTLAZY); else changeColor(DARKLAZY); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf(" \17 "); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf("/()"); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row);printf("/ \\"); changeColor(119); } } else if (*wave==0) { if (settings.wallColor==LIGHT) changeColor(LIGHTMUMMY); else changeColor(DARKMUMMY); row=afterRow*3; positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf("_\@_"); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row++);printf(" | "); positionCursor(MAZECOLUMN+(afterColumn*3)+size,MAZEROW+row);printf("/ \\"); *wave=1; } else if (*wave==1){