The Partridge Family were neither partridges nor a family. Discuss.
-
Asimov
- Posts: 814
- Joined: May 19th, 2012, 11:38 pm
Post
by Asimov » October 22nd, 2012, 11:08 pm
Hi Chilli,
Just been reading up on directx sprites. Here is a section of code for rendering sprites
Code: Select all
/// <summary>Renders the current frame.</summary>
/// <param name=”device”>The Direct3D device</param>
/// <param name=”elapsedTime”>Time elapsed since last frame</param>
public override void OnRenderFrame( Device device, float elapsedTime )
{
device.Clear( ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0 );
device.BeginScene();
// Clip…
// Render cats and Crono
m_sprite.Begin( SpriteFlags.AlphaBlend );
foreach ( Cat c in m_cats )
{
c.Draw( m_sprite, m_texCat, new Rectangle( 0,0, 32, 32), Color.White );
}
m_crono.Draw( m_sprite, m_tex );
m_sprite.End();
// Clip…
device.EndScene();
device.Present();
}
The m_sprite.begin and end are exactly how XNA does sprites.
What I am wondering chilli. Would the Chilli framework need to be totally rewritten to do directx spirtes, or can it use the current system of switching screen buffers?
-
LuX
- Posts: 1492
- Joined: April 22nd, 2012, 12:33 pm
- Location: Finland
Post
by LuX » October 23rd, 2012, 1:46 pm
Only the Graphics.cpp and .h part would have to be... Well, not completely rewritten as you could still use the old-school backbuffer to draw pixels, but you would just have to add a couple of things.
I'll see later if I can find from my history the tutorial I read about this stuff. Most of the part I didn't even understand but I got the general idea and after that I just explored all the functions and read what they do on microsoft page and pretty much figured all out like that.
ʕ •ᴥ•ʔ
-
Asimov
- Posts: 814
- Joined: May 19th, 2012, 11:38 pm
Post
by Asimov » October 23rd, 2012, 4:04 pm
Hi Lux,
I found few tutorials, but there seems to be a hell of a lot of typing to do heh heh, and I don't like adding stuff until I understand what they do. It is more important for me to understand.
-
chili
- Site Admin
- Posts: 3948
- Joined: December 31st, 2011, 4:53 pm
- Location: Japan
-
Contact:
Post
by chili » October 24th, 2012, 2:45 pm
Yeah, what LuX said. I haven't used D3DX sprite in a while but I think you can get away with using it without setting up the rendering pipeline and tranform matrices and stuff.
Chili