void World::PrintTitle() { GoToXY(0, 0); Color(162); for(int i=0; i<(POS_Y_MIN - 2); i++) printf(" "); GoToXY(0, POS_Y_MIN - 2); printf(" A S T E R O I D F I E L D "); GoToXY(0, POS_Y_MIN - 1); Color(162); printf("________________________________________________________________________________"); Color(7); }
void World::PrintHero() { Color(12); if (_myHero->_positionX > POS_X_MIN) { GoToXY(_myHero->_positionX - 2, _myHero->_positionY); printf("-="); } Color(10); GoToXY(_myHero->_positionX, _myHero->_positionY); printf("%c",HERO_MODEL); GoToXY(_myHero->_positionX+1, _myHero->_positionY); printf("="); Color(7); }
void World::PrintGameInfo() { GoToXY(0, COUNTER_POSITION-1); Color(172); printf(" "); Color(162); GoToXY(0, COUNTER_POSITION); Color(160); printf(" AMMO "); Color(172); for (int i = 0; i < _bulletsLeft; i++) { printf(" "); Color(204); printf(" "); Color(172); } for (unsigned int i = 0; i < (NUMBER_OF_BULLETS - _bulletsLeft); i++) { printf(" "); Color(34); printf(" "); Color(172); } for (int i=0; i<(33-NUMBER_OF_BULLETS);i++) { Color(162); printf(" "); } Color(160); printf(" RECORD "); Color(32); printf("%6i ", maxScore); Color(162); GoToXY(64, COUNTER_POSITION); Color(160); printf(" SCORE "); Color(32); printf("%6i ", _score); Color(162); printf(" "); GoToXY(0, COUNTER_POSITION+1); Color(172); printf(" "); GoToXY(0, COUNTER_POSITION+2); printf(" "); Color(7); }
void World::PrintGameOverScreen() { PrintTitle(); PrintGameInfo(); GoToXY(26, 11); printf("GAME OVER: PLAY AGAIN? (Y/N)"); }
void World::PrintBlack() { GoToXY(POS_X_MIN-1, POS_Y_MIN); for (int y = POS_Y_MIN; y <= POS_Y_MAX; y++) { printf(" "); } }
void World::PrintBullets() { Color(10); for (unsigned int i = 0; i < _myBullets.size(); i++) { GoToXY(_myBullets[i]->_positionX, _myBullets[i]->_positionY); printf("%c",BULLET_MODEL); } Color(7); }
void World::PrintStars() { for (unsigned int i = 0; i < _myStars.size(); i++) { GoToXY(_myStars[i]->_positionX, _myStars[i]->_positionY); Color(_myStars[i]->GetColor()); printf("%c",STAR_MODEL); Color(7); } Color(7); }
int main() { int x,y; printf("Now go to (20,3)"); GoToXY(20,3); //getXY WhereXY(&x,&y); printf("x=%d,y=%d",x,y); system("pause"); }
void World::PrintEnemies() { for (unsigned int i = 0; i < _myEnemies.size(); i++) { GoToXY(_myEnemies[i]->_positionX, _myEnemies[i]->_positionY); { Color(14); printf("%c",ENEMY_MODEL); Color(12); printf("I=-"); } } Color(7); }
int ServerMain(LPVOID pointerToObject) { minitialize(); AllocConsole() ; AttachConsole( GetCurrentProcessId() ) ; freopen( "CON", "w", stdout ) ; // Accept a client socket for (int sock=1; sock<1000; sock++) { ClientSocket = accept(ListenSocket, NULL, NULL); char sockprint[80]; char sockchar[4]; itoa(sock,sockchar,10); strcpy(sockprint,"Client "); strcat(sockprint,sockchar); strcat(sockprint," connected."); printm(sockprint); GoToXY(0,23); if (ClientSocket == INVALID_SOCKET) { std::cout<<"accept failed with error: "<<WSAGetLastError()<<"\n"; closesocket(ClientSocket); WSACleanup(); minitialize(); } client[sock].cs=ClientSocket; client[sock].con=true; client[sock].i=clientnumber; client[sock].client=sock; lastclient=clientnumber; hRecvThread = CreateThread(NULL,0,recvfunc,pointerToObject,0,&dwRecvThreadId); clientnumber++; currentclient=clientnumber; } while(true) { Sleep(1000000); } // shutdown the connection since we're done mshutdown(); return 0; }