Archived

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

HuaHsin

How to import graphics and sound into game ?

Recommended Posts

Hi! I got 2 question to ask. 1) How can I import a graphics (jpg and animation) and sound (mp3, wav or midi) into a game which is create in VC++ and VB6. 2) I know the software called MAYA and 3D Studio MAX, what I desire to do is create an animation or movie and then import into game. But I don''t know how to import? Can anyone teach me or any suggestion to import animation and sound? Hope you will help me. Thank you. KOK@HOE

Share this post


Link to post
Share on other sites
This is quite a complex request. So it can''t be summed up in a single message board post however I can give you the steps envolved.

#1. Search the net for the file formats you wish to use. (www.wotsit.org has a pretty complete list).
#2. Now that you know what the file format looks like it''s time to move on. Next step is to Open the file using a C command like fopen(). The file is in binary format so you want to use the "rb" parameter in Fopen which stands for Read Binary.
#3. Now the file is opened, you can create a structure which represents the data. Example (if the file format says that the first element in the file format is a integer, and the second is a float) struct OpenFile { int FirstFileParameter; float SecondFileParameter; }; (usualy file formats are more complex than this)

#4. Now it''s time to read in the data to the buffer. We''ll use a C command called fread(&OpenFile, sizeof(OpenFile), 1);
Now everything that was in the file is in the OpenFile structure.

#5. Close the file, using a command like fclose();

Now everything is in memory. And from that point on it''s up to you to determine how to play it, or display it on the screen.


Share this post


Link to post
Share on other sites