did some stuff, will probably refactor later

This commit is contained in:
Jozef Nagy 2025-05-11 22:20:45 +02:00
parent 10ee4fcbd9
commit bc4ec556e2
Signed by untrusted user who does not match committer: crz
GPG key ID: 459A4811CEAC7068
46 changed files with 1013 additions and 35635 deletions

View file

@ -18,39 +18,39 @@
/*********************************************************************************/
#include <ui/framebuffer.h>
#include <ui/mouse.h>
#include <ui/font.h>
#include <ui/ui.h>
#include <config/config.h>
#include <print.h>
#include <stdint.h>
struct ui_config {
uintptr_t fb_addr;
struct fb_mode *fb_modes;
int total_modes;
int current_mode;
};
struct ui_config config;
void ui_init()
{
struct fb_mode *available_fb_modes = NULL;
int total_modes = 0;
int current_mode = 0;
struct ui_context ctx;
if (!get_framebuffer(&config.fb_addr, &config.fb_modes, &config.total_modes, &config.current_mode)) {
if (!get_framebuffer(&ctx.fb_addr, &ctx.fb_modes, &ctx.total_modes, &ctx.current_mode)) {
debug("Failed to acquire a framebuffer!\n");
while (1);
}
debug("Dumping framebuffer information\n");
debug("--------------------------------\n");
debug("Address: 0x%llx\n", config.fb_addr);
debug("Address: 0x%llx\n", ctx.fb_addr);
for (int i = 0; i < config.total_modes; i++) {
debug("\nMode %u:%s\n", i, (i == config.current_mode) ? " (current)" : "");
debug("Resolution: %ux%u\n", config.fb_modes[i].width, config.fb_modes[i].height);
debug("Bits Per Pixel: %u\n", config.fb_modes[i].bpp);
debug("Pitch: %u\n", config.fb_modes[i].pitch);
for (int i = 0; i < ctx.total_modes; i++) {
debug("\nMode %u:%s\n", i, (i == ctx.current_mode) ? " (current)" : "");
debug("Resolution: %ux%u\n", ctx.fb_modes[i].width, ctx.fb_modes[i].height);
debug("Bits Per Pixel: %u\n", ctx.fb_modes[i].bpp);
debug("Pitch: %u\n", ctx.fb_modes[i].pitch);
debug("Format: %s\n", ctx.fb_modes[i].format == FB_RGBA ? "RGBA" : "BGRA");
}
while(1);
}
//font_init("\\AxBoot\\fonts\\DreamOrphans.ttf", 20);
//while (1) {
//get_mouse(&m_x, &m_y, &m_but);
//debug("Mouse X = %u | Mouse Y = %u\n", m_x, m_y);
//}
}