You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
myTFT.setTextCursor(0,0); // Sets the cursor relative to the current window, however the current (default) window is equivalent to the whole display. (0,0) is the upper left corner and (myTFT.xExt-1, myTFT.yExt-1) is the lower right
// In every case the first arguments have to do with the geometry of the function and they are required
62
66
// After that come arguments having to do with the color - or more appropriately the color cycle
63
-
// - color_t data : this is a pointer to the color. The data that exists at this pointer will be assumed to be of the color type
67
+
// - color_t data : this is a pointer to the color. The data that exists at this pointer will be assumed to be of the color type
64
68
// that the display uses. This defaults to NULL in which case it will try to use a default color
65
69
// - hd_colors_t colorCycleLength : this number tells how long the color cycle is - in other words it is a promise that this many
66
70
// color objects exist consecutively after the pointer 'data.' If not specified this defaults to 1
67
-
// - hd_colors_t startColorOffset : this number allows the color cycle to start part-way through the color cycle. If this number is greater
71
+
// - hd_colors_t startColorOffset : this number allows the color cycle to start part-way through the color cycle. If this number is greater
68
72
// than the color cycle length it is wrapped back around with a modulo operation. This value defaults to 0
69
73
// Then finally there may be some additional options that are specific to each function. To change these you will need to explicitly state all other arguments
70
74
@@ -84,10 +88,10 @@ void setup() {
84
88
myTFT.line(2,12, 126,12, 4, (color_t)colorArray, CCLength, indi); // Notice that it is okay for startColorOffset to exceed colorCycleLength
85
89
delay(20);
86
90
}
87
-
myTFT.clearDisplay();
91
+
myTFT.clearDisplay();
88
92
89
93
90
-
// Color cycles work in two ways for rectangles:
94
+
// Color cycles work in two ways for rectangles:
91
95
// For a non-filled rectangle the cycle goes around the perimeter, and you can reverse the direction. It always starts from the upper-left corner
92
96
// For a filled rectangle the color cycle is used to create either a horizontal or vertical gradient, both of which can be reversed
93
97
constuint8_t rectCCLength = 60;
@@ -98,26 +102,26 @@ void setup() {
98
102
rectColorArray[indi].b = 0x00;
99
103
}
100
104
// Color cycles and options for rectangles:
101
-
myTFT.rectangle(3, 3, 124, 156, false, (color_t)rectColorArray, rectCCLength, 0); // Makes a non-filled rectablge around the whole screen
105
+
myTFT.rectangle(3, 3, 124, 156, false, (color_t)rectColorArray, rectCCLength, 0); // Makes a non-filled rectablge around the whole screen
102
106
myTFT.rectangle(0, 0, 127, 159, false, (color_t)rectColorArray, rectCCLength, 0, true); // Makes a non-filled rectablge around the whole screen with the cycle going in the other direction
103
107
myTFT.rectangle(6, 6, 60, 76, true, (color_t)rectColorArray, rectCCLength, 0); // Makes a filled rectangle that defaults to a non-reversed horizontal gradient (the color cycle is the gradient)
104
108
myTFT.rectangle(68, 6, 121, 76, true, (color_t)rectColorArray, rectCCLength, 0, true); // Makes a filled rectangle with a horizontal gradient that is reversed
105
109
myTFT.rectangle(6, 84, 60, 153, true, (color_t)rectColorArray, rectCCLength, 0, false, true); // Makes a filled rectangle with a non-reversed vertical gradient
106
110
myTFT.rectangle(68, 84, 121, 153, true, (color_t)rectColorArray, rectCCLength, 0, true, true); // Makes a filled rectangle with a vertical gradient that is reversed
107
111
delay(5000);
108
-
myTFT.clearDisplay();
112
+
myTFT.clearDisplay();
109
113
110
114
111
115
112
116
// Another HyperDisplay feature not discussed in Example2 is the "polygon" function(s).
113
-
// Polygon will automatically draw several connected lines when given the coordinates in a list.
117
+
// Polygon will automatically draw several connected lines when given the coordinates in a list.
114
118
// The main advantages are simplicity and the fact that a color cycle can run uninterrupted through the whole polygon.
115
-
hd_extent_t xCoords[] = {64, 127, 0, 127, 0};
119
+
hd_extent_t xCoords[] = {64, 127, 0, 127, 0};
116
120
hd_extent_t yCoords[] = {24, 120, 60, 60, 120};
117
121
if(sizeof(xCoords) != sizeof(yCoords)){
118
122
SERIAL_PORT.println("Coordinate array dimensions mismatch. Please make xCoords and yCoords have the same number of elements. Freezing");
119
123
while(1){};
120
-
}
124
+
}
121
125
myTFT.polygon(xCoords, yCoords, sizeof(xCoords)/sizeof(hd_extent_t), 1, (color_t)rectColorArray, rectCCLength, 0, false); // You can choose the width (3 here) and whether or not to reverse the gradient direction too
122
126
delay(5000);
123
127
myTFT.clearDisplay();
@@ -144,15 +148,15 @@ void setup() {
144
148
color_t data; // A pointer to pixel data that is specific to the window. Can be left as NULL
145
149
hd_pixels_t numPixels; // The number of pixel types that data points to
146
150
bool dynamic; // Indicator if the current buffer memory was dynamically allocated - so that it can be disposed of automatically
147
-
}wind_info_t; // Window infomation structure for placing objects on the display
151
+
}wind_info_t; // Window infomation structure for placing objects on the display
148
152
*/
149
153
// You'll notice that the window structure handles min/max extent values, current cursor values, reset cursor values, character info, and color cycle info
150
154
151
-
// In previous examples we never mentioned windows and that's OK because the default window covers the entire screen.
155
+
// In previous examples we never mentioned windows and that's OK because the default window covers the entire screen.
152
156
// Now we will do a few demos with windows...
153
157
154
158
wind_info_t wind1, wind2, wind3; // Create several window objects
155
-
ILI9163C_color_18_t color1, color2, color3;
159
+
ILI9163C_color_18_t color1, color2, color3;
156
160
157
161
// Initialize the windows to defualt settings (this is a pretty important step unless you are extra careful to manually initialize each and every paramter)
158
162
myTFT.setWindowDefaults(&wind1);
@@ -162,17 +166,17 @@ void setup() {
162
166
color1.r = 0xFF; // Set the colors to red, green, and blue respectively
163
167
color1.g = 0x00;
164
168
color1.b = 0x00;
165
-
169
+
166
170
color2.r = 0x00;
167
171
color2.g = 0xFF;
168
172
color2.b = 0x00;
169
-
170
-
color3.r = 0x00;
173
+
174
+
color3.r = 0x00;
171
175
color3.g = 0x00;
172
176
color3.b = 0xFF;
173
177
174
178
// Now we will set up the boundaries of the windows, the cursor locations, and their default colors
175
-
wind1.xMin = 0;
179
+
wind1.xMin = 0;
176
180
wind1.yMin = 0;
177
181
wind1.xMax = 62;
178
182
wind1.yMax = 78;
@@ -182,9 +186,9 @@ void setup() {
182
186
wind1.yReset = 1;
183
187
wind1.currentSequenceData = (color_t)&color1;
184
188
wind1.currentColorCycleLength = 1;
185
-
wind1.currentColorOffset = 0;
189
+
wind1.currentColorOffset = 0;
186
190
187
-
wind2.xMin = 65;
191
+
wind2.xMin = 65;
188
192
wind2.yMin = 0;
189
193
wind2.xMax = 127;
190
194
wind2.yMax = 78;
@@ -194,9 +198,9 @@ void setup() {
194
198
wind2.yReset = 15;
195
199
wind2.currentSequenceData = (color_t)&color2;
196
200
wind2.currentColorCycleLength = 1;
197
-
wind2.currentColorOffset = 0;
198
-
199
-
wind3.xMin = 0;
201
+
wind2.currentColorOffset = 0;
202
+
203
+
wind3.xMin = 0;
200
204
wind3.yMin = 81;
201
205
wind3.xMax = 127;
202
206
wind3.yMax = 159;
@@ -206,9 +210,9 @@ void setup() {
206
210
wind3.yReset = 1;
207
211
wind3.currentSequenceData = (color_t)&color3;
208
212
wind3.currentColorCycleLength = 1;
209
-
wind3.currentColorOffset = 0;
210
-
211
-
// All hyperdisplay drawing functions are applied to the current window, and the coordinates are with respect to the window.
213
+
wind3.currentColorOffset = 0;
214
+
215
+
// All hyperdisplay drawing functions are applied to the current window, and the coordinates are with respect to the window.
212
216
// To demonstrate this we will use the same exact drawing function to draw in each of the three windows, each with to unique effect
0 commit comments