62 lines
2.6 KiB
C
62 lines
2.6 KiB
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOX_RENDERER_H
|
|
#define NOX_RENDERER_H
|
|
|
|
#include "utils/stdtypes.h"
|
|
#include "utils/string.h"
|
|
#include "utils/math.h"
|
|
#include "drivers/graphics/color.h"
|
|
#include "drivers/graphics/font.h"
|
|
#include "drivers/graphics/framebuffer.h"
|
|
#include "boot/boot_info.h"
|
|
|
|
typedef enum {
|
|
GRAPHICS_BUFFER_STANDARD,
|
|
GRAPHICS_BUFFER_OVERLAY,
|
|
|
|
GRAPHICS_BUFFER_ENUM_MAX
|
|
} graphics_buffer_layer_E;
|
|
|
|
typedef struct graphics_buffer_T graphics_buffer_T;
|
|
struct graphics_buffer_T {
|
|
color_argb_T* buffer;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
uint32_t pos_x;
|
|
uint32_t pos_y;
|
|
bool blocked;
|
|
bool render;
|
|
graphics_buffer_layer_E layer;
|
|
graphics_buffer_T* prev;
|
|
graphics_buffer_T* next;
|
|
};
|
|
|
|
typedef struct {
|
|
framebuffer_T framebuffer;
|
|
uint32_t* back_buffer;
|
|
uint64_t buffer_size;
|
|
graphics_buffer_T** graphics_buffer_layers;
|
|
font_T font;
|
|
bool initialized;
|
|
bool blocked;
|
|
} graphics_renderer_T;
|
|
|
|
graphics_buffer_T* graphics_buffer_request (uint32_t pos_x, uint32_t pos_y, uint32_t width, uint32_t height, graphics_buffer_layer_E layer);
|
|
void graphics_buffer_show (graphics_buffer_T* graphics_buffer);
|
|
void graphics_buffer_hide (graphics_buffer_T* graphics_buffer);
|
|
void graphics_buffer_destruct (graphics_buffer_T* graphics_buffer);
|
|
void graphics_buffer_shift_up (graphics_buffer_T* graphics_buffer, uint16_t shift);
|
|
void graphics_buffer_set_pixel (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y, color_argb_T color);
|
|
color_argb_T graphics_buffer_get_pixel (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y);
|
|
void graphics_buffer_draw_char (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y, color_argb_T color, char chr);
|
|
position_T graphics_buffer_draw_string (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y, color_argb_T color, string_t string);
|
|
|
|
void graphics_renderer_init (boot_info_T* boot_info);
|
|
void graphics_renderer_update ();
|
|
graphics_buffer_T* graphics_renderer_get_top_buffer (graphics_buffer_layer_E layer);
|
|
uint32_t graphics_renderer_get_width ();
|
|
uint32_t graphics_renderer_get_height ();
|
|
|
|
#endif //NOX_RENDERER_H
|