Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Group,

I am new to DirectX and I am stuck in one basic scenario. So my requirement is -
I am having C# Windows Form. Now on top of that form I have to Slide one Image on top of another Image. Both Images are passed to my this translating class.
I used the concept of Sprite after going through the online Samples. But the problem is when the Sprite is moving the background is set to the color which is provided in the Device.Clear() method. I didn't find any way by which I can overcome this. There is no way to set the background image of the Device too.

I also tried using the concept of Microsoft.DirectX.DirectDraw.Surface too. PFB the code which I tried -

// Code Snippet Begin
SurfaceDescription description = new SurfaceDescription();

description.SurfaceCaps.PrimarySurface = true;
description.SurfaceCaps.Flip = true;
description.SurfaceCaps.Complex = true;
description.BackBufferCount = 1;

m_PrimarySurface = new Surface(description, m_Device);
description.Clear();
description.SurfaceCaps.BackBuffer = true;
m_SecondarySurface = m_PrimarySurface.GetAttachedSurface(description.SurfaceCaps);

description.Clear();
description.SurfaceCaps.OffScreenPlain = true;

m_ImageSurfaceurface = new Surface("MyImage.jpg", description, m_Device);
// Code Snippet End

But here the line -

m_ImageSurfaceurface = new Surface("MyImage.jpg", description, m_Device);

is giving build error without any explanation why.

So I am in a stuck state. Please Help...

Note - I have DirectX 9.0 SDK installed.

Thanks in advance...
Shubhanshu
Posted
Comments
Sergey Alexandrovich Kryukov 27-Dec-12 0:40am    
Why using DirectX directly, which is not that easy, if you can use WPF instead of forms? How about that?
—SA
Shubhanshu Pathak 27-Dec-12 2:20am    
Thanks for the reply Sergey. My initial approach was using WPF only. I achieved the functionality as well but the Memory consumption was too much and was not acceptable. So the next probable solution was using DirectX. Hence I went for it.
Shubhanshu Pathak 4-Jan-13 5:22am    
Can someone please help...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900