@@ -73,10 +73,10 @@ class Field {
7373 * Field generator for the screen
7474 *
7575 * @param parent LVGL object to place upon
76- * @param x x-value from 0-240 of the leftmost side of the field, default is centered
76+ * @param ilength the side length of the field (in both directions)
7777 * @param iautoInit print colored tiles / taped lines immediately, and after each clean
7878 */
79- Field (lv_obj_t *parent, uint8_t x = 120 , bool iautoInit = true );
79+ Field (lv_obj_t *parent, double ilength = 240 , bool iautoInit = true );
8080 ~Field ();
8181
8282 /* *
@@ -85,13 +85,43 @@ class Field {
8585 void clean ();
8686
8787 /* *
88- * Set new x position on the screen
89- * note: Y cannot be changed, as the field takes up the entire screen vertically
88+ * Set new x position of the field on the screen
9089 *
91- * @param x new x-value from 0-240 of the leftmost side of the field
90+ * @param x new x-value of the distance from the leftmost side of the screen
91+ * (screen is 480 pixels wide)
9292 */
9393 void setX (uint8_t x);
9494
95+ /* *
96+ * Set new y position of the field on the screen
97+ *
98+ * @param y new y-value of the distance from the top side of the field
99+ * (screen is 240 pixels tall)
100+ */
101+ void setY (uint8_t y);
102+
103+ /* *
104+ * Set new position of the field on the screen
105+ *
106+ * note: the default(if this is never called) is 120,0 (centered)
107+ *
108+ * @param x new x-value of the distance from the leftmost side of the screen
109+ * (screen is 480 pixels wide)
110+ * @param y new y-value of the distance from the top side of the field
111+ * (screen is 240 pixels tall)
112+ */
113+ void setPos (uint8_t x, uint8_t y);
114+
115+ /* *
116+ * Set the new width and height of the field
117+ *
118+ * this will clean the screen and remove all existing objects
119+ *
120+ * note: you can make the field larger than the screen,
121+ * but you would then need a way to move the screen around in order to see it
122+ */
123+ void setSideLength (uint ilength);
124+
95125 /* *
96126 * draw a group of cubes
97127 *
@@ -137,7 +167,7 @@ class Field {
137167 *
138168 * called automatically by default
139169 */
140- void drawcoloredTiles ();
170+ void drawColoredTiles ();
141171
142172 /* *
143173 * draw the zone lines
@@ -162,7 +192,7 @@ class Field {
162192 *
163193 * @param red true for red, false for blue
164194 * @param pos y-value of the midpoint of the robot
165- * note: there are 40 pixels for each field tile
195+ * note: every 40 given to pos represents 1 field tile
166196 */
167197 void drawRobot (bool red, uint8_t pos);
168198
@@ -179,16 +209,19 @@ class Field {
179209 // Cubes should be drawn automatically by the above functions
180210 void drawCube (std::pair<uint8_t , uint8_t > pos, color color, uint8_t stackHeight, bool targeted);
181211
182- static void drawCube (lv_obj_t *parent, std::pair<uint8_t , uint8_t > pos, color color,
212+ static void drawCube (lv_obj_t *parent, std::pair<uint8_t , uint8_t > pos, double scalar, color color,
183213 uint8_t stackHeight, bool targeted);
184214
215+ int scale (int original);
216+
185217 void resetVectors ();
186218
187219 const uint numOfBits[16 ] = {0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 };
188220
189221 lv_obj_t *obj;
190222
191223 bool autoInit;
224+ double scalar;
192225
193226 bool wallDrawn;
194227 std::pair<color, color> allianceTowerContents;
0 commit comments