-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleUI.cpp
89 lines (65 loc) · 1.95 KB
/
SimpleUI.cpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#include "SimpleUI.hpp"
// Type-specific implementations.
SimpleUI::SimpleUI(Adafruit_SSD1351 &GFXHandler) : GFXHandler (&GFXHandler) {}
TextAnchor * SimpleUI::newAnchor( int x, int y ){
//std::cout << "Inside SimpleUI::newAnchor\n\tX: " << x << "\n\tY: " << y << std::endl;
TextAnchor * _anchor = new TextAnchor( * GFXHandler );
_anchor->setCursor( x, y );
_anchor->setFontSize( _textSize );
if ( _defFgColor != NULL && _defBgColor != NULL ){
_anchor->setColor( _defFgColor, _defBgColor );
}
else if ( _defFgColor != NULL ){
_anchor->setColor( _defFgColor );
}
_anchor->setAutoPrint( true );
_anchor->print();
return _anchor;
}
/*
void SimpleUI::whatever(char str){
std::cout << "whatever - str was a string: " << str << std::endl;
}
*/
void SimpleUI::begin(){
GFXHandler->begin();
GFXHandler->setFont();
GFXHandler->fillScreen(_defBgColor);
GFXHandler->setTextColor(_defFgColor);
//GFXHandler.setRotation(1);
GFXHandler->setTextSize(1);
}
void SimpleUI::begin( uint16_t fgColor , uint16_t bgColor ){
_defFgColor = fgColor;
_defBgColor = bgColor;
_begin();
}
void SimpleUI::begin( uint16_t fgColor ){
_defFgColor = fgColor;
_begin();
}
void SimpleUI::_begin(){
GFXHandler->begin();
GFXHandler->setFont();
GFXHandler->fillScreen(_defBgColor);
GFXHandler->setTextColor(_defFgColor);
//GFXHandler.setRotation(1);
GFXHandler->setTextSize(1);
}
void SimpleUI::setColor( uint16_t fgColor ){
//std::cout << "Inside: SimpleUI::setColor(fg)" << std::endl;
//std::cout << "\tfgColor: " << fgColor << std::endl;
_defFgColor = fgColor;
}
void SimpleUI::setColor( uint16_t fgColor, uint16_t bgColor ){
//std::cout << "Inside: SimpleUI::setColor(fg, bg)" << std::endl;
//std::cout << "\tfgColor: " << fgColor << std::endl;
//std::cout << "\tbgColor: " << bgColor << std::endl;
_defFgColor = fgColor;
_defBgColor = bgColor;
}
/*
void SimpleUI::print( char val ){
}
*/