summaryrefslogtreecommitdiff
path: root/mino.c
diff options
context:
space:
mode:
authorkitty piapiac <kcp@bsd.computer>2023-04-18 12:29:55 -0700
committerkitty piapiac <kcp@bsd.computer>2023-04-18 12:29:55 -0700
commitf1d602f5dcf862907affd1479eb3b2d132d7d639 (patch)
treeb133327eb0bbf0ff3e854db6955f377a083e2e1e /mino.c
parent84bcb0274fc80d360ff0fbe5ede89643169f6165 (diff)
scenes
a bit crude and untested
Diffstat (limited to 'mino.c')
-rw-r--r--mino.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/mino.c b/mino.c
index be07e7f..8d02bc6 100644
--- a/mino.c
+++ b/mino.c
@@ -4,47 +4,15 @@
#include<cglm/cglm.h>
#include"mino.h"
#include"graph.h"
+#include"scene.h"
NR V die(IM C*f,...)VA(f,vfprintf(stderr,f,ap),fputc('\n',stderr),exit(1))
V*make(Uz z){V*p;N(p=malloc(z), die("oom"))R p;}
V*remk(V*p,Uz z){N(p=realloc(p,z),die("oom"))R p;}
V del(V*p){free(p);}
-_ IM C shader_tex_vert[]=GRAPH_GLSL(
- layout (location=0) in vec3 pos;
- layout (location=1) in vec3 col;
- layout (location=2) in vec2 tex;
- out vec3 Col;
- out vec2 Tex;
- uniform mat4 proj;
- uniform mat4 model;
- void main(){gl_Position=proj*model*vec4(pos,1.0);Col=col;Tex=tex;});
-
-_ IM C shader_tex_frag[]=GRAPH_GLSL(
- out vec4 Frag;
- in vec3 Col;
- in vec2 Tex;
- uniform sampler2D buf0;
- void main(){Frag=texture(buf0,Tex);});
-
-_ U32 shader_tex;
-
-_ mat4 win_proj;
-_ V shader_tex_init(V){
- shader_tex=graph_shader_create(shader_tex_vert,shader_tex_frag),
- graph_shader_use(shader_tex);
- graph_shader_setM4("proj",win_proj),
- graph_shader_setI("buf0",0);}
-
-I main(I ac,C**av){(V)ac,(V)av;U32 cat;
- graph_init();
- atexit(graph_deinit);
- shader_tex_init();
- cat=graph_tex_create("res/tex/cat.jpg");
- WH(1,graph_before(),graph_events();
- glm_ortho(0,graph_win_w,0,graph_win_h,0,4,win_proj),
- graph_shader_setM4("proj",win_proj),
- graph_tex_use(cat,0),
- graph_quad_xywh(200,200,200,200),
- graph_after());
+X Scene scene_title;
+I main(I ac,C**av){(V)ac,(V)av;
+ graph_init(),atexit(graph_deinit);
+ scene_run(&scene_title);
R 0;}