/*
 * 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 <https://www.gnu.org/licenses/>.
 */

#ifndef GFX_H
#define GFX_H

#include <gfx/port.h>
#include <stdbool.h>

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 */
