47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
//
|
|
// Created by shaohuatong on 08.12.19.
|
|
//
|
|
|
|
#include "Cursor.hpp"
|
|
|
|
Cursor::Cursor() {
|
|
|
|
}
|
|
|
|
Cursor::Cursor(vkvm::Coordinates mousePosition, int penWidth, int radius) {
|
|
this->mousePosition = mousePosition;
|
|
this->radius = radius;
|
|
|
|
int x_draw = 0;
|
|
int y_draw = 0;
|
|
|
|
uperLeft.x = mousePosition.x - radius;
|
|
uperLeft.y = mousePosition.y - radius;
|
|
bottomRight.x = mousePosition.x + radius;
|
|
bottomRight.y = mousePosition.y + radius;
|
|
|
|
vkvm::Coordinates temp;
|
|
cursor.resize(2 * radius);
|
|
for(y_draw = 0; y_draw < 2 * radius; y_draw++) {
|
|
cursor[y_draw].resize(2 * radius);
|
|
for(x_draw = 0; x_draw < 2 * radius; x_draw++) {
|
|
if((x_draw >= radius - penWidth && x_draw <= radius + penWidth)
|
|
|| (y_draw >= radius - penWidth && y_draw <= radius + penWidth)) {
|
|
cursor[y_draw][x_draw] = true;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
std::vector<std::vector<bool>> Cursor::getCursor() {
|
|
return cursor;
|
|
}
|
|
|
|
vkvm::Coordinates Cursor::getUperLeft() {
|
|
return uperLeft;
|
|
}
|
|
|
|
vkvm::Coordinates Cursor::getBottomRight() {
|
|
return bottomRight;
|
|
} |