1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
//MOVE DOWN: CURSOR AND MAP NAVIGATION
void mooveDown (int &navigateRow, int &rp, char mode, int extremeRowPointer, int startMapR, int startMapC, int nrig, int ncol, int cp, int rigMapResol, int colMapResol, int navigateCol, char C[], char F[], char B[])
{
if (mode=='N') {
if (rigMapResol+navigateRow < nrig){
//moove map
navigateRow++;
//update view
printMap (startMapR, startMapC, nrig, ncol, rigMapResol, colMapResol, navigateRow, navigateCol, C, F, B);
}
}
else if(mode=='n'){
if (rigMapResol+navigateRow < nrig){
//moove map
navigateRow=navigateRow+rigMapResol;
if (rigMapResol+navigateRow > nrig) {navigateRow = nrig-rigMapResol;}
//update view
printMap (startMapR, startMapC, nrig, ncol, rigMapResol, colMapResol, navigateRow, navigateCol, C, F, B);
}
}
else {if (rp != startMapR+extremeRowPointer-1){rp=rp+1; gotoyx(rp,cp);} }
}
//PRINT MAP
void printMap (int startMapR, int startMapC, int nrig, int ncol, int rigMapResol, int colMapResol, int navigateRow, int navigateCol, char C[], char F[], char B[])
{
if (rigMapResol > nrig) { rigMapResol = nrig;} //non modifichi MapResol! not reference&
if (colMapResol > ncol) { colMapResol = ncol;} //non modifichi MapResol! not reference&
for (int ir = startMapR ; ir < startMapR+rigMapResol; ir++){
for (int ic = startMapC; ic < startMapC+colMapResol; ic++){
gotoyx(ir,ic);
SetConsoleTextAttribute(HC, translateColorChar(F[(ir-startMapR+navigateRow)*ncol+(ic-startMapC+navigateCol)] , B[(ir-startMapR+navigateRow)*ncol+ (ic-startMapC+navigateCol)]) );
cout << C[((ir-startMapR+navigateRow)*ncol) + (ic-startMapC+navigateCol)];
}
}
}
| |