adding flag parameter to window creation
This commit is contained in:
parent
5a14b18d2c
commit
efe2991517
1
build.c
1
build.c
|
@ -82,6 +82,7 @@ int main(int argc, char *argv[]) {
|
||||||
"skunkworks.lib "
|
"skunkworks.lib "
|
||||||
"/I../include "
|
"/I../include "
|
||||||
"/I. ");
|
"/I. ");
|
||||||
|
sys("copy gsa_simple.exe test.exe");
|
||||||
sys("skip ca1 ../example_data gsa_simple.exe");
|
sys("skip ca1 ../example_data gsa_simple.exe");
|
||||||
|
|
||||||
sys("del *.obj");
|
sys("del *.obj");
|
||||||
|
|
|
@ -6,7 +6,7 @@ void tick() {
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
struct sw_window *win;
|
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);
|
sw_window_run(win, tick);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "vec2i.h"
|
#include "vec2i.h"
|
||||||
|
|
||||||
|
#define SW_WINDOW_TRANS 0x01
|
||||||
|
|
||||||
struct GLFWwindow;
|
struct GLFWwindow;
|
||||||
|
|
||||||
struct sw_window {
|
struct sw_window {
|
||||||
|
@ -20,7 +22,8 @@ struct sw_window {
|
||||||
u32 _renderer_count;
|
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_run(struct sw_window *window);
|
||||||
void sw_window_add_renderer(
|
void sw_window_add_renderer(
|
||||||
|
|
14
src/gsa.c
14
src/gsa.c
|
@ -23,14 +23,10 @@ static struct sw_shaderprogram program;
|
||||||
|
|
||||||
static u32 vbo, vao;
|
static u32 vbo, vao;
|
||||||
|
|
||||||
#define MAX_RENDER_VERTS 10000
|
|
||||||
|
|
||||||
struct render_vert {
|
struct render_vert {
|
||||||
f32 x, y, tx, ty;
|
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];
|
sw_color32 palette[GSA_PALETTE_SIZE];
|
||||||
static f32 palette_gl[1024];
|
static f32 palette_gl[1024];
|
||||||
static u32 tex;
|
static u32 tex;
|
||||||
|
@ -61,7 +57,7 @@ int gsa_main(int argc, char *argv[]) {
|
||||||
memset(loop_stack, 0, sizeof(loop_stack));
|
memset(loop_stack, 0, sizeof(loop_stack));
|
||||||
loop_stack_i = -1;
|
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);
|
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_components);
|
||||||
sw_log("GL_MAX_VERTEX_UNIFORM_COMPONENTS: %i", 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;
|
ty = ((tile / 256) * tilesize) / 4096.f;
|
||||||
ts = 1.f / (4096.f / tilesize);
|
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, y, tx, ty);
|
||||||
add_render_vert(x + w, y, tx + ts, ty);
|
add_render_vert(x + w, y, tx + ts, ty);
|
||||||
add_render_vert(x, y + h, tx, ty + ts);
|
add_render_vert(x, y + h, tx, ty + ts);
|
||||||
|
|
|
@ -28,7 +28,8 @@ static void GLAPIENTRY gldebug(
|
||||||
);
|
);
|
||||||
#endif
|
#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;
|
struct sw_window *win;
|
||||||
|
|
||||||
win = malloc(sizeof(struct sw_window));
|
win = malloc(sizeof(struct sw_window));
|
||||||
|
|
Loading…
Reference in New Issue