restrcuct

This commit is contained in:
2025-11-11 11:09:32 -07:00
parent e148177bbd
commit 20c73b6ab4
13 changed files with 3864 additions and 490 deletions

46
include/renderer_common.h Normal file
View File

@@ -0,0 +1,46 @@
#ifndef RENDERER_COMMON_H
#define RENDERER_COMMON_H
#include <stdbool.h>
#include <stdint.h>
#define FONT_WIDTH 16
#define FONT_HEIGHT 16
typedef struct {
unsigned int x, y;
unsigned int color;
} RenderBase;
typedef struct {
RenderBase base;
const char *text;
void *font; // Opaque font pointer
} RenderText;
typedef struct {
unsigned int x, y;
unsigned int width, height;
unsigned int color;
} RenderObject;
typedef struct Renderer Renderer;
struct Renderer {
volatile unsigned int *fb;
unsigned int width;
unsigned int height;
unsigned int pitch;
bool (*init)(Renderer *renderer);
void (*clear_screen)(Renderer *renderer, unsigned int color);
void (*draw_text)(Renderer *renderer, RenderText *text_obj);
};
/**
* Initializes the framebuffer (common across both renderers)
*/
bool renderer_init_common(Renderer *renderer);
#endif // RENDERER_COMMON_H