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

Dependents:   RETRO_BallsAndPaddle RETRO_BallAndHoles

Committer:
maxint
Date:
Mon Mar 02 09:58:53 2015 +0000
Revision:
8:19dd2a538cbe
Parent:
5:065f19e08dcb
more clean-up

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 5:065f19e08dcb 14 Wall::Wall(LCD_ST7735* pDisp, uint16_t uClr) : rWall(0,0,0,0)
maxint 5:065f19e08dcb 15 { // constructor
maxint 5:065f19e08dcb 16 this->pDisp=pDisp;
maxint 5:065f19e08dcb 17 uColor=uClr;
maxint 5:065f19e08dcb 18 this->fActive=false;
maxint 5:065f19e08dcb 19 }
maxint 5:065f19e08dcb 20
maxint 5:065f19e08dcb 21
maxint 4:f421e34313d3 22 void Wall::setRect(Rectangle rNew)
maxint 4:f421e34313d3 23 {
maxint 4:f421e34313d3 24 rWall=rNew;
maxint 4:f421e34313d3 25 }
maxint 4:f421e34313d3 26
maxint 4:f421e34313d3 27
maxint 4:f421e34313d3 28 Rectangle Wall::getRect()
maxint 4:f421e34313d3 29 {
maxint 4:f421e34313d3 30 return(rWall);
maxint 4:f421e34313d3 31 }
maxint 4:f421e34313d3 32
maxint 4:f421e34313d3 33 void Wall::draw()
maxint 4:f421e34313d3 34 {
maxint 4:f421e34313d3 35 int x1=rWall.getX1();
maxint 4:f421e34313d3 36 int y1=rWall.getY1();
maxint 4:f421e34313d3 37 int x2=rWall.getX2();
maxint 4:f421e34313d3 38 int y2=rWall.getY2();
maxint 4:f421e34313d3 39 if(x1!=x2 && y1!=y2)
maxint 4:f421e34313d3 40 pDisp->fillRect(x1,y1,x2,y2, uColor);
maxint 4:f421e34313d3 41 else
maxint 4:f421e34313d3 42 pDisp->drawLine(x1,y1,x2,y2, uColor);
maxint 4:f421e34313d3 43
maxint 4:f421e34313d3 44 /*
maxint 4:f421e34313d3 45 char szBuffer[256];
maxint 4:f421e34313d3 46 sprintf(szBuffer, "w:%d,%d - %d,%d ", rWall.getX1(), rWall.getY1(), rWall.getX2(), rWall.getY2());
maxint 4:f421e34313d3 47 pDisp->drawString(font_oem, 0, 0, szBuffer);
maxint 4:f421e34313d3 48 */
maxint 4:f421e34313d3 49
maxint 4:f421e34313d3 50 }
maxint 4:f421e34313d3 51