From 7861a52adf92a083bb2aed4c35f98d8035dce032 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 7 Jul 2025 13:22:53 +0200 Subject: Setup project skeleton --- src/gfx/include/gfx/gfx.h | 47 ++++++++++++++++++++++++++++++++++++++++++++ src/gfx/include/gfx/sprite.h | 32 ++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 src/gfx/include/gfx/gfx.h create mode 100644 src/gfx/include/gfx/sprite.h (limited to 'src/gfx/include') diff --git a/src/gfx/include/gfx/gfx.h b/src/gfx/include/gfx/gfx.h new file mode 100644 index 0000000..c9b4931 --- /dev/null +++ b/src/gfx/include/gfx/gfx.h @@ -0,0 +1,47 @@ +/* + * wnix, a Unix-like operating system for WebAssembly applications. + * Copyright (C) 2025 Xavier Del Campo Romero + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef GFX_H +#define GFX_H + +#include +#include + +int gfx_init(void); +int gfx_draw(void); +int gfx_update(void); +bool gfx_ready(void); +int gfx_toggle_fullscreen(void); +int gfx_set_fullscreen(short w, short h); +bool gfx_fullscreen_available(void); +bool gfx_fullscreen(void); +int gfx_display_size(short *w, short *h); + +void gfx_rect_init(struct gfx_rect *r); +void semitrans_rect_init(struct gfx_rect *r); +void stp_4line_init(struct stp_4line *l); +void quad_sort(struct quad *q); +int gfx_rect_sort(struct gfx_rect *r); +void stp_4line_sort(struct stp_4line *l); +int quad_from_sprite(const struct gfx_sprite *s, struct quad *q); +bool gfx_inside_drawenv(short x, short y, short w, short h); +void gfx_deinit(void); + +extern int screen_w, screen_h; + +#endif /* GFX_H */ diff --git a/src/gfx/include/gfx/sprite.h b/src/gfx/include/gfx/sprite.h new file mode 100644 index 0000000..7b1bf8d --- /dev/null +++ b/src/gfx/include/gfx/sprite.h @@ -0,0 +1,32 @@ +/* + * wnix, a Unix-like operating system for WebAssembly applications. + * Copyright (C) 2025 Xavier Del Campo Romero + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef GFX_SPRITE_H +#define GFX_SPRITE_H + +#include +#include + +typedef int (*gfx_read)(void *buf, size_t n, void *args); + +int gfx_sprite_load(struct gfx_sprite *s, gfx_read r, void *args); +int gfx_sprite_sort(struct gfx_sprite *s); +int gfx_sprite_clone(const struct gfx_sprite *src, struct gfx_sprite *dst); +void gfx_sprite_free(struct gfx_sprite *s); + +#endif -- cgit v1.2.3