prosperon/source/engine/window.c

80 lines
1.3 KiB
C
Raw Normal View History

#include "window.h"
2022-06-30 10:31:23 -05:00
#include "input.h"
2023-05-12 13:22:05 -05:00
#include "log.h"
2022-08-14 18:10:29 -05:00
#include "nuke.h"
2023-05-12 13:22:05 -05:00
#include "script.h"
#include "texture.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2023-06-06 15:49:55 -05:00
#include "ffi.h"
2021-11-30 21:29:18 -06:00
#include "openglrender.h"
2022-08-26 09:19:17 -05:00
#include "stb_ds.h"
struct window mainwin;
static struct window *windows = NULL;
2022-08-26 09:19:17 -05:00
struct Texture *icon = NULL;
2021-11-30 21:29:18 -06:00
void window_resize(int width, int height)
{
mainwin.width = width;
mainwin.height = height;
2023-05-24 20:45:50 -05:00
render_winsize();
2023-06-06 15:49:55 -05:00
JSValue vals[2] = { int2js(width), int2js(height) };
send_signal("window_resize", 2, vals);
2022-06-30 10:31:23 -05:00
}
void window_quit()
{
2023-05-12 13:22:05 -05:00
quit();
2022-06-30 10:31:23 -05:00
}
void window_focused(int focus)
{
mainwin.focus = focus;
}
void window_iconified(int s)
{
mainwin.iconified = s;
}
2022-08-12 14:03:56 -05:00
2023-05-04 17:07:00 -05:00
void window_suspended(int s)
{
2023-06-06 15:49:55 -05:00
2021-11-30 21:29:18 -06:00
}
2023-05-12 13:22:05 -05:00
void window_set_icon(const char *png) {
2023-03-24 14:01:01 -05:00
icon = texture_pullfromfile(png);
window_seticon(&mainwin, icon);
2022-01-19 16:43:21 -06:00
}
2023-05-12 13:22:05 -05:00
void window_makefullscreen(struct window *w) {
if (!w->fullscreen)
window_togglefullscreen(w);
2022-08-12 14:03:56 -05:00
}
2023-05-12 13:22:05 -05:00
void window_unfullscreen(struct window *w) {
if (w->fullscreen)
window_togglefullscreen(w);
2021-11-30 21:29:18 -06:00
}
2023-05-12 13:22:05 -05:00
void window_togglefullscreen(struct window *w) {
sapp_toggle_fullscreen();
mainwin.fullscreen = sapp_is_fullscreen();
2021-11-30 21:29:18 -06:00
}
2022-01-19 16:43:21 -06:00
2023-05-12 13:22:05 -05:00
void window_seticon(struct window *w, struct Texture *icon) {
2022-02-06 10:14:57 -06:00
}
void window_render(struct window *w) {
2023-05-12 13:22:05 -05:00
openglRender(w);
}