Sign in to follow this  

Adding Managed DirectX in MS Visual C# 2005 Express Beta?

This topic is 4713 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

I loaded some samples from the SDK document and it works fine on this compiler. The only problem is I'm new to this compiler (obviously, its a beta), so I'm not entirely sure how to add Managed DirectX into the compiler. I should be able to type... using Microsoft.DirectX; in this compiler, but there's nothing partaining to .DirectX in it. Any advice will be helpful. Phil

Share this post


Link to post
Share on other sites
Sup Homey!

Sorry I haven't been on-line this weekend, didn't get to do much on the ole' PC. Anyways, look in the Solution Explorer window for a folder called 'References'. Right click on the folder and choose the 'Add Reference' option. This will open a dialog box. Click the Tab labeled '.NET', and scroll down the list until you see the Microsft.DirectX section. Ctrl+click all of the ones you want to add to your project (I always add .DirectX, .DirectX.Direct3D, .DirectX.AudioVideoPlayback, .DirectX.Direct3DX, .DirectX.DirectInout, and .DirectX.DirectSound), then click 'OK'. This will add the .dll's to you project. You will now be able to use the 'using' keyword to refernce the namespaces. I'll probably be on IM a little later this afternoon. Holla, if you gat a question.

Later,
D

Share this post


Link to post
Share on other sites
I'm getting some errors while compiling.


#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;
using Microsoft.DirectX.Diagnostics;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.DirectDraw;
using Microsoft.DirectX.DirectInput;
using Microsoft.DirectX.DirectPlay;
using Microsoft.DirectX.DirectSound;
#endregion

namespace MDX_Application
{
partial class Form1 : Form
{
public Form1()
{
// testing now
InitializeComponent();
}

// creating the DirectX device
private Device display;
// create front surface
private Surface front = null;
// create back surface
private Surface back = null;
}
}


Errors:
Error 1
'Device' is an ambiguous reference between 'Microsoft.DirectX.Direct3D.Device' and 'Microsoft.DirectX.DirectDraw.Device' C:\Documents and Settings\Owner\My Documents\Visual Studio\Projects\MDX Application\MDX Application\Form1.cs 35 16

Error 2
'Surface' is an ambiguous reference between 'Microsoft.DirectX.Direct3D.Surface' and 'Microsoft.DirectX.DirectDraw.Surface' C:\Documents and Settings\Owner\My Documents\Visual Studio\Projects\MDX Application\MDX Application\Form1.cs 37 16

Error 3
'Surface' is an ambiguous reference between 'Microsoft.DirectX.Direct3D.Surface' and 'Microsoft.DirectX.DirectDraw.Surface' C:\Documents and Settings\Owner\My Documents\Visual Studio\Projects\MDX Application\MDX
Application\Form1.cs 39 16


EDIT: It looks like I can't add all of those directives at the same time. By just applying .DirectX and .DirectDraw, it compiles fine.

Share this post


Link to post
Share on other sites
Heya,

You have several ambiguous references, there is a device class in several namespaces including DirectDraw and DirectSound. When you try to create a new instance of the device class you have to tell the compiler which namespace you are using. Personally i use aliases so you don't have to fully qualify everything.

using DDraw = Microsoft.DirectX.DirectDraw;

then to declare a new directdraw device you would just need to do this.

DDraw.Device draw = new DDraw.Device(form);

if you don't use aliases then you need to fully qualify everything like so

Microsoft.DirectX.DirectDraw.Device draw = new Microsoft.DirectX.DirectDraw.Device(form);

If you vivist my site, www.monkeycmonkeydo.co.uk you'll find a very brief introduction to DirectX, the site's still in production so be patient with us. Any comments you've got on our site would be appreciated, you'll find my email address on any of the Kev email links.

Hope i was able to help.

Cheers

Kev

Share this post


Link to post
Share on other sites

This topic is 4713 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