diff --git a/.gitignore b/.gitignore index 99acf8a..b520884 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ bin/ compile_commands.json temp.log + +*.zip diff --git a/Makefile b/Makefile index 0f2775e..808f553 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ USE_PACKAGE:=0 IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=screenlib -VERSION:=1.0.0 +VERSION:=1.0.1 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/opcontrol $(SRCDIR)/initialize $(SRCDIR)/autonomous,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) @@ -31,7 +31,7 @@ EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/opcontrol $(SRCDIR)/initialize $ # files that get distributed to every user (beyond your source archive) - add # whatever files you want here. This line is configured to add all header files # that are in the the include directory get exported -TEMPLATE_FILES=$(INCDIR)/**/*.h $(INCDIR)/**/*.hpp +TEMPLATE_FILES=$(INCDIR)/screen/**/*.h $(INCDIR)/screen/**/*.hpp .DEFAULT_GOAL=quick diff --git a/README.md b/README.md index 5188f29..7488186 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Version ======= The first digit refers to the vex game: Tower Takeover will be version 1.X.X, while next year's game will be 2.X.X The second digit refers to any new features that may be added. -The third digit refers to any bug fixes. +The third digit refers to any bug fixes or minor improvements to existing features. License ======= @@ -55,13 +55,12 @@ Alternatively, macros can be used for more verbose code; here is the equivalent `field.draw(screen::cubeGroup::right4, CUBE_HIGHEST + CUBE_2LOWEST);` `CUBE_HIGHEST` represents the highest cube in the stack, followed by `CUBE_2HIGHEST` (the 2nd highest), followed by `CUBE_2LOWEST` (the 2nd lowest), and finally `CUBE_LOWEST` -As the 4 cube stacks on the left and right are in the same order but slightly different positions, the corresponding cubes are represented the same (purple to purple, orange to orange, green to green) `CUBE_FAR` and `CUBE_NEAR` are for the cube sectors farLeft and farRight `CUBE_TOP_NEAR`, `CUBE_FAR_LEFT`, `CUBE_NEAR_LEFT`, `CUBE_FAR_RIGHT`, and `CUBE_NEAR_RIGHT` are used for the five cube stack on the near side -and finally, all macros starting with `TOWER_CUBE_` refer to the cubes around a tower +and finally, all macros starting with `TOWER_CUBE_` refer to the cubes around a tower Scored Cubes ------------ @@ -70,6 +69,12 @@ Scored cubes are drawn along with where they are, either in a tower or a scoring a third parameter is used to display "stack height", a number printed on top to describe how many cubes are in the stack. Note: use `screen::color::none` to abstain from printing a scored cube in that position +Other +----- +The field can be repositioned with `setX`, `setY`, or `setPos`. +and can be resized using `setSideLength` +when changing size, if you are unsatisfied with the numbers printed on the cubes, you can modify the `NumberConfig`, which is given as the 4th parameter in the constructor. More information is available in [field.hpp](./include/field.hpp) + Example ------- This directory (specifically [opcontrol.cpp](./src/opcontrol.cpp)) is a usage example (it produces the image at the top of this page) @@ -78,4 +83,4 @@ Acknowledgements ================ smallfont.c is converted version of the digits 0-9 from [Synchronizer NBP Font](https://www.fontspace.com/total-fontgeek-dtf-ltd/synchronizer-nbp) by total FontGeek DTF, Ltd. all credit regarding the font to them. -Thanks to Hotel from the PROS team, Salmon from Okapilib, and Theo from 7842F, for giving some advice on improving the code here +Thanks to Potatehoes from 914M for beta testing, as well as Hotel from the PROS team, Salmon from Okapilib, and Theo from 7842F, for giving some advice on improving the code here diff --git a/include/screen/field.hpp b/include/screen/field.hpp index 5d9f774..26f48cd 100644 --- a/include/screen/field.hpp +++ b/include/screen/field.hpp @@ -46,8 +46,7 @@ * * CUBE_HIGHEST represents the highest cube in the stack, followed by CUBE_2HIGHEST (the 2nd * highest), followed by CUBE_2LOWEST (the 2nd lowest), and finally CUBE_LOWEST As the 4 cube stacks - * on the left and right are in the same order but slightly different positions, the corresponding - * cubes are represented the same (purple to purple, orange to orange, green to green) + * on the left and right are in the same order but slightly different positions * * CUBE_FAR and CUBE_NEAR are for the cube Groups farLeft and farRight * @@ -69,14 +68,30 @@ namespace screen { class Field { public: + /** + * A struct that controls the drawing of numbers on cubes (which represent height) + * + * deltaX how far to move the number horizontally from default + * deltaY how far to move the number vertically from default + * fontStyle which style to use; can be used to change the font, color, etc. of the number + */ + struct NumberConfig { + int deltaX, deltaY; + lv_style_t *fontStyle; + }; + /** * Field generator for the screen * * @param parent LVGL object to place upon - * @param x x-value from 0-240 of the leftmost side of the field, default is centered + * @param ilength the side length of the field (in both directions) * @param iautoInit print colored tiles / taped lines immediately, and after each clean + * @param iconfig a configuration for the numbers on the cubes, + * use deltaX and deltaY to adjust the position of the number, and set a different + * style using fontStyle */ - Field(lv_obj_t *parent, uint8_t x = 120, bool iautoInit = true); + Field(lv_obj_t *parent, double ilength = 240, bool iautoInit = true, + NumberConfig iconfig = {1, -1, &littleWhiteText}); ~Field(); /** @@ -85,12 +100,42 @@ class Field { void clean(); /** - * Set new x position on the screen - * note: Y cannot be changed, as the field takes up the entire screen vertically + * Set new x position of the field on the screen + * + * @param x new x-value of the distance from the leftmost side of the screen + * (screen is 480 pixels wide) + */ + void setX(int x); + + /** + * Set new y position of the field on the screen + * + * @param y new y-value of the distance from the top side of the field + * (screen is 240 pixels tall) + */ + void setY(int y); + + /** + * Set new position of the field on the screen + * + * note: the default(if this is never called) is 120,0 (centered) + * + * @param x new x-value of the distance from the leftmost side of the screen + * (screen is 480 pixels wide) + * @param y new y-value of the distance from the top side of the field + * (screen is 240 pixels tall) + */ + void setPos(int x, int y); + + /** + * Set the new width and height of the field + * + * this will clean the screen and remove all existing objects * - * @param x new x-value from 0-240 of the leftmost side of the field + * note: you can make the field larger than the screen, + * but you would then need a way to move the screen around in order to see it */ - void setX(uint8_t x); + void setSideLength(uint ilength); /** * draw a group of cubes @@ -130,14 +175,14 @@ class Field { * for both stacks. See the README for more information */ void draw(scoringZone pos, std::pair contents, - std::pair stackHeight); + std::pair stackHeight); /** * draw the four colored tiles * * called automatically by default */ - void drawcoloredTiles(); + void drawColoredTiles(); /** * draw the zone lines @@ -162,7 +207,7 @@ class Field { * * @param red true for red, false for blue * @param pos y-value of the midpoint of the robot - * note: there are 40 pixels for each field tile + * note: every 40 given to pos represents 1 field tile */ void drawRobot(bool red, uint8_t pos); @@ -179,8 +224,10 @@ class Field { // Cubes should be drawn automatically by the above functions void drawCube(std::pair pos, color color, uint8_t stackHeight, bool targeted); - static void drawCube(lv_obj_t *parent, std::pair pos, color color, - uint8_t stackHeight, bool targeted); + static void drawCube(lv_obj_t *parent, std::pair pos, double scalar, + color color, uint8_t stackHeight, NumberConfig config, bool targeted); + + int scale(int original); void resetVectors(); @@ -189,6 +236,7 @@ class Field { lv_obj_t *obj; bool autoInit; + double scalar; bool wallDrawn; std::pair allianceTowerContents; @@ -196,6 +244,8 @@ class Field { std::vector cubesToDraw; std::vector towersToDraw; std::vector zonesToDraw; + + NumberConfig config; }; } // namespace screen diff --git a/src/opcontrol.cpp b/src/opcontrol.cpp index b8835a6..e47210e 100644 --- a/src/opcontrol.cpp +++ b/src/opcontrol.cpp @@ -13,8 +13,7 @@ void opcontrol() // two stacks use an array of colors // draw a purple stack with height 1 and an orange stack with height 3 in the far red zone - field.draw(screen::scoringZone::farRed, {screen::color::purple, screen::color::orange}, - {1, 3}); + field.draw(screen::scoringZone::farRed, {screen::color::purple, screen::color::orange}, {1, 3}); // one stack does not need to use an array // draw a green stack with height 4 in the near red zone @@ -37,7 +36,8 @@ void opcontrol() // (this is the 5 cube stack on the audience side) field.draw(screen::cubeGroup::near, CUBE_NEAR_LEFT + CUBE_NEAR_RIGHT + CUBE_FAR_RIGHT); - // draw the highest(rightmost), and the 2nd lowest(leftmost) cube of the 4th(closest) left cube group + // draw the highest(rightmost), and the 2nd lowest(leftmost) cube of the 4th(closest) left cube + // group field.draw(screen::cubeGroup::left4, CUBE_HIGHEST + CUBE_2LOWEST); // draw the left tower with no cubes in or around diff --git a/src/screen/field.cpp b/src/screen/field.cpp index f7b33ed..c49633a 100644 --- a/src/screen/field.cpp +++ b/src/screen/field.cpp @@ -2,18 +2,23 @@ namespace screen { -Field::Field(lv_obj_t *parent, const uint8_t x, const bool iautoInit) - : autoInit(iautoInit), wallDrawn(false), allianceTowerContents(color::none, color::none) +Field::Field(lv_obj_t *parent, const double ilength, const bool iautoInit, + const NumberConfig iconfig) + : scalar(ilength / 240), + autoInit(iautoInit), + config(iconfig), + wallDrawn(false), + allianceTowerContents(color::none, color::none) { obj = lv_obj_create(parent, NULL); lv_obj_set_style(obj, &fieldStyle); - lv_obj_set_size(obj, 240, 240); - lv_obj_set_pos(obj, x, 0); + lv_obj_set_size(obj, ilength, ilength); + lv_obj_set_pos(obj, 120, 0); resetVectors(); if (autoInit) { - drawcoloredTiles(); + drawColoredTiles(); drawLines(); } } @@ -32,16 +37,33 @@ void Field::clean() allianceTowerContents = {color::none, color::none}; if (autoInit) { - drawcoloredTiles(); + drawColoredTiles(); drawLines(); } } -void Field::setX(uint8_t x) +void Field::setX(int x) { lv_obj_set_x(obj, x); } +void Field::setY(int y) +{ + lv_obj_set_y(obj, y); +} + +void Field::setPos(int x, int y) +{ + lv_obj_set_pos(obj, x, y); +} + +void Field::setSideLength(uint ilength) +{ + scalar = ilength / 240.0; + lv_obj_set_size(obj, ilength, ilength); + clean(); +} + void Field::draw(const cubeGroup pos, const uint8_t presence) { bool targeted = presence != UINT8_MAX; @@ -203,14 +225,14 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen } lv_obj_t *tower = lv_obj_create(obj, NULL); - lv_obj_set_size(tower, 16, 16); + lv_obj_set_size(tower, scale(16), scale(16)); switch (pos) { case tower::left: lv_obj_set_style(tower, &neutralTower); - lv_obj_set_pos(tower, 32, 112); + lv_obj_set_pos(tower, scale(32), scale(112)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); if (cubePresence & 0b11111000) { drawCube({35, 101}, color::purple, 1, targeted); @@ -224,9 +246,9 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen break; case tower::right: lv_obj_set_style(tower, &neutralTower); - lv_obj_set_pos(tower, 192, 112); + lv_obj_set_pos(tower, scale(192), scale(112)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); if (cubePresence & 0b11111000) { drawCube({195, 101}, color::purple, 1, targeted); @@ -240,9 +262,9 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen break; case tower::center: lv_obj_set_style(tower, &neutralTower); - lv_obj_set_pos(tower, 112, 112); + lv_obj_set_pos(tower, scale(112), scale(112)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); if (cubePresence & 0b11111000) { drawCube({115, 101}, color::purple, 1, targeted); } @@ -258,9 +280,9 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen break; case tower::far: lv_obj_set_style(tower, &neutralTower); - lv_obj_set_pos(tower, 112, 52); + lv_obj_set_pos(tower, scale(112), scale(52)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); if (cubePresence & 0b11111000) { drawCube({115, 41}, color::purple, 1, targeted); } @@ -276,9 +298,9 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen break; case tower::near: lv_obj_set_style(tower, &neutralTower); - lv_obj_set_pos(tower, 112, 172); + lv_obj_set_pos(tower, scale(112), scale(172)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); if (cubePresence & 0b11111000) { drawCube({115, 161}, color::purple, 1, targeted); } @@ -294,15 +316,15 @@ void Field::draw(const tower pos, const color contents, const uint8_t cubePresen break; case tower::red: lv_obj_set_style(tower, &redTower); - lv_obj_set_pos(tower, 54, 228); + lv_obj_set_pos(tower, scale(54), scale(228)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); break; case tower::blue: lv_obj_set_style(tower, &blueTower); - lv_obj_set_pos(tower, 174, 228); + lv_obj_set_pos(tower, scale(174), scale(228)); - drawCube(tower, {3, 3}, contents, 1, true); + drawCube(tower, {3, 3}, scalar, contents, 1, config, true); break; } } @@ -313,7 +335,7 @@ void Field::draw(const scoringZone pos, const color contents, const uint8_t stac } void Field::draw(const scoringZone pos, const std::pair contents, - const std::pair stackHeight) + const std::pair stackHeight) { bool targeted = contents.first != color::none; @@ -329,40 +351,40 @@ void Field::draw(const scoringZone pos, const std::pair contents, switch (pos) { case scoringZone::farRed: lv_obj_set_style(zone, targeted ? &redZoneHighlighted : &redZone); - lv_obj_set_size(zone, 29, 20); + lv_obj_set_size(zone, scale(29), scale(20)); lv_obj_set_pos(zone, 0, 0); if (targeted) { - drawCube(zone, {4, 5}, contents.first, stackHeight.first, false); - drawCube(zone, {15, 5}, contents.second, stackHeight.second, false); + drawCube(zone, {4, 5}, scalar, contents.first, stackHeight.first, config, false); + drawCube(zone, {15, 5}, scalar, contents.second, stackHeight.second, config, false); } break; case scoringZone::farBlue: lv_obj_set_style(zone, targeted ? &blueZoneHighlighted : &blueZone); - lv_obj_set_size(zone, 29, 20); - lv_obj_set_pos(zone, 211, 0); + lv_obj_set_size(zone, scale(29), scale(20)); + lv_obj_set_pos(zone, scale(211), 0); if (targeted) { - drawCube(zone, {15, 5}, contents.first, stackHeight.first, false); - drawCube(zone, {4, 5}, contents.second, stackHeight.second, false); + drawCube(zone, {15, 5}, scalar, contents.first, stackHeight.first, config, false); + drawCube(zone, {4, 5}, scalar, contents.second, stackHeight.second, config, false); } break; case scoringZone::nearRed: lv_obj_set_style(zone, targeted ? &redZoneHighlighted : &redZone); - lv_obj_set_size(zone, 20, 20); - lv_obj_set_pos(zone, 0, 220); + lv_obj_set_size(zone, scale(20), scale(20)); + lv_obj_set_pos(zone, 0, scale(220)); if (targeted) { - drawCube(zone, {5, 5}, contents.first, stackHeight.first, false); + drawCube(zone, {5, 5}, scalar, contents.first, stackHeight.first, config, false); } break; case scoringZone::nearBlue: lv_obj_set_style(zone, targeted ? &blueZoneHighlighted : &blueZone); - lv_obj_set_size(zone, 20, 20); - lv_obj_set_pos(zone, 220, 220); + lv_obj_set_size(zone, scale(20), scale(20)); + lv_obj_set_pos(zone, scale(220), scale(220)); if (targeted) { - drawCube(zone, {5, 5}, contents.first, stackHeight.first, false); + drawCube(zone, {5, 5}, scalar, contents.first, stackHeight.first, config, false); } break; } @@ -372,46 +394,73 @@ void Field::draw(const scoringZone pos, const std::pair contents, } } -void Field::drawcoloredTiles() +void Field::drawColoredTiles() { lv_obj_t *redLeft1 = lv_obj_create(obj, NULL); lv_obj_set_style(redLeft1, &redAlliance); - lv_obj_set_size(redLeft1, 40, 40); - lv_obj_set_pos(redLeft1, 0, 40); + lv_obj_set_size(redLeft1, scale(40), scale(40)); + lv_obj_set_pos(redLeft1, 0, scale(40)); lv_obj_t *redLeft2 = lv_obj_create(obj, redLeft1); - lv_obj_set_pos(redLeft2, 40, 0); + lv_obj_set_pos(redLeft2, scale(40), 0); lv_obj_t *blueLeft1 = lv_obj_create(obj, redLeft1); lv_obj_set_style(blueLeft1, &blueAlliance); - lv_obj_set_pos(blueLeft1, 200, 40); + lv_obj_set_pos(blueLeft1, scale(200), scale(40)); lv_obj_t *blueLeft2 = lv_obj_create(obj, blueLeft1); - lv_obj_set_pos(blueLeft2, 160, 0); + lv_obj_set_pos(blueLeft2, scale(160), 0); } void Field::drawLines() { + short s40, s80, s160, s200, s240; + + static lv_point_t irzPts[3]; + static lv_point_t orzPts[4]; + static lv_point_t ibzPts[3]; + static lv_point_t obzPts[4]; + lv_obj_t *middleLine1 = lv_obj_create(obj, NULL); lv_obj_set_style(middleLine1, &lineStyle); - lv_obj_set_pos(middleLine1, 117, 3); - lv_obj_set_size(middleLine1, 2, 234); + lv_obj_set_pos(middleLine1, scale(117), 3); + lv_obj_set_size(middleLine1, scale(2), scale(234)); lv_obj_t *middleLine2 = lv_obj_create(obj, middleLine1); - lv_obj_set_x(middleLine1, 121); + lv_obj_set_x(middleLine1, scale(121)); lv_obj_t *innerRedZone = lv_line_create(obj, NULL); lv_line_set_style(innerRedZone, &lineStyle); - static lv_point_t irzPts[3] = {{0, 40}, {40, 40}, {40, 0}}; + + s40 = static_cast(scale(40)); + s80 = static_cast(scale(80)); + s160 = static_cast(scale(160)); + s200 = static_cast(scale(200)); + s240 = static_cast(scale(240)); + + irzPts[0] = {0, s40}; + irzPts[1] = {s40, s40}; + irzPts[2] = {s40, 0}; lv_line_set_points(innerRedZone, irzPts, 3); - lv_obj_t *outerRedZone = lv_line_create(obj, innerRedZone); - static lv_point_t orzPts[4] = {{0, 80}, {40, 80}, {80, 40}, {80, 0}}; + lv_obj_t *outerRedZone = lv_line_create(obj, innerRedZone); + + orzPts[0] = {0, s80}; + orzPts[1] = {s40, s80}; + orzPts[2] = {s80, s40}; + orzPts[3] = {s80, 0}; lv_line_set_points(outerRedZone, orzPts, 4); - lv_obj_t *innerBlueZone = lv_line_create(obj, innerRedZone); - static lv_point_t ibzPts[3] = {{200, 0}, {200, 40}, {240, 40}}; + lv_obj_t *innerBlueZone = lv_line_create(obj, innerRedZone); + + ibzPts[0] = {s200, 0}; + ibzPts[1] = {s200, s40}; + ibzPts[2] = {s240, s40}; lv_line_set_points(innerBlueZone, ibzPts, 3); - lv_obj_t *outerBlueZone = lv_line_create(obj, innerRedZone); - static lv_point_t obzPts[4] = {{160, 0}, {160, 40}, {200, 80}, {240, 80}}; + lv_obj_t *outerBlueZone = lv_line_create(obj, innerRedZone); + + obzPts[0] = {s160, 0}; + obzPts[1] = {s160, s40}; + obzPts[2] = {s200, s80}; + obzPts[3] = {s240, s80}; lv_line_set_points(outerBlueZone, obzPts, 4); } @@ -419,7 +468,7 @@ void Field::reinforcePerimeter() { lv_obj_t *perimeter = lv_obj_create(obj, NULL); lv_obj_set_style(perimeter, &perimeterStyle); - lv_obj_set_size(perimeter, 240, 240); + lv_obj_set_size(perimeter, scale(240), scale(240)); lv_obj_set_pos(perimeter, 0, 0); wallDrawn = true; @@ -434,8 +483,8 @@ void Field::drawRobot(const bool red, const uint8_t pos) { lv_obj_t *robot = lv_obj_create(obj, NULL); lv_obj_set_style(robot, red ? &redAllianceHighlighted : &blueAllianceHighlighted); - lv_obj_set_size(robot, 30, 30); - lv_obj_set_pos(robot, red ? 3 : 207, pos - 15); + lv_obj_set_size(robot, scale(30), scale(30)); + lv_obj_set_pos(robot, red ? 3 : scale(210) - 3, scale(pos - 15)); } void Field::finishDrawing() @@ -456,11 +505,12 @@ void Field::finishDrawing() void Field::drawCube(const std::pair pos, const color color, const uint8_t stackHeight, const bool targeted) { - drawCube(obj, pos, color, stackHeight, targeted); + drawCube(obj, pos, scalar, color, stackHeight, config, targeted); } -void Field::drawCube(lv_obj_t *parent, const std::pair pos, const color color, - const uint8_t stackHeight, const bool targeted) +void Field::drawCube(lv_obj_t *parent, const std::pair pos, double scalar, + const color color, const uint8_t stackHeight, const NumberConfig config, + const bool targeted) { if (color == color::none) return; @@ -471,30 +521,35 @@ void Field::drawCube(lv_obj_t *parent, const std::pair pos, co ? (targeted ? &orangeStyleHighlighted : &orangeStyle) : color == color::green ? (targeted ? &greenStyleHighlighted : &greenStyle) : (targeted ? &purpleStyleHighlighted : &purpleStyle))); - lv_obj_set_pos(cube, pos.first, pos.second); - lv_obj_set_size(cube, 10, 10); + lv_obj_set_pos(cube, scalar * pos.first, scalar * pos.second); + lv_obj_set_size(cube, scalar * 10, scalar * 10); if (stackHeight > 1) { lv_obj_t *cubeLabel = lv_label_create(cube, NULL); - lv_label_set_style(cubeLabel, &littleWhiteText); - lv_obj_align(cubeLabel, NULL, LV_ALIGN_CENTER, -1, -1); + lv_label_set_style(cubeLabel, config.fontStyle); + lv_obj_align(cubeLabel, NULL, LV_ALIGN_CENTER, config.deltaX, config.deltaY); lv_label_set_align(cubeLabel, LV_LABEL_ALIGN_CENTER); - lv_label_set_text(cubeLabel, (" " + std::to_string(stackHeight)).c_str()); + lv_label_set_text(cubeLabel, std::to_string(stackHeight).c_str()); } } +int Field::scale(int original) +{ + return scalar * original; +} + void Field::resetVectors() { // fully populate the vectors - cubesToDraw = {cubeGroup::farLeft, cubeGroup::farRight, cubeGroup::farPurple, - cubeGroup::left1, cubeGroup::left2, cubeGroup::left3, - cubeGroup::left4, cubeGroup::right1, cubeGroup::right2, - cubeGroup::right3, cubeGroup::right4, cubeGroup::near}; + cubesToDraw = {cubeGroup::farLeft, cubeGroup::farRight, cubeGroup::farPurple, cubeGroup::left1, + cubeGroup::left2, cubeGroup::left3, cubeGroup::left4, cubeGroup::right1, + cubeGroup::right2, cubeGroup::right3, cubeGroup::right4, cubeGroup::near}; towersToDraw = {tower::left, tower::right, tower::center, tower::far, tower::near, tower::red, tower::blue}; - zonesToDraw = {scoringZone::farRed, scoringZone::farBlue, scoringZone::nearRed, scoringZone::nearBlue}; + zonesToDraw = {scoringZone::farRed, scoringZone::farBlue, + scoringZone::nearRed, scoringZone::nearBlue}; } } // namespace screen