Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

Commit b6189ca

Browse files
author
SpencerJ
committed
clang-format
1 parent 9d811f2 commit b6189ca

File tree

4 files changed

+54
-38
lines changed

4 files changed

+54
-38
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ bin/
44

55
compile_commands.json
66
temp.log
7+
8+
*.zip

include/screen/field.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,17 @@ namespace screen {
6868

6969
class Field {
7070
public:
71-
72-
/**
73-
* A struct that controls the drawing of numbers on cubes (which represent height)
74-
*
75-
* deltaX how far to move the number horizontally from default
76-
* deltaY how far to move the number vertically from default
77-
* fontStyle which style to use; can be used to change the font, color, etc. of the number
71+
/**
72+
* A struct that controls the drawing of numbers on cubes (which represent height)
73+
*
74+
* deltaX how far to move the number horizontally from default
75+
* deltaY how far to move the number vertically from default
76+
* fontStyle which style to use; can be used to change the font, color, etc. of the number
7877
*/
79-
struct NumberConfig{
80-
int deltaX, deltaY;
81-
lv_style_t* fontStyle;
82-
};
78+
struct NumberConfig {
79+
int deltaX, deltaY;
80+
lv_style_t *fontStyle;
81+
};
8382

8483
/**
8584
* Field generator for the screen
@@ -176,7 +175,7 @@ class Field {
176175
* for both stacks. See the README for more information
177176
*/
178177
void draw(scoringZone pos, std::pair<color, color> contents,
179-
std::pair<uint8_t, uint8_t> stackHeight);
178+
std::pair<uint8_t, uint8_t> stackHeight);
180179

181180
/**
182181
* draw the four colored tiles
@@ -225,8 +224,8 @@ class Field {
225224
// Cubes should be drawn automatically by the above functions
226225
void drawCube(std::pair<uint8_t, uint8_t> pos, color color, uint8_t stackHeight, bool targeted);
227226

228-
static void drawCube(lv_obj_t *parent, std::pair<uint8_t, uint8_t> pos, double scalar, color color,
229-
uint8_t stackHeight, NumberConfig config, bool targeted);
227+
static void drawCube(lv_obj_t *parent, std::pair<uint8_t, uint8_t> pos, double scalar,
228+
color color, uint8_t stackHeight, NumberConfig config, bool targeted);
230229

231230
int scale(int original);
232231

src/opcontrol.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ void opcontrol()
1313

1414
// two stacks use an array of colors
1515
// draw a purple stack with height 1 and an orange stack with height 3 in the far red zone
16-
field.draw(screen::scoringZone::farRed, {screen::color::purple, screen::color::orange},
17-
{1, 3});
16+
field.draw(screen::scoringZone::farRed, {screen::color::purple, screen::color::orange}, {1, 3});
1817

1918
// one stack does not need to use an array
2019
// draw a green stack with height 4 in the near red zone
@@ -37,7 +36,8 @@ void opcontrol()
3736
// (this is the 5 cube stack on the audience side)
3837
field.draw(screen::cubeGroup::near, CUBE_NEAR_LEFT + CUBE_NEAR_RIGHT + CUBE_FAR_RIGHT);
3938

40-
// draw the highest(rightmost), and the 2nd lowest(leftmost) cube of the 4th(closest) left cube group
39+
// draw the highest(rightmost), and the 2nd lowest(leftmost) cube of the 4th(closest) left cube
40+
// group
4141
field.draw(screen::cubeGroup::left4, CUBE_HIGHEST + CUBE_2LOWEST);
4242

4343
// draw the left tower with no cubes in or around

src/screen/field.cpp

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
namespace screen {
44

55
Field::Field(lv_obj_t *parent, const double ilength, const bool iautoInit,
6-
const NumberConfig iconfig):
7-
scalar(ilength / 240), autoInit(iautoInit), config(iconfig),
8-
wallDrawn(false), allianceTowerContents(color::none, color::none)
6+
const NumberConfig iconfig)
7+
: scalar(ilength / 240),
8+
autoInit(iautoInit),
9+
config(iconfig),
10+
wallDrawn(false),
11+
allianceTowerContents(color::none, color::none)
912
{
1013
obj = lv_obj_create(parent, NULL);
1114
lv_obj_set_style(obj, &fieldStyle);
@@ -54,7 +57,8 @@ void Field::setPos(int x, int y)
5457
lv_obj_set_pos(obj, x, y);
5558
}
5659

57-
void Field::setSideLength(uint ilength){
60+
void Field::setSideLength(uint ilength)
61+
{
5862
scalar = ilength / 240.0;
5963
lv_obj_set_size(obj, ilength, ilength);
6064
clean();
@@ -331,7 +335,7 @@ void Field::draw(const scoringZone pos, const color contents, const uint8_t stac
331335
}
332336

333337
void Field::draw(const scoringZone pos, const std::pair<color, color> contents,
334-
const std::pair<uint8_t, uint8_t> stackHeight)
338+
const std::pair<uint8_t, uint8_t> stackHeight)
335339
{
336340
bool targeted = contents.first != color::none;
337341

@@ -408,7 +412,6 @@ void Field::drawColoredTiles()
408412

409413
void Field::drawLines()
410414
{
411-
412415
short s40, s80, s160, s200, s240;
413416

414417
static lv_point_t irzPts[3];
@@ -426,25 +429,38 @@ void Field::drawLines()
426429
lv_obj_t *innerRedZone = lv_line_create(obj, NULL);
427430
lv_line_set_style(innerRedZone, &lineStyle);
428431

429-
s40 = static_cast<short>(scale(40));
430-
s80 = static_cast<short>(scale(80));
432+
s40 = static_cast<short>(scale(40));
433+
s80 = static_cast<short>(scale(80));
431434
s160 = static_cast<short>(scale(160));
432435
s200 = static_cast<short>(scale(200));
433436
s240 = static_cast<short>(scale(240));
434437

435-
irzPts[0] = {0, s40}; irzPts[1] = {s40, s40}; irzPts[2] = {s40, 0};
438+
irzPts[0] = {0, s40};
439+
irzPts[1] = {s40, s40};
440+
irzPts[2] = {s40, 0};
436441
lv_line_set_points(innerRedZone, irzPts, 3);
437442

438-
lv_obj_t *outerRedZone = lv_line_create(obj, innerRedZone);
439-
orzPts[0] = {0, s80}; orzPts[1] = {s40, s80}; orzPts[2] = {s80, s40}; orzPts[3] = {s80, 0};
443+
lv_obj_t *outerRedZone = lv_line_create(obj, innerRedZone);
444+
445+
orzPts[0] = {0, s80};
446+
orzPts[1] = {s40, s80};
447+
orzPts[2] = {s80, s40};
448+
orzPts[3] = {s80, 0};
440449
lv_line_set_points(outerRedZone, orzPts, 4);
441450

442-
lv_obj_t *innerBlueZone = lv_line_create(obj, innerRedZone);
443-
ibzPts[0] = {s200, 0}; ibzPts[1] = {s200, s40}; ibzPts[2] = {s240, s40};
451+
lv_obj_t *innerBlueZone = lv_line_create(obj, innerRedZone);
452+
453+
ibzPts[0] = {s200, 0};
454+
ibzPts[1] = {s200, s40};
455+
ibzPts[2] = {s240, s40};
444456
lv_line_set_points(innerBlueZone, ibzPts, 3);
445457

446-
lv_obj_t *outerBlueZone = lv_line_create(obj, innerRedZone);
447-
obzPts[0] = {s160, 0}; obzPts[1] = {s160, s40}; obzPts[2] = {s200, s80}; obzPts[3] = {s240, s80};
458+
lv_obj_t *outerBlueZone = lv_line_create(obj, innerRedZone);
459+
460+
obzPts[0] = {s160, 0};
461+
obzPts[1] = {s160, s40};
462+
obzPts[2] = {s200, s80};
463+
obzPts[3] = {s240, s80};
448464
lv_line_set_points(outerBlueZone, obzPts, 4);
449465
}
450466

@@ -525,16 +541,15 @@ int Field::scale(int original)
525541
void Field::resetVectors()
526542
{
527543
// fully populate the vectors
528-
cubesToDraw = {cubeGroup::farLeft, cubeGroup::farRight, cubeGroup::farPurple,
529-
cubeGroup::left1, cubeGroup::left2, cubeGroup::left3,
530-
cubeGroup::left4, cubeGroup::right1, cubeGroup::right2,
531-
cubeGroup::right3, cubeGroup::right4, cubeGroup::near};
544+
cubesToDraw = {cubeGroup::farLeft, cubeGroup::farRight, cubeGroup::farPurple, cubeGroup::left1,
545+
cubeGroup::left2, cubeGroup::left3, cubeGroup::left4, cubeGroup::right1,
546+
cubeGroup::right2, cubeGroup::right3, cubeGroup::right4, cubeGroup::near};
532547

533548
towersToDraw = {tower::left, tower::right, tower::center, tower::far,
534549
tower::near, tower::red, tower::blue};
535550

536-
zonesToDraw = {scoringZone::farRed, scoringZone::farBlue,
537-
scoringZone::nearRed, scoringZone::nearBlue};
551+
zonesToDraw = {scoringZone::farRed, scoringZone::farBlue,
552+
scoringZone::nearRed, scoringZone::nearBlue};
538553
}
539554

540555
} // namespace screen

0 commit comments

Comments
 (0)