Elements used in the Balls and Things games for the RETRO.

Dependents:   RETRO_BallsAndPaddle RETRO_BallAndHoles

Committer:
maxint
Date:
Sat Feb 28 11:40:24 2015 +0000
Revision:
4:f421e34313d3
Child:
5:065f19e08dcb
Added support for walls

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maxint 4:f421e34313d3 1 #include "Wall.h"
maxint 4:f421e34313d3 2
maxint 4:f421e34313d3 3 Wall::Wall() : rWall(0,0,0,0)
maxint 4:f421e34313d3 4 { // constructor
maxint 4:f421e34313d3 5 }
maxint 4:f421e34313d3 6
maxint 4:f421e34313d3 7 Wall::Wall(LCD_ST7735* pDisp) : rWall(0,0,0,0)
maxint 4:f421e34313d3 8 { // constructor
maxint 4:f421e34313d3 9 this->pDisp=pDisp;
maxint 4:f421e34313d3 10 uColor=Color565::Blue;
maxint 4:f421e34313d3 11 this->fActive=false;
maxint 4:f421e34313d3 12 }
maxint 4:f421e34313d3 13
maxint 4:f421e34313d3 14 void Wall::setRect(Rectangle rNew)
maxint 4:f421e34313d3 15 {
maxint 4:f421e34313d3 16 rWall=rNew;
maxint 4:f421e34313d3 17 }
maxint 4:f421e34313d3 18
maxint 4:f421e34313d3 19
maxint 4:f421e34313d3 20 Rectangle Wall::getRect()
maxint 4:f421e34313d3 21 {
maxint 4:f421e34313d3 22 return(rWall);
maxint 4:f421e34313d3 23 }
maxint 4:f421e34313d3 24
maxint 4:f421e34313d3 25 void Wall::draw()
maxint 4:f421e34313d3 26 {
maxint 4:f421e34313d3 27 int x1=rWall.getX1();
maxint 4:f421e34313d3 28 int y1=rWall.getY1();
maxint 4:f421e34313d3 29 int x2=rWall.getX2();
maxint 4:f421e34313d3 30 int y2=rWall.getY2();
maxint 4:f421e34313d3 31 if(x1!=x2 && y1!=y2)
maxint 4:f421e34313d3 32 pDisp->fillRect(x1,y1,x2,y2, uColor);
maxint 4:f421e34313d3 33 else
maxint 4:f421e34313d3 34 pDisp->drawLine(x1,y1,x2,y2, uColor);
maxint 4:f421e34313d3 35
maxint 4:f421e34313d3 36 /*
maxint 4:f421e34313d3 37 char szBuffer[256];
maxint 4:f421e34313d3 38 sprintf(szBuffer, "w:%d,%d - %d,%d ", rWall.getX1(), rWall.getY1(), rWall.getX2(), rWall.getY2());
maxint 4:f421e34313d3 39 pDisp->drawString(font_oem, 0, 0, szBuffer);
maxint 4:f421e34313d3 40 */
maxint 4:f421e34313d3 41
maxint 4:f421e34313d3 42 }
maxint 4:f421e34313d3 43