[SOLVED] some c/c++ compiler shenanigans
Posted: Fri Nov 27, 2020 8:47 pm
I'm really fucking tired. Like, really tired. I've fixed so many bugs today and written so many minor features that I'm exhausted. So forgive me if I'm overlooking something, OK?
This function:
Gives this error:
Which insinuates that xx[/i[ and yy are references, which is so not good on so many levels.
This seems to be out of my control, though is there any compiler flags to fix this, or is my code wrong?
Referenced functions/structs:
This function:
Code: Select all
void rect(positional_point pos, dimensions dims, uint32_t color) {
for (uint32_t xx = pos.x; (xx <= (pos.x + dims.w)) && (xx < width); xx++)
for (uint32_t yy = pos.y; (yy <= (pos.y + dims.h)) && (yy < height); yy++)
plot_pixel(pos(xx, yy), color);
buff();
}
Code: Select all
src/gfx.cxx:33:25: error: no match for call to ‘(positional_point {aka s_pos_point}) (uint32_t&, uint32_t&)’
33 | plot_pixel(pos(xx, yy), color);
| ^
This seems to be out of my control, though is there any compiler flags to fix this, or is my code wrong?
Referenced functions/structs:
Code: Select all
typedef struct s_pos_point {
int x;
int y;
} positional_point;
typedef struct s_dimensions {
int w;
int h;
} dimensions;
positional_point pos(int x, int y) {
positional_point pos;
pos.x = x;
pos.y = y;
return pos;
}
void plot_pixel(positional_point pos, uint32_t pixel)
{
*((uint32_t*)(gop.framebuffer_base_addr + 4 * gop.pixels_per_scan_line * pos.y + 4 * pos.x)) = pixel;
}