set display mode 800,600,32,1
set window on
load image "tile.bmp",1
load effect "fullscreen.fx",1,0
make object plain 1,2,2
texture object 1,1
set object effect 1,1
do
control camera using arrowkeys 0,100,1
position object 1,camera position x(),camera position y(),camera position z()
sync
loop
texture TileTX
<
string ResourceName="";
>;
sampler2D Tile=sampler_state
{
Texture=<TileTX>;
MagFilter=None;
MinFilter=None;
MipFilter=None;
};
struct InPut
{
float4 Pos:POSITION;
float2 UV:TEXCOORD;
};
struct OutPut
{
float4 OPos:POSITION;
float2 UV:TEXCOORD0;
};
OutPut VS(InPut IN)
{
OutPut OUT;
OUT.OPos=IN.Pos;
OUT.UV=float2(1-IN.UV.x,IN.UV.y)*float2(200,150);
// OUT.UV=((float2(IN.Pos.x,-IN.Pos.y)+1.0)*0.5)*float2(200,150); //alternative way
return OUT;
}
float4 PS(OutPut IN) : COLOR
{
float3 tile=tex2D(Tile,IN.UV);
return float4(tile,1);
}
technique Tile
{
pass p1
{
vertexShader = compile vs_3_0 VS();
pixelShader = compile ps_3_0 PS();
}
}