/*2d title screen*/ #include #include #include"mino.h" #include"graph.h" #include"scene.h" #include"input.h" _ mat4 win_proj; _ U32 shader_tex; _ 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 buf; void main(){Frag=texture(buf,Tex);}); _ 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("buf",0);} _ U32 tex_cat; _ V title_init(V){ glm_ortho(0,graph_win_w,0,graph_win_h,0,4,win_proj), shader_tex_init(); tex_cat=graph_tex_create("res/tex/cat.jpg");} _ V title_loop(V){/*prelude*/graph_before(),graph_events();InputPoint p; glm_ortho(0,graph_win_w,0,graph_win_h,0,4,win_proj), /*interlude*/ p=input_point(), graph_shader_use(shader_tex),graph_shader_setM4("proj",win_proj), graph_tex_use(tex_cat,0), graph_quad_xywh(p.x,p.y,256,256), /*postlude*/ graph_after();} _ Scene*title_run(V){title_init();WH(1,title_loop());R 0;} Scene scene_title={"title",title_run};