开发者

Inserting sprite data and image data into games

I had a quick question about something I was curious about.

How would game softw开发者_JAVA技巧are designers normally go about inserting sprites and image data (or texture maps,etc) into their games? Obviously I can draw a sprite I want to use in paint or something and save it as an uncompressed image type, but how do I make this compile into machine code / byte-data that is part of the exe? Is there a way to write code to have it load bmp's etc into machine code?

What is the convention for this?

Thanks!

R


With AS3 you can include the image as an asset, by which I mean just a regular picture, and then it will be compiled when whatever compiler compiles the project.


C++ games rarely embed sprite data or other assets into the executable. Typically they are written to the filesystem alongside the executable or to some other designated place for data. They are then loaded up at run time via the usual file operations, and decoded by the executable according to the format used. It's common to use a 3rd party image handling library for this, such as DevIL, if you aren't already using a multimedia library that handles image processing (eg. SDL).

It is possible to embed certain types of data into executables with Visual C++'s resource editor. There may also be other ways of appending it to the end of an executable, or converting it to data inline in the source code, but this really isn't done often.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜