adding flag parameter to window creation

This commit is contained in:
DaniTheSkunk 2023-03-22 04:12:14 +00:00
parent 5a14b18d2c
commit efe2991517
5 changed files with 9 additions and 16 deletions

View File

@ -82,6 +82,7 @@ int main(int argc, char *argv[]) {
"skunkworks.lib "
"/I../include "
"/I. ");
sys("copy gsa_simple.exe test.exe");
sys("skip ca1 ../example_data gsa_simple.exe");
sys("del *.obj");

View File

@ -6,7 +6,7 @@ void tick() {
int main(int argc, char *argv[]) {
struct sw_window *win;
win = sw_window_create(sw_vec2i(1280, 720), "example");
win = sw_window_create(sw_vec2i(1280, 720), "example", 0);
sw_window_run(win, tick);
return 0;

View File

@ -6,6 +6,8 @@
#include "types.h"
#include "vec2i.h"
#define SW_WINDOW_TRANS 0x01
struct GLFWwindow;
struct sw_window {
@ -20,7 +22,8 @@ struct sw_window {
u32 _renderer_count;
};
struct sw_window *sw_window_create(struct sw_vec2i size, char *title);
struct sw_window *
sw_window_create(struct sw_vec2i size, char *title, u32 flags);
void sw_window_run(struct sw_window *window);
void sw_window_add_renderer(

View File

@ -23,14 +23,10 @@ static struct sw_shaderprogram program;
static u32 vbo, vao;
#define MAX_RENDER_VERTS 10000
struct render_vert {
f32 x, y, tx, ty;
};
static i32 next_render_vert;
static struct render_vert render_verts[MAX_RENDER_VERTS * 4];
sw_color32 palette[GSA_PALETTE_SIZE];
static f32 palette_gl[1024];
static u32 tex;
@ -61,7 +57,7 @@ int gsa_main(int argc, char *argv[]) {
memset(loop_stack, 0, sizeof(loop_stack));
loop_stack_i = -1;
_win = sw_window_create(sw_vec2i(304, 176), "Game Skunk Advance v0.0");
_win = sw_window_create(sw_vec2i(304, 176), "Game Skunk Advance v0.0", 0);
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_components);
sw_log("GL_MAX_VERTEX_UNIFORM_COMPONENTS: %i", max_components);
@ -158,14 +154,6 @@ static void rect(f32 x, f32 y, f32 w, f32 h, i16 tile, bool half) {
ty = ((tile / 256) * tilesize) / 4096.f;
ts = 1.f / (4096.f / tilesize);
if(next_render_vert >= MAX_RENDER_VERTS) {
sw_error(
"trying to draw more than the current max of %i vertices in a "
"frame",
MAX_RENDER_VERTS
);
}
add_render_vert(x, y, tx, ty);
add_render_vert(x + w, y, tx + ts, ty);
add_render_vert(x, y + h, tx, ty + ts);

View File

@ -28,7 +28,8 @@ static void GLAPIENTRY gldebug(
);
#endif
struct sw_window *sw_window_create(struct sw_vec2i size, char *title) {
struct sw_window *
sw_window_create(struct sw_vec2i size, char *title, u32 flags) {
struct sw_window *win;
win = malloc(sizeof(struct sw_window));