将图像加载到数组中
我如何将某些图像加载到数组集中,就像
Map = ( ( 1, 1, 1 ), ( 2, 2, 2 ), ( 3, 3, 3 ) )
我可以将
图像放入变量中一样
one = oslLoadImageFile("one.png", OSL_IN_RAM, OSL_PF_5551);
那么我是否能够做类似 Map = ( ( one, one, one ) ) 之类的事情
,如果每个图像都是 32x32 ,它是否能够并排而不是前面的像素
抱歉,我仍在学习并尝试复习一些我心中的基础知识
How would I load certain images into an array set like
Map = ( ( 1, 1, 1 ), ( 2, 2, 2 ), ( 3, 3, 3 ) )
I can put
images into variables like so
one = oslLoadImageFile("one.png", OSL_IN_RAM, OSL_PF_5551);
so whould I be able to do something like Map = ( ( one, one, one ) )
and if each image was 32x32 would it be able to be side by side rather then a pixal ahead
Sorry im still learning and trying to go over some basics in my hea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎您使用 C++ OldSchool Library for PSP。 根据其文档,您应该创建一个图像文件,其中应包含一组图像,然后您就可以用它创建地图。
看起来这个库的用途非常有限,最好在其 论坛。
Seems to be that you use C++ OldSchool Library for PSP. According to its documentation you should create one image file which should contain set of images and then you'll be able to create map with it.
It looks like this library has a very limited usage and it will be a good idea to ask your question on its forum.
听起来您想为 2D 游戏构建一个图块地图。 在这种情况下,您可能希望有一个包含所有图块的精灵。 然后,地图将包含特定图块的索引。
当需要绘制图块时,您可以根据图块索引复制精灵的部分内容。
如果您有一个精灵图像,其图块索引如下:
您可以使用类似这样的方法来计算要为每个图块索引复制的矩形:
It sounds like you're wanting to build a tile map for a 2D game. In that case, you would want to have a single sprite containing all of your tiles. The map would then contain indices for specific tiles.
When it comes time to drawing the tiles, you'd copy portions of the sprite based on the tile index.
If you had a sprite image with tiles indexed as follows:
You could use someting like this to calculate the rectagle to copy for each tile index: