Jump to content
  • Advertisement
Sign in to follow this  
tentaculat

Can't get access to directx in VB

This topic is 3915 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've given up on VC++ for now because I realized that half my problems are with Visual Studio, and I had better sort those out before I try to fiddle with a new language. So I'm using VB.net 2005 which is something that I'm quite comfortable with. What I have: Blank project. Windows application. A single form. I've added Microsoft.Directx as a reference in the project. The description says that this is the version for managed code. Great. So I'm trying to access the object as showin in tutorials like so:
dim dx as Microsoft.Directx

As I'm typing that Visual Basic is showing me tooltips - it can see the DirectX reference - and the directX collection thing has a lot of stuff in there, but it doesn't like the above line at all. It says: Type expected. Which is maddening because all the tutorials I'm reading are using it like it is a type. Instead VB sees it as a namespace. What the hell am I doing wrong? What's even more infuriating is that the tutorials in the latest direct SDK, the single one that is supposedly for VB. actually uses C# code instead! So I can't even copy that because it's in a language I'm not familiar with. And from what I can tell, it's declaring variables as directx types anyway. Please help.

Share this post


Link to post
Share on other sites
Advertisement
The current official managed wrapper for DirectX is XNA; Managed DirectX 1 simply doesn't work properly under .NET 2.0 and Managed DirectX 2 throws a timebomb exception if you try and use it with your system clock past a certain date. XNA Game Studio Express only integrates with VC#EE, so the sample code is all in C#, but it shouldn't be too difficult to convert between the two. This site has some VB.NET tutorials for XNA.

If you linked to the tutorials you're using we can probably see what they're trying to do... Either way, Microsoft.DirectX is indeed a namespace, underneath which are more specific namespaces (Microsoft.DirectX.Direct3D) which will contain the classes and structures you'll need to use.

Share this post


Link to post
Share on other sites
Thank you for your help.

One thing confuses me though; I was able to reference the DirectX libraries, it just wasn't behaving the same way as it did in previous tutorials, hence my post.

I will certainly read up on that XNA tutorial you linked (another tutorial!!!), thank you. But I'm still a bit curious as to why Microsoft.DirectX is a namespace on my PC, when everyone else seems to use it as a type.

Share this post


Link to post
Share on other sites
Quote:
Original post by tentaculat
I will certainly read up on that XNA tutorial you linked (another tutorial!!!), thank you. But I'm still a bit curious as to why Microsoft.DirectX is a namespace on my PC, when everyone else seems to use it as a type.
Under Managed DirectX it is a namespace (Microsoft.DirectX on MSDN). I'd have to see these other tutorials to understand what you mean by trying to use it as a type.

Share this post


Link to post
Share on other sites
Ok screw trying to access directX like that, but I must say, that XNA tutorial that you linked really, really helped me. After downloading XNA, I was able to draw sprites wherever I wanted on screen.

All I've wanted to do for the past couple of days is draw some sprites on a screen. I'm so happy. Thanks again.

I should have looked into this earlier because XNA seems like a really nice platform for beginners like me to start game development. Best of all, I can use Visual Basic which I've used for years for database purposes so I'm pretty confident that I can easily handle most of the game logic now.

After I'm comfortable with XNA I'll move on to C# which seems to be the preferred language.

Ty again!

Share this post


Link to post
Share on other sites
Quote:
Original post by tentaculat
Ok screw trying to access directX like that, but I must say, that XNA tutorial that you linked really, really helped me. After downloading XNA, I was able to draw sprites wherever I wanted on screen.

All I've wanted to do for the past couple of days is draw some sprites on a screen. I'm so happy. Thanks again.

I should have looked into this earlier because XNA seems like a really nice platform for beginners like me to start game development. Best of all, I can use Visual Basic which I've used for years for database purposes so I'm pretty confident that I can easily handle most of the game logic now.

After I'm comfortable with XNA I'll move on to C# which seems to be the preferred language.

Ty again!

And once you learn C# you'll see how similar it is to VB so that switching form one language to the other is not difficult at all. There is even websites and automated tools that will do the conversion for you!
http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!