-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphics.cpp
More file actions
56 lines (48 loc) · 1.18 KB
/
Copy pathGraphics.cpp
File metadata and controls
56 lines (48 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "Graphics.h"
Graphics::Graphics(byte screenWidth, byte screenHeight){
//U8X8_SH1106_128X64_NONAME_HW_I2C u8x8(/* reset=*/U8X8_PIN_NONE);
_screenWidth = screenWidth;
_screenHeight = screenHeight;
U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
_u8g2 = u8g2;
_u8g2.begin();
_u8g2.setFont(u8g2_font_ncenB10_tr);
}
void Graphics::drawPixel(byte x, byte y){
if(x >= 0 && x <= _screenWidth && y >= 0 && y <= _screenHeight){
_u8g2.drawPixel(x, y);
}
}
void Graphics::drawLine(byte x1, byte y1, byte x2, byte y2){
_u8g2.drawLine(x1,y1,x2,y2);
}
void Graphics::drawRect(byte x, byte y, byte width, byte height){
}
/*
void Graphics::clear(){
_u8g2.setFont(u8g2_font_ncenB14_tr);
}
*/
void Graphics::setFont(const uint8_t *font){
_u8g2.setFont(font);
}
/*
void Graphics::terminalPrint(String texto){
//_u8x8log.println(texto);
}
*/
void Graphics::drawStr(byte x, byte y ,const char *text) {
_u8g2.drawStr(x,y,text);
}
void Graphics::firstPage() {
_u8g2.firstPage();
}
bool Graphics::nextPage(){
return _u8g2.nextPage();
}
U8G2 Graphics::getU8g2(){
return _u8g2;
}
void Graphics::setCursor(byte x, byte y) {
_u8g2.setCursor(x,y);
}