Image File Extension .dds

My problem surface, when I need to add image file, say texture1.dds to my game project.

WindowsGame1

Add

Existing Item...

then from the dialog I select

Files of type

Image Files (*.gif,*.jpg,*.jpe,*.png,*.bmp,*.dib,*.tif,*.wmf,*.raw)

So my problem is missing image file type *.dds. DX Tool creates it and is supported by XNA Texture2D.FromFile(). Is there published solution avaible or should I change with hexeditor for example *.jpe (never seen jpeg files with this extension) to *.dds If I hard code extension, then where lives dialog recource

Any comments will do

Peca




Answer this question

Image File Extension .dds

  • PaulYuk_MS

    Of course File Name only contains the file name. Check the Full Path property (see link). And the Add New Item does contain an All Files selection (see the link below).

    http://home.comcast.net/~machaira/fullpath.JPG

    http://home.comcast.net/~machaira/allfiles.JPG



  • BJHop

    Or just drag the file into your project from Explorer.

  • Hawkson

    Sorry, but drag&drop don't work. If you look "File Name" property, you see only pure file name without path. When you try to build project, compiler can't find your dropped file if it's not in your project foulder initially!

    Peca



  • DaPosh

    Peca55 wrote:
    So you have not yet developed XNA games with .dds transparent sprites. Add Existing File ... dialog

    Yes, I have.

    Peca55 wrote:
    You can verify situation. Open Visual C#, greate new project from XNA Windows Game template , add image file to solution and check properties. If you add normal jpg or bmp file using Add Existing Item, then File Name property has full qualified filename with path. Try dropping an other texture and look difference.

    I don't understand what you're saying. I created a new project, dragged a texture file (dds file) into the project from another, set the "Copy to Output Directory" to "Copy Always", added the following code:

    private SpriteBatch _batch;

    private Texture2D _sprite;

    //add to the game object's constructor

    _batch = new SpriteBatch(this.graphics.GraphicsDevice);

    _sprite = Texture2D.FromFile(this.graphics.GraphicsDevice, "sprites.dds");

    //add to the game's Draw method:

    _batch.Begin(SpriteBlendMode.AlphaBlend);

    _batch.Draw(_sprite, new Rectangle(0, 0, 128, 128), new Rectangle(0,0,128,128), Color.White);

    _batch.End();

    and it worked just fine. I did save the project after adding the code however. You won't get the FullPath project until then because, of course, there is no path until you save it. It's all in memory.



  • beechum1

    Sounds easy, but there is no such a option as "All Files". Try to use dialog youself and then throw something useful idea!

    Peca



  • Fuzon

    Perry, Everyone else uses All files. Try the draggin from explorer tip.

  • tempgp

    Umm, why not just choose "All Files" for the file type

  • allison_h

    I just say "Add Existing Item" Then in the File name field type "*.*" and click Open. Now you'll see everything.


  • Image File Extension .dds