uniform int textSize < ui_type = "drag"; ui_min = 5; ui_max = 100; > = 0;
//3x5 num/char text
int getTextBit( int id ) {
int cText[10] = {
31599, 9362, 29671, 29647, 23497,//0,1,2,3,4
31183, 31215, 31305, 31727, 31689 //5,6,7,8,9
//expand char here
};
return cText[max(id, 9)];
}
float text(float2 uv, int n){
uv = 1.0 - uv;
float bit = pow(2.0, floor(uv.x*3.0) + 3.0*floor(uv.y*5.0));
uv = abs(uv - 0.5);
return step( 0.5, floor(float(getTextBit(n))/bit) % 2.0)*
step(uv.x, 0.499)*step(uv.y, 0.499);
}
#include "drawtext.fxh"
#include "ReShade.fxh"
float4 main_fragment( float4 position : POSITION,
float2 txcoord : TEXCOORD) : COLOR {
float res = 0.0;
int line0[9] = { __D, __e, __m, __o, __Space, __T, __e, __x, __t }; //Demo Text
int line1[15] = { __b, __y, __Space, __k, __i, __n, __g, __e, __r, __i, __c, __1, __9, __9, __2 }; //by kingeric1992
int line2[6] = { __S, __i, __z, __e, __Colon, __Space }; // Size: %d.
DrawText_String(float2(100.0 , 100.0), 32, 1, txcoord, line0, 9, res);
DrawText_String(float2(100.0 , 134.0), textSize, 1, txcoord, line1, 15, res);
DrawText_String(DrawText_Shift(float2(100.0 , 134.0), int2(0, 1), textSize, 1), 18, 1, txcoord, line2, 6, res);
DrawText_Digit(DrawText_Shift(DrawText_Shift(float2(100.0 , 134.0), int2(0, 1), textSize, 1), int2(8, 0), 18, 1),
18, 1, txcoord, 0, textSize, res);
return res;
}
technique Default //< enabled = true; >
{
pass
{
VertexShader = PostProcessVS;
PixelShader = main_fragment;
}
}