Add put_pixel
+33
@@ -0,0 +1,33 @@
|
|||||||
|
Writes a pixel of the specified color to a framebuffer at the given coordinates.
|
||||||
|
|
||||||
|
```c
|
||||||
|
void
|
||||||
|
put_pixel(
|
||||||
|
framebuffer_e framebuffer,
|
||||||
|
unsigned int x,
|
||||||
|
unsigned int y,
|
||||||
|
uint32_t color
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
| Parameter | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `framebuffer` | The framebuffer to write to. Either `BASE` or `OVERDRAW`. |
|
||||||
|
| `x` | Horizontal pixel coordinate. From `0` to `ame_state->width - 1` . |
|
||||||
|
| `y` | Vertical pixel coordinate. From `0` to `game_state->height - 1` . |
|
||||||
|
| `color` | Pixel color. Format `0xRRGGBB` |
|
||||||
|
|
||||||
|
| Return value | none |
|
||||||
|
| --- | --- |
|
||||||
|
|
||||||
|
| Edge case | Behavior |
|
||||||
|
| --- | --- |
|
||||||
|
| `x` or `y` is out of bounds | The pixel does not get written and the engine gives a console warning. |
|
||||||
|
|
||||||
|
| Side effect | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| Pixel write | Alters the contents of the given framebuffer if the coordinates are valid. |
|
||||||
|
|
||||||
|
| Note | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| Position in the rendering pipeline | This function is supposed to be called inside the function `game_state->engine_update_framebuffer` points to. The changes get rendered after that function ends. |
|
||||||
Reference in New Issue
Block a user