Jump to content
  • Advertisement
Sign in to follow this  
shroomy_bee

?Supported image and audio file formats for C#

This topic is 3693 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 done a bit of computer animation and digital music making, and am wondering if there are image and audio formats I can import into C#?, eg - say I had an object (like a ship) with behaviors (and presume it's been coded so it has a movement path and instructions on when and where to appear, and its bullet pattern) what I'd like to do is along these lines: when the object moves right it will display with an image of that object moving right, when it moves left the image is changed to the object moving left, and up and down are the same as stationary. Can I associate pre-drawn images to events that way, and what image file formats can be used? (It'd just be handier for me if I could use image formats I am used to drawing with in 2D packages; the amount of info on making the games is so large I have trouble filtering through it to find exactly what I'm looking for) Similar question for audio file formats - what ones are supported? Thanks.

Share this post


Link to post
Share on other sites
Advertisement

Don't be put off by the big eye post icon, I just have a thing about eyes.

So - does nobody here know, or have I posted in the wrong forum, or is the answer really obvious and anyone that read my question are thinking 'geez how can you not know what programming languages have that feature dude?'

Share this post


Link to post
Share on other sites
You can load images with a variety of APIs. The ones that come standard in the .NET framework (in the System.Drawing namespace) can load a variety of common formats (thought not all). See here.

Share this post


Link to post
Share on other sites
Here's the thing: every single image and audio format on the planet can be used with C#. In C# you can write a program that when an object is moving right you use one image and when an object is moving left you use another image.

However, and this is a big however, you the programmer need to do work to make any of that happen. The C# language specification does not contain the word "image" a single time. The same with the word "audio". C# is one of the easier programming languages to learn how to use, but it's still a general purpose programming language. If you display an image, you need to either write the code to load the image from a source yourself or use a library that provides that functionality.

So the kind of questions that make sense are more along the lines of "using C# and XNA what images files are supported?" or "using C# and SlimDX..."

Share this post


Link to post
Share on other sites
So you mean that where it says 'Image object' here,

http://msdn.microsoft.com/en-us/library/ms533830(VS.85).aspx

it's only talking about C++ and not C#.

That is the kind of thing I was meaning, about using pre-drawn images.

I'm learning C# for a class; it's not that I picked it thinking it'd be best for game coding, but I was kinda hoping it had the functions like the link there has for C++.





Share this post


Link to post
Share on other sites
As SiCrane said, there is absolutely no limit to the multimedia formats you can use with C#. However, image support in .NET is Jpeg/Gif/Png/Tif/Raw/Bmp, and probably native as the GIF and JPG files are of similar quality to those exported by MS Paint.
.NET audio support is EXTREMELY limited, only PCM and MIDI files can be played.

However several external libraries are available, an example is to use LAME with .NET's unmanaged code interopability. Unfortunately many of these Unmanaged to Managed require hundreds, even thousands of lines of code. However, you can easily find samples across the internet.

Hope I was helpful.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!