forked from jinschoi/SphereBot
-
Notifications
You must be signed in to change notification settings - Fork 3
/
TouchscreenGrid.h
35 lines (29 loc) · 1.16 KB
/
TouchscreenGrid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
TouchscreenGrid.h - Library for touchscreen button functions.
Created by Terence F. Golla, November 9, 2022
Released into the public domain.
*/
#ifndef TouchscreenGrid_h
#define TouchscreenGrid_h
#define DebugTouchscreenGrid false
#include <Arduino.h>
class TouchscreenGrid
{
public:
TouchscreenGrid(unsigned int x, unsigned int y, unsigned int columns, unsigned int rows,
unsigned int boxWidth, unsigned int boxHeight, unsigned int tftWidth, unsigned int tftHeight,
unsigned int rotation);
int Column(unsigned int x, unsigned int y);
int Row(unsigned int x, unsigned int y);
private:
unsigned int _x; // Grid's beginning x coordinate.
unsigned int _y; // Grid's beginning y coordinate.
unsigned int _columns; // The number of columns.
unsigned int _rows; // The number of rows.
unsigned int _boxWidth; // The width of a grid box.
unsigned int _boxHeight; // The height of a grid box.
unsigned int _tftWidth; // Screen width;
unsigned int _tftHeight; // Screen height.
unsigned int _rotation; // The button's rotation. Correlates with the touchscreen rotation.
};
#endif