#include "PongView.h" PongView::PongView() { hOut = GetStdHandle(STD_OUTPUT_HANDLE); GAMEAREA* ga = new GAMEAREA; } PongView::~PongView(void) { delete (ga); } void PongView::drawGameScreen() { ga = PongController::ga; //Oberer Rand for (int x=ga->xMin - 1; x<=ga->xMax+1; x++) { gotoXY(x,ga->yMin-1); cout << "="; } //Seitliche Begrenzung for (int y=ga->yMin; y<=ga->yMax; y++) { gotoXY(ga->xMin-1,y); cout << "="; gotoXY(ga->xMax+1,y); cout << "="; } //Unterer Rand for (int x=ga->xMin - 1; x<=ga->xMax+1; x++) { gotoXY(x,ga->yMax+1); cout << "="; } } void PongView::showBallPosition(Ball* b) { gotoXY(10,24); cout << "X=" << b->getXPos() << "=Y=" << b->getYPos() << "==="; } void PongView::drawBall(Ball* b) { gotoXY(b->getXPos(), b->getYPos()); cout << b->getSymbol(); } void PongView::drawRacket(Racket* r) { for (int i=0; igetSize(); i++) { gotoXY(r->getXPos(), r->getYPos()+i); cout << r->getSymbol(); } } void PongView::eraseBall(Ball* b) { gotoXY(b->getXPos(), b->getYPos()); cout << (unsigned char)LEER; } void PongView::eraseRacket(short rOldXPos, short rOldYPos) { gotoXY(rOldXPos, rOldYPos); cout << (unsigned char)LEER; } void PongView::gotoXY(short x, short y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(hOut, coord); }