// // Created by shaohuatong on 21.11.19. // #ifndef SIMPLE_DRAW_DRAWRENDER_HPP #define SIMPLE_DRAW_DRAWRENDER_HPP #include "Cursor.hpp" #include "Rectangle.hpp" #include "Circle.hpp" #include "Shapes.hpp" #include "utils.hpp" #include "vkvm.hpp" #include #include #include #include #define CIRCLE 0 #define RECTANGLE 1 #define BRUSH 2 #define CURSOR 3 #define SHAPE 4 class DrawRender { public: DrawRender(int windowWidth, int windowHeight, vkvm::Color defaultBackgroundColor, vkvm::Color penColor, int penWidth); void graphicsUpdate(int type); void setMouseLeftDownPostion(vkvm::Coordinates newMousePosition); vkvm::Coordinates getMouseLeftDownPosition(); void setMousePostion(vkvm::Coordinates newMousePosition); vkvm::Coordinates getMousePostion(); void setKeyCode(vkvm::KeyCode newKeyCode); vkvm::KeyCode getKeyCode(); void setTurnOnBrush(bool turnOnBrush); bool getTurnOnBrush(); void setMouseDown(bool isMouseDown); bool getMouseDown(); void setPainting(bool isOneFinish); bool getPainting(); void setFinish(bool isFinish); bool getFinish(); void clear(); private: Shapes shapes; Circle oldCircle = Circle(); Rectangle oldRectangle = Rectangle(); Cursor oldCursor = Cursor(); vkvm::Coordinates mouseLeftDownPosition; vkvm::Coordinates mousePosition; vkvm::Color backgroundColor; vkvm::Color penColor; vkvm::KeyCode keyCode; int penWidth; int windowWidth; int windowHeight; int cursorStart; bool painting = true; bool finish = false; bool mouseDown = false; bool turnOnBrush = false; void cursorCreator(); void translateToSharedMemory(std::vector> graphic, int startX, int startY, bool isCursor); void clearToSharedMemory(std::vector> graphic, int startX, int startY); }; #endif //SIMPLE_DRAW_DRAWRENDER_HPP