docs: documented layer system and string rendering
This commit is contained in:
parent
d025ccaff2
commit
526ad615d8
|
@ -325,31 +325,37 @@ A global usable 8x8 font.
|
|||
|
||||
|
||||
### graphics/renderer.h
|
||||
#### `graphics_buffer_layer_E` - enum
|
||||
- **Standard** - The layer, where almost everything should be on
|
||||
- **Overlay** - This layer should be used for stuff like a mouse cursor, that should always be visible
|
||||
|
||||
#### `graphics_buffer_T` - struct
|
||||
|
||||
| Name | Type | Description |
|
||||
|--------|--------------------|------------------------------------------------------------------------------|
|
||||
|---------|-------------------------|------------------------------------------------------------------------------|
|
||||
| buffer | color_argb_T* | The buffer, where all the pixels are stored |
|
||||
| width | uint32_t | The width of the buffer |
|
||||
| height | uint32_t | The height of the buffer |
|
||||
| pos_x | uint32_t | The buffers x offset (from the top-left corner) in the renderers main buffer |
|
||||
| pos_y | uint32_t | The buffers y offset (from the top-left corner) in the renderers main buffer |
|
||||
| blocked | bool | Thread safety block variable |
|
||||
| layer | graphics_buffer_layer_E | The layer, on which the buffer will be rendered |
|
||||
| prev | graphics_buffer_T* | The previous buffer in the rendering queue |
|
||||
| next | graphics_buffer_T* | The next buffer in the rendering queue |
|
||||
|
||||
#### `graphics_renderer_T` - struct
|
||||
|
||||
| Name | Type | Description |
|
||||
|------------------|--------------------|------------------------------------------------------------------------------------------|
|
||||
|------------------------|---------------------|------------------------------------------------------------------------------------------|
|
||||
| framebuffer | framebuffer_T | The systems framebuffer (requested from bootloader) |
|
||||
| back_buffer | uint32_t* | The buffer, where the final image is calculated, before sending it to the framebuffer |
|
||||
| buffer_size | uint64_t | The size of `back_buffer` (in bytes) |
|
||||
| graphics_buffers | graphics_buffer_T* | Pointer to the first graphics_buffer |
|
||||
| graphics_buffer_layers | graphics_buffer_T** | List of pointers to the first graphics_buffer of every layer |
|
||||
| font | font_T | The font, all graphics buffers use to draw chars (could be moved to `graphics_buffer_T`) |
|
||||
|
||||
|
||||
#### `graphics_buffer_request(pos_x, pos_y, width, height)` - function (graphics_buffer_T*)
|
||||
Allocates a graphics buffer and pushes it on top of the rendering queue.
|
||||
#### `graphics_buffer_request(pos_x, pos_y, width, height, layer)` - function (graphics_buffer_T*)
|
||||
Allocates a graphics buffer and pushes it on top of the rendering queue of **_layer_**.
|
||||
|
||||
#### `graphics_buffer_destruct(graphics_buffer)` - function (void)
|
||||
Removes **_graphics_buffer_** from the rendering queue and frees its memory allocations.
|
||||
|
@ -365,6 +371,10 @@ Returns the color of the pixel at position(**_x_** | **_y_**) in **_graphics_buf
|
|||
Draws a character (**_chr_**) at position(**_x_** | **_y_**) in **_graphics_buffer_**.
|
||||
The position is the top-left corner of the char.
|
||||
|
||||
#### `graphics_buffer_draw_string(graphics_buffer, x, y, color, string)` - function (void)
|
||||
Draws **_string_** at position(**_x_** | **_y_**) in **_graphics_buffer_**.
|
||||
The position is the top-left corner of the string.
|
||||
|
||||
#### `graphics_renderer_init(boot_info)` - function (void)
|
||||
Initializes the global graphics renderer.
|
||||
Needs a pointer to `boot_info` to extract information about the framebuffer.
|
||||
|
@ -372,10 +382,10 @@ Needs a pointer to `boot_info` to extract information about the framebuffer.
|
|||
#### `graphics_renderer_update()` - function (void)
|
||||
Updates the renderers back_buffer and swaps it into the framebuffer.
|
||||
To update the back_buffer, it iterates over the rendering queue and copies every buffer to the back_buffer.
|
||||
If there are overlapping graphics_buffers, it alpha blends them.
|
||||
If there are overlapping graphics_buffers, it alpha-blends them.
|
||||
|
||||
#### `graphics_renderer_get_top_buffer()` - function (graphics_buffer_T*)
|
||||
Returns a pointer to the graphics_buffer, that is on top of the rendering queue.
|
||||
#### `graphics_renderer_get_top_buffer(layer)` - function (graphics_buffer_T*)
|
||||
Returns a pointer to the graphics_buffer, that is on top of the rendering queue of **_layer_**.
|
||||
|
||||
#### `graphics_renderer_get_width()` - function (uint32_t)
|
||||
Returns the width of the framebuffer.
|
||||
|
|
Loading…
Reference in New Issue