Advertisement
Guest User

Canvass.h

a guest
Dec 17th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #pragma once
  2. #include <vector>
  3. #include <iostream>
  4. #include "Pen.h"
  5. #include "Instruction.h"
  6.  
  7. enum ACTION { UP, DOWN, LEFT, RIGHT, PEN_TOGGLE, STOP, PEN_POSITION, NONE };
  8. const unsigned int INIT_DIM = 4, MAX_HORI = 50, MAX_VERTI = 18;
  9.  
  10. class Canvas
  11. {
  12. private:
  13.     Pen _pen;
  14.     std::vector<std::vector<bool>> _canvas;
  15.     std::vector<Instruction*> _instructions;
  16.     Instruction* _currInstruction = NULL;
  17.     bool growHoriztontal();
  18.     bool growVertical();
  19.     bool processDrawAction(PEN_AXIS, int);
  20.     void stop();
  21.     void mark();
  22.  
  23. public:
  24.     Canvas();
  25.     void draw(std::ostream&, bool = true);
  26.     unsigned int getWidth();
  27.     unsigned int getHeight();
  28.     unsigned int getPenX();
  29.     unsigned int getPenY();
  30.     bool movePen(PEN_AXIS, bool);
  31.     void togglePen();
  32.     void toggleShowPen();
  33.     bool isPenDown();
  34.     bool doCommand(ACTION);
  35.     std::vector<Instruction*> getInstructions();
  36. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement