OK I know this is completely a newbie question, but I can't figure this out for anything. I have a SplashScreen class and it rendering looks off for some reason.
this is the SplashScreen class.
this is the original
and this is the how it is rendered.
[/img]
this is the SplashScreen class.
Code:
public class SplashScreen : IDisposable
{
private Device m_Device;
private Image m_Image = null;
private DateTime m_StartTime;
private DateTime m_EndTime = DateTime.Now;
private VertexBuffer m_VertexBuffer;
private bool m_Initialized = false;
private TimeSpan m_TimeLeft;
private CustomVertex.TransformedTextured[] m_VertexData;
public SplashScreen(Device _Device, string _Filename, byte _Duration )
{
this.m_Device = _Device;
this.m_Image = new Image(this.m_Device, _Filename);
this.m_StartTime = DateTime.Now;
this.m_EndTime = DateTime.Now.AddSeconds(_Duration);
this.m_VertexBuffer = new VertexBuffer(typeof(CustomVertex.TransformedTextured), 4, this.m_Device, Usage.WriteOnly, CustomVertex.TransformedTextured.Format, Pool.Default);
}
public bool Render()
{
try
{
bool FogState = this.m_Device.RenderState.FogEnable;
this.m_Device.RenderState.FogEnable = false;
this.m_VertexData = new CustomVertex.TransformedTextured[4];
this.m_VertexData[0].X = 0.0f;
this.m_VertexData[0].Y = 0.0f;
this.m_VertexData[0].Z = 1.0f;
this.m_VertexData[0].Tu = 0.0f;
this.m_VertexData[0].Tv = 0.0f;
this.m_VertexData[1].X = this.m_Device.Viewport.Width;
this.m_VertexData[1].Y = 0.0f;
this.m_VertexData[1].Z = 1.0f;
this.m_VertexData[1].Tu = 1.0f;
this.m_VertexData[1].Tv = 0.0f;
this.m_VertexData[2].X = 0.0f;
this.m_VertexData[2].Y = this.m_Device.Viewport.Height;
this.m_VertexData[2].Z = 1.0f;
this.m_VertexData[2].Tu = 0.0f;
this.m_VertexData[2].Tv = 1.0f;
this.m_VertexData[3].X = this.m_Device.Viewport.Width;
this.m_VertexData[3].Y = this.m_Device.Viewport.Height;
this.m_VertexData[3].Z = 1.0f;
this.m_VertexData[3].Tu = 1.0f;
this.m_VertexData[3].Tv = 1.0f;
this.m_VertexBuffer.SetData(this.m_VertexData, 0, 0);
this.m_Device.SetStreamSource(0, this.m_VertexBuffer, 0);
this.m_Device.VertexFormat = CustomVertex.TransformedTextured.Format;
this.m_Device.SetTexture(0, this.m_Image.Texture);
this.m_Device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
this.m_Device.RenderState.FogEnable = FogState;
}
catch(DirectXException Error)
{
Console.AddLine("Unable to display splash screen.");
Console.AddLine(Error.ErrorString);
}
catch(Exception Error)
{
Console.AddLine("Unable to display splash screen.");
Console.AddLine(Error.Message);
}
DateTime CurrentTime = DateTime.Now;
return (CurrentTime > this.m_EndTime);
}
public bool Initialized
{
get { return this.m_Initialized; }
set { this.m_Initialized = value; }
}
public TimeSpan TimeLeft
{
get { return this.m_TimeLeft; }
set { this.m_TimeLeft = value; }
}
public void Dispose()
{
this.m_Image.Dispose();
}
public void Restore()
{
if (this.m_Image != null)
{
this.m_Image.Load();
}
}
}
this is the original
and this is the how it is rendered.
[/img]