Archived

This topic is now archived and is closed to further replies.

Sheep

DirectX9 and C# using notepad?

Recommended Posts

Hello. I''m not sure this belongs in the DirectX forum but here it goes... I am going to give C# a try for DX development. However, I don''t have the money to go out buy Visual Studio .NET, and buying Visual C# would be a waste of my money right now. What I am wondering is if it is possible to develop DX apps using just notepad and the command line compiler. I tried compiling some of the examples, but obviously with no success. Could perhaps someone tell me what compiler options I need to compile DX programs if it is possible at all? I have looked around everywhere but I haven''t found anything. If the answer is obvious, just post a link or something and I''ll go away. Thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by Sheep
What I am wondering is if it is possible to develop DX apps using just notepad and the command line compiler.


It is perfectly possible. However, in their infinite wisdom, MS decided that the C# help files in the DX SDK only should be available through the VS.NET help system. This leaves you with two options:
o Use the online documentation on the MSDN website.
o Find some way of opening the help files anyway - I''m sure it''s possible. dexplore.exe is the viewer for that kind of documentation
quote:

I tried compiling some of the examples, but obviously with no success. Could perhaps someone tell me what compiler options I need to compile DX programs if it is possible at all?


You need to add references to the DirectX assemblies. If your SDK installation went well(mine didn''t), this should be sufficient:

csc /r:Microsoft.DirectX.dll /r:Microsoft.DirectX.Direct3D.dll YourFile1.cs YourFile2.cs

In case it didn''t go well, you may need to copy the assemblies out of the GAC yourself. This can only be done from the command line, since there is a special shell extension in Explorer that prevents you from doing file operations directly in the GAC.

Go to \%windir%\Assembly\GAC. There you will find one dir for each of the DirectX assemblies. The actual dir is one subdirectory beneath this dir again. Copy them out one by one like this:

copy Microsoft.DirectX\5.2.3693.172__d3231b57b74a1492\Microsoft.DirectX.dll \someplace

You will now probably have to supply a full path to the references when compiling from the command line.

If you are going to do a lot of compiling from the console, may I suggest you look into NAnt[1]? It is somewhat like make, only infinitely more elegant and will make your life a lot easier once you learn it.

[1]nant.sourceforge.net



For those who believe in God, most of the big questions are answered. But for those of us who can''t readily accept the God formula, the big answers don''t remain stone- written. We adjust to new conditions and discoveries. We are pliable. Love need not be a command or faith a dictum. I am my own God. We are here to unlearn the teachings of the church, state, and our educational system. We are here to drink beer. We are here to kill war. We are here to laugh at the odds and live our lives so well that Death will tremble to take us -- Charles Bukowski

Share this post


Link to post
Share on other sites
Hehe, yeah, I found that a few hours after my original post. Where does it say that it can import VS.NET projects though? Looks to me like they have their own format. Also, I am still having trouble getting the DirectX assemblies to include. Actually, its more that I don''t where I set the paths in VS.NET (the interface of SharpDevelop and VS.NET is almost identical)

Share this post


Link to post
Share on other sites
Oh yeah .... the key is that SharpDevelop is an open source program... so is the importer/exporter ..... so.....

http://sourceforge.net/ (lots of C# stuff on here btw)

But to save you the search....
http://sourceforge.net/projects/sd-vsnetplugin/


Personally I don''t use it.... but it should be simplicity to get DX samples up and running in it (unlike Notepad)

The forums for sharp develop are quite helpful if you get real stuck.

Share this post


Link to post
Share on other sites
Hmmm - while looking for something else I found this in the DX9 readme....

>>Managed DirectX ( MDX ) requires both Visual Studio .NET and the .NET framework for development.

Not sure if it is true as I''m only using VS.NET - the forums at SharpDevelop may be able to assist if you can''t get it working right off.

Share this post


Link to post
Share on other sites
Well, I am having trouble with the command line again

From where can I "access" the assemblies? Can I just be in the project folder? When I try doing

  
csc /r:Microsoft.DirectX.dll /r:Microsoft.DirectX.Direct3D.dll CreateDevice.cs

from inside the C#\Direct3D\Tutorials\Tutorial1, I get the errors:

"Metadata file ''Microsoft.DirectX.dll'' could not be found"
"Metadata file ''Microsoft.DirectX.Direct3D.dll'' could not be found"

Is this an indicator that I am compiling it wrong or that the SDK didn''t install correctly? (I can compile fine from "SharpDevelop", but it is devilishely slow on my computer).

Share this post


Link to post
Share on other sites
Read that part above about copying the assemblies out of the GAC and giving full paths when you /r: them.



I''ve looked at the source, and there are pieces that are good and pieces that are not ... My experience and some of my friends'' experience is that Linux is quite unreliable. Microsoft is really unreliable but Linux is worse. -- Ken Thompson

Share this post


Link to post
Share on other sites
Gah!!!

No luck in copying them. If I don't get it soon, I will probably email you Arild . However, I did find the dll's under WINDOWS\Microsoft.NET\Managed DirectX\v4.09.00.0900
Is this of any significance?

[edited by - Sheep on December 28, 2002 9:41:59 PM]

Share this post


Link to post
Share on other sites
Thats where they should be. Try using the full path to that directory when you reference the DLLs.



I''ve looked at the source, and there are pieces that are good and pieces that are not ... My experience and some of my friends'' experience is that Linux is quite unreliable. Microsoft is really unreliable but Linux is worse. -- Ken Thompson

Share this post


Link to post
Share on other sites
Since I never received a mail, I can only assumed you didn''t remove the spamguard in my email address - the "remove.me" part. Anyway - the following commandline works for me:


K:\dx9sdk\Samples\C#\DirectDraw\SpriteAnimate>csc SpriteAnimate.cs ..\..\Common\
DXUtil.cs /r:"F:\WINDOWS\Microsoft.NET\Managed DirectX\Microsoft.DirectX.dll" /r
:"F:\WINDOWS\Microsoft.NET\Managed DirectX\Microsoft.DirectX.DirectDraw.dll"
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.


K:\dx9sdk\Samples\C#\DirectDraw\SpriteAnimate>

Note that you have to include the DXUtil.cs file from the toplevel Common directory to get it to build. For other samples you might have to include other files from there as well.



I''ve looked at the source, and there are pieces that are good and pieces that are not ... My experience and some of my friends'' experience is that Linux is quite unreliable. Microsoft is really unreliable but Linux is worse. -- Ken Thompson

Share this post


Link to post
Share on other sites