You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
879 B

  1. #include <iostream>
  2. #include <string>
  3. #include "Point.h"
  4. /*snake will be an array of points*/
  5. using namespace std;
  6. Point::Point(int y, int x, graphics_input img)
  7. : x {x}, y{y}, img{img}
  8. {}
  9. //delegating the previous constructor
  10. Point::Point()
  11. :Point(10, 10, '*')
  12. {}
  13. Point::~Point(){/*No need to do something */}
  14. void Point::setPoint(int y, int x){
  15. this->x = x;
  16. this->y = y;
  17. }
  18. int Point::getX(void){
  19. return this->x;
  20. }
  21. int Point::getY(void){
  22. return this->y;
  23. }
  24. void Point::moveUp(void){
  25. y--;
  26. }
  27. void Point::moveDown(void){
  28. y++;
  29. }
  30. void Point::moveLeft(void){
  31. x--;
  32. }
  33. void Point::moveRight(void){
  34. x++;
  35. }
  36. graphics_input Point::getImg(){
  37. return this->img;
  38. }
  39. void Point::setImg(graphics_input image){
  40. this->img = image;
  41. }
  42. void Point::printImg(){
  43. printChar(this->y, this->x, this->img);
  44. }
  45. void Point::erase(void){
  46. this->img = ' ';
  47. }