将精灵数据和图像数据插入游戏中
我对我感兴趣的事情提出了一个简短的问题。
游戏软件设计师通常如何将精灵和图像数据(或纹理贴图等)插入到他们的游戏中?显然,我可以绘制一个我想在绘画或其他东西中使用的精灵,并将其保存为未压缩的图像类型,但是如何将其编译为作为 exe 一部分的机器代码/字节数据?有没有办法编写代码以将 bmp 等加载到机器代码中?
这方面的约定是什么?
谢谢!
右
I had a quick question about something I was curious about.
How would game software 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 AS3,您可以将图像作为资产包含在内,我的意思是只是一张常规图片,然后当任何编译器编译该项目时都会对其进行编译。
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++ 游戏很少将精灵数据或其他资源嵌入到可执行文件中。通常,它们与可执行文件一起写入文件系统或写入其他指定的数据位置。然后,它们在运行时通过通常的文件操作加载,并由可执行文件根据使用的格式进行解码。如果您尚未使用,通常会使用第三方图像处理库,例如 DevIL处理图像处理的多媒体库(例如SDL)。
可以使用 Visual C++ 的资源编辑器将某些类型的数据嵌入到可执行文件中。还可能有其他方法将其附加到可执行文件的末尾,或者将其转换为源代码中的内联数据,但这实际上并不经常执行。
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.