nonbinary-tree(TM) now works in a very minimal instance

This commit is contained in:
Emile Clark-Boman 2025-09-16 16:48:02 +10:00
parent 330755591b
commit b16590fd5a
15 changed files with 132 additions and 216 deletions

View file

@ -2,6 +2,7 @@
#include "ncrswrap.h"
#include "surface.h"
#include "_ncurses.h"
static inline struct ct_surface *__surface(struct ct_dims *const dims,
struct ct_bounds *const bounds,
@ -25,8 +26,8 @@ struct ct_surface *new_surface(struct ct_dims *const dims,
return __surface(dims, bounds, win);
}
void destroy_surface(struct ct_surface *const surface) {
destroy_window(surface->win);
void destroy_surface(const struct ct_surface *const surface) {
delwin(surface->win);
free(surface->dims);
}
@ -44,3 +45,31 @@ void rebind_surface(struct ct_surface *const surface,
free(surface->bounds);
surface->bounds = bounds;
}
void sfclear(struct ct_surface *const surface) {
wclear(surface->win);
}
int sfwidth(const struct ct_surface *const surface) {
return getmaxx(surface->win);
}
int sfheight(const struct ct_surface *const surface) {
return getmaxy(surface->win);
}
int sfposx(const struct ct_surface *const surface) {
return getbegx(surface->win);
}
int sfposy(const struct ct_surface *const surface) {
return getbegy(surface->win);
}
struct ct_dims *sfdims(const struct ct_surface *const surface) {
int x, y, width, height;
sfpos(surface, x, y);
sfsize(surface, width, height);
return new_dims(x, y, width, height);
}