mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
term: getsize
This commit is contained in:
@@ -4,5 +4,6 @@
|
||||
void term_init();
|
||||
void term_putchar(char c);
|
||||
void term_write(char *str, size_t count);
|
||||
void term_getsize(size_t *x, size_t *y, size_t *fbx, size_t *fby);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <arch/mmu.h>
|
||||
|
||||
extern volatile struct limine_framebuffer_request fb_liminereq;
|
||||
static size_t xs, ys, fbxs, fbys;
|
||||
|
||||
// TODO make more efficient. works for now
|
||||
static void *internalalloc(size_t n) {
|
||||
@@ -28,6 +29,13 @@ void term_putchar(char c) {
|
||||
flanterm_write(term_ctx, &c, 1);
|
||||
}
|
||||
|
||||
void term_getsize(size_t *x, size_t *y, size_t *fbx, size_t *fby) {
|
||||
*x = xs;
|
||||
*y = ys;
|
||||
*fbx = fbxs;
|
||||
*fby = fbys;
|
||||
}
|
||||
|
||||
void term_init() {
|
||||
__assert(fb_liminereq.response);
|
||||
__assert(fb_liminereq.response->framebuffer_count);
|
||||
@@ -41,5 +49,10 @@ void term_init() {
|
||||
NULL, NULL, NULL, &defaultbg, &defaultfg, NULL, NULL, NULL,
|
||||
0, 0, 1, 1, 1, 0);
|
||||
|
||||
xs = term_ctx->cols;
|
||||
ys = term_ctx->rows;
|
||||
fbxs = fb->width;
|
||||
fbys = fb->height;
|
||||
|
||||
__assert(term_ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user