SDL-C++无法加载多于一张图像
我无法加载超过一个 png:事实上,唯一被破坏的图像是第一个加载的图像。没有错误。
boy = IMG_Load(strcat(imagedir,"boy.png"));
SDL_Rect boyrect = {0,0,50,50};
SDL_BlitSurface( boy, &boyrect, screen, NULL );
bar = IMG_Load(strcat(imagedir,"bar.png"));
SDL_Rect barrect = {0,-SCREEN_HEIGHT+150,SCREEN_WIDTH,SCREEN_HEIGHT};
SDL_BlitSurface( bar, &barrect, screen, NULL );
I can't load more than a png: indeed the only image to be blittered is the first to load. There's no error.
boy = IMG_Load(strcat(imagedir,"boy.png"));
SDL_Rect boyrect = {0,0,50,50};
SDL_BlitSurface( boy, &boyrect, screen, NULL );
bar = IMG_Load(strcat(imagedir,"bar.png"));
SDL_Rect barrect = {0,-SCREEN_HEIGHT+150,SCREEN_WIDTH,SCREEN_HEIGHT};
SDL_BlitSurface( bar, &barrect, screen, NULL );
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第二个参数是源中的 SDL_Rect,第四个参数是要粘贴的区域。
我想你想将每个 png 粘贴到屏幕的一部分。
The second argument is the SDL_Rect from source, and the fourth argument the zone to paste.
I think you want to paste each png in a part of the screen.