Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Proof of problem with sprites DX9.0C?

 

The following program is just a simple WindowsApplication with the following adjustments

//Add Refrecnce to Directx,Direct3d,Direct3dx
...
using Microsoft.Directx;
using Microsoft.Direct3D;
...
Device dev;
Sprite s;
Texture t;
public Form1()
{
InitializeComponent();
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;
pp.BackBufferHeight = 768;
pp.BackBufferWidth = 1024;
this.Show();
dev = new Device(0,DeviceType.Hardware,this,CreateFlags.SoftwareVertexProcessing,pp);
dev.RenderState.Lighting = false;
s = new Sprite(dev);
t = TextureLoader.FromFile(dev,"C:\\Test.bmp");
Render();
}
void Render()
{
for(int i = 0;i<600;i++)
{
	dev.Clear(ClearFlags.Target,Color.Black,0,0);
	dev.BeginScene();
	s.Begin(SpriteFlags.None);
	s.Draw2D(t,new Point(32,32),0,new Point(32,32),Color.White);
	s.Draw2D(t,Rectangle.Empty,Rectangle.Empty,new Point(512,384),Color.White);
	s.End();
	dev.EndScene();
	dev.Present();
	Application.DoEvents();
}
}

Note The Form is set to start Maximized.

The above code does indeed render both sprites fine, however if I comment out the first s.draw2d neither render!

Problem is that i want to draw my sprites using the second type of rendering but it doesnt seem to draw without the other being called first!

Edited by rifter1818
Posted

hmm, why don't you try transforming and/or scaling the world (if they're different sizes) rather than than drawing 2..

 

btw, could you please explain what these arguments are:

s.Draw2D(t,new Point(32,32),0,new Point(32,32),Color.White);

s.Draw2D(t,Rectangle.Empty,Rectangle.Empty,new Point(512,384),Color.White);

 

Im confused as to which is Width/Height and which is x,y,z

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...