diff options
| author | 2026-08-26 17:56:52 -0400 | |
|---|---|---|
| committer | 2026-08-26 17:56:52 -0400 | |
| commit | 197d41a3e23cab35848f623c6133baccc62aacbe (patch) | |
| tree | 04943c1de9653de53615e10ced1eab07c2562325 /src/render/shaders/osd.h | |
| parent | 6094c907b26e21f13373bae6bf3306dbae40af3c (diff) | |
| download | camu-197d41a3e23cab35848f623c6133baccc62aacbe.tar.gz camu-197d41a3e23cab35848f623c6133baccc62aacbe.tar.bz2 camu-197d41a3e23cab35848f623c6133baccc62aacbe.zip | |
OSD stuff and Android fixes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/render/shaders/osd.h')
| -rw-r--r-- | src/render/shaders/osd.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/render/shaders/osd.h b/src/render/shaders/osd.h new file mode 100644 index 0000000..1109a50 --- /dev/null +++ b/src/render/shaders/osd.h @@ -0,0 +1,73 @@ +static char osd_shader[] = \ +"float text(vec2 uv, vec2 pos1, vec2 pos2) {\n" +" float col = 0.;\n" +" pp = pos1;\n" +" if (connecting != 0u) {\n" +" float t = mod(time,1.8);\n" +" for (int i = 0; i < 3; i++) {\n" +" col += char(ch_per,uv)*float(t >= float(i)*0.6);\n" +" }\n" +" } else if (paused != 0u) {\n" +" col = char(ch_p,uv)+char(ch_a,uv)+char(ch_u,uv)+char(ch_s,uv)+char(ch_e,uv)+char(ch_d,uv);\n" +" }\n" +" pp = pos2;\n" +" if (negative != 0u) {\n" +" col += char(ch_dsh,uv);\n" +" }\n" +" if (show_hour != 0u) {\n" +" col += integer(num1,uv)+char(ch_col,uv);\n" +" }\n" +" col += integer(num2,uv)+char(ch_col,uv)+integer(num3,uv)+char(ch_lsl,uv);\n" +" if (show_hour != 0u) {\n" +" col += integer(num4,uv)+char(ch_col,uv);\n" +" }\n" +" col += integer(num5,uv)+char(ch_col,uv)+integer(num6,uv);\n" +" return col;\n" +"}\n" +"float text_over(vec2 uv, vec2 pos3) {\n" +" float col = 0.;\n" +" pp = pos3;\n" +" if (show_hour != 0u && bar_mode == 1u) {\n" +" col = integer(num7,uv)+char(ch_col,uv);\n" +" }\n" +" col += integer(num8,uv)+((bar_mode == 2u) ? char(ch_per,uv) : char(ch_col,uv))+integer(num9,uv);\n" +" return col;\n" +"}\n" +"vec4 draw_osd() {\n" +" vec2 sf = vec2(screen/scale);\n" +" vec2 ss = sf/3.;\n" +" vec2 c = vec2(coord.x,1.-coord.y);\n" +" vec2 uv = c*ss;\n" +" vec2 pos1 = vec2(8.,ss.y-4.-STRH(1.));\n" +" float width1 = (show_hour != 0u) ? 17. : 11.;\n" +" width1 += float(negative);\n" +" vec2 pos2 = floor(vec2(ss.x/2.-STRW(width1)/2.,ss.y/9.));\n" +" pos2.x -= STRW(0.5) * float(negative);\n" +" float ov = fract(bar);\n" +" ov = (-1.+(bar-ov)+float(c.x < ov))/1.5;\n" +" vec4 color = mix(bcolor,mix(tcolor,vec4(0.7,0.45,0.,1.),ov),float(c.x < bar));\n" +" float alpha = (c.x >= bar) ? 0.7 : 1.;\n" +" color = mix(color,vec4(tcolor.xyz,alpha)+float(bar > dbar)*0.15,float(c.x < dbar));\n" +" color = mix(color,vec4(tcolor.xyz,alpha-0.1)+float(bar > bbar)*0.15,float(c.x < bbar)*0.5);\n" +" color *= float(uv.y <= 5.);\n" +" if (paused != 0u) {\n" +" color = mix(color,bcolor,in_box(uv,pos1-vec2(2.,2.),pos1+vec2(STRW(6.)+1.,STRH(1.)+1.)));\n" +" }\n" +" color = mix(color,bcolor,in_box(uv,pos2-vec2(3.,1.),pos2+vec2(STRW(width1)+2.,STRH(1.)+2.)));\n" +" float pixel = text(uv,pos1,pos2);\n" +" color = mix(color,tcolor,pixel);\n" +" color -= pixel*float(mod(c.y*sf.y,3.) < 1.)*0.5;\n" +" if (bar_mode != 0u) {\n" +" ss = sf/2.;\n" +" uv = c*ss;\n" +" float width2 = (show_hour != 0u && bar_mode == 1u) ? 8. : 5.;\n" +" vec2 pos3 = floor(vec2(ss.x/2.-STRW(width2)/2.,11.));\n" +" float box = in_box(uv,pos3-vec2(2.,2.),pos3+vec2(STRW(width2)+1.,STRH(1.)+3.));\n" +" color.xyz = mix(color.xyz,bcolor.xyz,box);\n" +" color.w = color.w+(bcolor.w*box);\n" +" pixel = text_over(uv,pos3);\n" +" color = mix(color,tcolor,pixel);\n" +" color -= pixel*float(mod(c.y*sf.y,2.) < 1.)*0.5;\n" +" }\n" +" return color;\n" +"}\n"; |