code beautified

This commit is contained in:
Wolfgang Hottgenroth 2024-05-19 21:57:46 +02:00
parent 70467cf2a7
commit 1beb7ef04a

View File

@ -456,6 +456,21 @@ void nextStoneDraw() {
motions[nextShape].color); motions[nextShape].color);
} }
static void stoneJustDraw(uint8_t x, uint8_t y, shape_t shape) {
canvasSetPixel(x + motions[shape].draw[0].x,
y + motions[shape].draw[0].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[1].x,
y + motions[shape].draw[1].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[2].x,
y + motions[shape].draw[2].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[3].x,
y + motions[shape].draw[3].y,
motions[shape].color);
}
uint8_t stoneDraw() { uint8_t stoneDraw() {
nextStoneDraw(); nextStoneDraw();
@ -470,38 +485,12 @@ uint8_t stoneDraw() {
canvasIsPixelFree(stone.x + motions[stone.shape].draw[3].x, canvasIsPixelFree(stone.x + motions[stone.shape].draw[3].x,
stone.y + motions[stone.shape].draw[3].y)) { stone.y + motions[stone.shape].draw[3].y)) {
// if so, draw the shape // if so, draw the shape
canvasSetPixel(stone.x + motions[stone.shape].draw[0].x, stoneJustDraw(stone.x, stone.y, stone.shape);
stone.y + motions[stone.shape].draw[0].y,
motions[stone.shape].color);
canvasSetPixel(stone.x + motions[stone.shape].draw[1].x,
stone.y + motions[stone.shape].draw[1].y,
motions[stone.shape].color);
canvasSetPixel(stone.x + motions[stone.shape].draw[2].x,
stone.y + motions[stone.shape].draw[2].y,
motions[stone.shape].color);
canvasSetPixel(stone.x + motions[stone.shape].draw[3].x,
stone.y + motions[stone.shape].draw[3].y,
motions[stone.shape].color);
res = 1; res = 1;
} }
return res; return res;
} }
static void stoneJustDraw(uint8_t x, uint8_t y, shape_t shape) {
canvasSetPixel(x + motions[shape].draw[0].x,
y + motions[shape].draw[0].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[1].x,
y + motions[shape].draw[1].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[2].x,
y + motions[shape].draw[2].y,
motions[shape].color);
canvasSetPixel(x + motions[shape].draw[3].x,
y + motions[shape].draw[3].y,
motions[shape].color);
}
void stoneDrawConfigPattern() { void stoneDrawConfigPattern() {
stoneJustDraw(1, 0, e_I); stoneJustDraw(1, 0, e_I);
stoneJustDraw(3, 4, e_O); stoneJustDraw(3, 4, e_O);