Sign in to follow this  

C#/MDX - Creating a Wrapper

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi GameDev community, I've been deciding for a long time what a good language would be for me to move into after using DarkBasic for 2 years, and I settled on C#. I've been using C# for about a month, and have recently decided to dab into Managed DirectX. As I go through the tutorials, I am getting tired of typing out everything many times. I now ask what would be the best way to make a wrapper for Managed DirectX in C#? Former DirectX users may grimace, as MDX is much easier in their eyes already, but as I newcomer I want to simplify things a little more. I'm not planning on making anything graphically demanding, so any performance hit(0-2% I'd assume), in using a wrapper wouldn't be a great deal to me for now. So a quick outline of what I'm asking: -What's and how should I go about making a MDX wrapper in the best way for C#? Thanks for your help. [EDIT] Reasons for me wanting to do this, is to help make C# even more RAD. I also admit, I might slightly lazy as well. ;)

Share this post


Link to post
Share on other sites
Quote:
As I go through the tutorials, I am getting tired of typing out everything many times.

What, exactly, is "everything"? If, for instance, you're writing an engine, then your engine effectively becomes the "wrapper" for MDX. I'm not sure why you need another layer on top of that.

Share this post


Link to post
Share on other sites
Here's a couple examples of what I mean.

Like here's the part where the triangle is created.


(Source from Microsoft's Summer SDK)
public void OnCreateVertexBuffer(object sender, EventArgs e)
{
VertexBuffer vb = (VertexBuffer)sender;
GraphicsStream stm = vb.Lock(0, 0, 0);
CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3];

verts[0].X=150;verts[0].Y=50;verts[0].Z=0.5f; verts[0].Rhw=1; verts[0].Color = System.Drawing.Color.Aqua.ToArgb();
verts[1].X=250;verts[1].Y=250;verts[1].Z=0.5f; verts[1].Rhw=1; verts[1].Color = System.Drawing.Color.Brown.ToArgb();
verts[2].X=50;verts[2].Y=250;verts[2].Z=0.5f; verts[2].Rhw=1; verts[2].Color = System.Drawing.Color.LightPink.ToArgb();
stm.Write(verts);
vb.Unlock();
}



Why not just have a command specifiing the triangle's size?

Something like...

MakeTriangle(Vert1X,Vert1Y,Vert1Z,Vert2X,Vert2Y,Vert2Z,Vert3X,Vert3Y,Vert3Z)



Of course you'd lose some functionality, and a little bit of control. Like I said though, that's not as important as RAD to me right now.

Sorry if I was unclear, or still am. Please post if you can help, or need me to explain further.

Thank you.

[EDIT] Basically this will be a wrapper for those who want to utilize D3D easily, and not worry about all the backround stuff. So it will be RAD for me, and easy for all others who want to use it.

[Edited by - Basic on January 1, 2005 9:01:10 PM]

Share this post


Link to post
Share on other sites

This topic is 4734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this