Accompanying library for Objects. Library contains five shapes that are selected at random by the Objects library and drawn on to the objects on a Nokia N5110 LCD display.
Dependents: Game_Controller_Project
Fruit.cpp
- Committer:
- Nathanj94
- Date:
- 2017-04-04
- Revision:
- 1:d9e03c7482ad
- Parent:
- 0:1976fca8d66a
- Child:
- 2:15120c2cf507
File content as of revision 1:d9e03c7482ad:
#include "Fruit.h" Fruit::Fruit() { } Fruit::~Fruit() { } void Fruit::draw_strawberry(int x, int y, N5110 &lcd) { lcd.setPixel(x,y+2); lcd.setPixel(x+5,y+2); lcd.drawLine(x+1,y+1,x+4,y+1,1); lcd.drawLine(x+2,y+2,x+3,y+2,1); lcd.drawLine(x,y+3,x+2,y+5,1); lcd.drawLine(x+3,y+5,x+5,y+3,1); } void Fruit::undraw_strawberry(int x, int y, N5110 &lcd) { lcd.setPixel(x,y+2); lcd.setPixel(x+5,y+2); lcd.drawLine(x+1,y+1,x+4,y+1,0); lcd.drawLine(x+2,y+2,x+3,y+2,0); lcd.drawLine(x,y+3,x+2,y+5,0); lcd.drawLine(x+3,y+5,x+5,y+3,0); } void Fruit::draw_pineapple(int x, int y, N5110 &lcd) { lcd.drawLine(x,y+4,x+1,y+5,1); lcd.drawLine(x,y+3,x+2,y+1,1); lcd.drawLine(x+2,y+5,x+4,y+3,1); lcd.drawLine(x+3,y+2,x+4,y+1,1); lcd.drawLine(x+4,y,x+5,y+1,1); } void Fruit::undraw_pineapple(int x, int y, N5110 &lcd) { lcd.drawLine(x,y+4,x+1,y+5,0); lcd.drawLine(x,y+3,x+2,y+1,0); lcd.drawLine(x+2,y+5,x+4,y+3,0); lcd.drawLine(x+3,y+2,x+4,y+1,0); lcd.drawLine(x+4,y,x+5,y+1,0); } void Fruit::draw_pear(int x, int y, N5110 &lcd) { lcd.drawLine(x,y+3,x+3,y,1); lcd.drawLine(x,y+4,x+1,y+5,1); lcd.drawLine(x+2,y+5,x+4,y+5,1); lcd.drawLine(x+3,y+2,x+4,y+3,1); lcd.drawLine(x+5,y+3,x+5,y+4,1); } void Fruit::undraw_pear(int x, int y, N5110 &lcd) { lcd.drawLine(x,y+3,x+3,y,0); lcd.drawLine(x,y+4,x+1,y+5,0); lcd.drawLine(x+2,y+5,x+4,y+5,0); lcd.drawLine(x+3,y+2,x+4,y+3,0); lcd.drawLine(x+5,y+3,x+5,y+4,0); } void Fruit::draw_melon(int x, int y, N5110 &lcd) { lcd.drawLine(x+1,y+1,x+4,y+1,1); lcd.drawLine(x,y+2,x,y+4,1); lcd.drawLine(x+1,y+5,x+4,y+5,1); lcd.drawLine(x+5,y+2,x+5,y+4,1); } void Fruit::undraw_melon(int x, int y, N5110 &lcd) { lcd.drawLine(x+1,y+1,x+4,y+1,0); lcd.drawLine(x,y+2,x,y+4,0); lcd.drawLine(x+1,y+5,x+4,y+5,0); lcd.drawLine(x+5,y+2,x+5,y+4,0); } void Fruit::draw_antifruit(int x, int y, N5110 &lcd) { lcd.drawLine(x,y,x+5,y+5,1); lcd.drawLine(x,y+5,x+5,y,1); } void Fruit::undraw_antifruit(int x, int y, N5110 &lcd) { lcd.drawLine(x,y,x+5,y+5,0); lcd.drawLine(x,y+5,x+5,y,0); }