2019-11-22 19:45:52 +01:00
|
|
|
//
|
|
|
|
// Created by shaohuatong on 21.11.19.
|
|
|
|
//
|
2019-11-27 16:03:56 +01:00
|
|
|
#ifndef SIMPLE_DRAW_DRAWRENDER_HPP
|
|
|
|
#define SIMPLE_DRAW_DRAWRENDER_HPP
|
2019-11-22 19:45:52 +01:00
|
|
|
|
2020-01-08 20:56:48 +01:00
|
|
|
#include "Cursor.hpp"
|
2019-12-09 14:32:30 +01:00
|
|
|
#include "Rectangle.hpp"
|
|
|
|
#include "Circle.hpp"
|
|
|
|
#include "Shapes.hpp"
|
2020-01-08 20:56:48 +01:00
|
|
|
#include "utils.hpp"
|
|
|
|
#include "vkvm.hpp"
|
|
|
|
#include <cmath>
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
2019-11-22 19:45:52 +01:00
|
|
|
|
|
|
|
#define CIRCLE 0
|
2019-12-09 14:32:30 +01:00
|
|
|
#define RECTANGLE 1
|
|
|
|
#define BRUSH 2
|
|
|
|
#define CURSOR 3
|
|
|
|
#define SHAPE 4
|
2019-11-22 19:45:52 +01:00
|
|
|
|
|
|
|
class DrawRender {
|
|
|
|
public:
|
|
|
|
DrawRender(int windowWidth, int windowHeight, vkvm::Color defaultBackgroundColor, vkvm::Color penColor, int penWidth);
|
2019-11-29 17:54:09 +01:00
|
|
|
void graphicsUpdate(int type);
|
|
|
|
|
|
|
|
void setMouseLeftDownPostion(vkvm::Coordinates newMousePosition);
|
|
|
|
vkvm::Coordinates getMouseLeftDownPosition();
|
|
|
|
void setMousePostion(vkvm::Coordinates newMousePosition);
|
|
|
|
vkvm::Coordinates getMousePostion();
|
2019-12-09 14:32:30 +01:00
|
|
|
|
2019-11-29 17:54:09 +01:00
|
|
|
void setKeyCode(vkvm::KeyCode newKeyCode);
|
2019-12-09 14:32:30 +01:00
|
|
|
vkvm::KeyCode getKeyCode();
|
|
|
|
|
2019-11-29 17:54:09 +01:00
|
|
|
void setTurnOnBrush(bool turnOnBrush);
|
|
|
|
bool getTurnOnBrush();
|
2019-12-09 14:32:30 +01:00
|
|
|
|
2019-11-29 17:54:09 +01:00
|
|
|
void setMouseDown(bool isMouseDown);
|
|
|
|
bool getMouseDown();
|
2019-12-09 14:32:30 +01:00
|
|
|
|
2019-11-29 17:54:09 +01:00
|
|
|
void setPainting(bool isOneFinish);
|
|
|
|
bool getPainting();
|
2019-12-09 14:32:30 +01:00
|
|
|
|
|
|
|
void setFinish(bool isFinish);
|
|
|
|
bool getFinish();
|
2019-11-22 19:45:52 +01:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
private:
|
2019-12-09 14:32:30 +01:00
|
|
|
Shapes shapes;
|
|
|
|
Circle oldCircle = Circle();
|
|
|
|
Rectangle oldRectangle = Rectangle();
|
|
|
|
Cursor oldCursor = Cursor();
|
2019-11-29 17:54:09 +01:00
|
|
|
vkvm::Coordinates mouseLeftDownPosition;
|
2019-11-22 19:45:52 +01:00
|
|
|
vkvm::Coordinates mousePosition;
|
|
|
|
vkvm::Color backgroundColor;
|
|
|
|
vkvm::Color penColor;
|
2019-11-29 17:54:09 +01:00
|
|
|
vkvm::KeyCode keyCode;
|
2019-12-09 14:32:30 +01:00
|
|
|
|
2019-11-22 19:45:52 +01:00
|
|
|
int penWidth;
|
|
|
|
int windowWidth;
|
|
|
|
int windowHeight;
|
2019-12-09 14:32:30 +01:00
|
|
|
int cursorStart;
|
2019-11-29 17:54:09 +01:00
|
|
|
bool painting = true;
|
2019-12-09 14:32:30 +01:00
|
|
|
bool finish = false;
|
2019-11-29 17:54:09 +01:00
|
|
|
bool mouseDown = false;
|
|
|
|
bool turnOnBrush = false;
|
2019-11-27 16:03:56 +01:00
|
|
|
|
2019-12-09 14:32:30 +01:00
|
|
|
void cursorCreator();
|
|
|
|
void translateToSharedMemory(std::vector<std::vector<bool>> graphic, int startX, int startY, bool isCursor);
|
|
|
|
void clearToSharedMemory(std::vector<std::vector<bool>> graphic, int startX, int startY);
|
2019-11-22 19:45:52 +01:00
|
|
|
};
|
|
|
|
|
2019-11-27 16:03:56 +01:00
|
|
|
#endif //SIMPLE_DRAW_DRAWRENDER_HPP
|
2019-11-29 17:54:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|