2021-11-30 21:29:18 -06:00
|
|
|
#ifndef WINDOW_H
|
|
|
|
#define WINDOW_H
|
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#include "render.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
#include <stdbool.h>
|
2022-02-06 10:14:57 -06:00
|
|
|
#include <stdint.h>
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-08-07 01:43:45 -05:00
|
|
|
#include "mruby.h"
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
struct mSDLWindow {
|
2022-02-06 10:14:57 -06:00
|
|
|
GLFWwindow *window;
|
2021-11-30 21:29:18 -06:00
|
|
|
int id;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
/* TODO: Bitfield these */
|
|
|
|
bool render;
|
|
|
|
bool mouseFocus;
|
|
|
|
bool keyboardFocus;
|
|
|
|
bool fullscreen;
|
|
|
|
bool minimized;
|
2022-06-30 10:31:23 -05:00
|
|
|
bool iconified;
|
2021-11-30 21:29:18 -06:00
|
|
|
bool shown;
|
|
|
|
float projection[16];
|
2022-08-07 01:43:45 -05:00
|
|
|
mrb_sym nuke_cb;
|
|
|
|
mrb_sym gui_cb;
|
2022-08-14 14:19:36 -05:00
|
|
|
void (*nuke_gui)();
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
2022-01-19 16:43:21 -06:00
|
|
|
struct Texture;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
extern struct mSDLWindow *mainwin;
|
|
|
|
|
|
|
|
|
2022-06-30 10:31:23 -05:00
|
|
|
struct mSDLWindow *MakeSDLWindow(const char *name, int width, int height, uint32_t flags);
|
2022-06-27 14:12:26 -05:00
|
|
|
void window_set_icon(const char *png);
|
2022-02-06 10:14:57 -06:00
|
|
|
void window_destroy(struct mSDLWindow *w);
|
|
|
|
void window_handle_event(struct mSDLWindow *w);
|
|
|
|
void window_all_handle_events();
|
2021-11-30 21:29:18 -06:00
|
|
|
void window_makecurrent(struct mSDLWindow *w);
|
|
|
|
void window_makefullscreen(struct mSDLWindow *w);
|
|
|
|
void window_togglefullscreen(struct mSDLWindow *w);
|
2022-08-12 14:03:56 -05:00
|
|
|
void window_unfullscreen(struct mSDLWindow *w);
|
2021-11-30 21:29:18 -06:00
|
|
|
void window_swap(struct mSDLWindow *w);
|
2022-01-19 16:43:21 -06:00
|
|
|
void window_seticon(struct mSDLWindow *w, struct Texture *icon);
|
|
|
|
int window_hasfocus(struct mSDLWindow *w);
|
2022-08-07 01:43:45 -05:00
|
|
|
struct mSDLWindow *window_i(int index);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-08-07 01:43:45 -05:00
|
|
|
void window_render(struct mSDLWindow *w);
|
|
|
|
void window_renderall();
|
2022-02-06 10:14:57 -06:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#endif
|