两张图片轮替显示,为什么只能显示第一张,求大神指导指导
sdl吧
全部回复
仅看楼主
level 5
hhkern 楼主
2015年12月15日 12点12分 1
level 5
hhkern 楼主
#include <SDL2/SDL.h>
#include <SDL_image.h>
SDL_Window *wind;
SDL_Renderer *rend;
SDL_Texture *text;
SDL_Surface *surf = NULL;
int init();
void drea(char *img);
void flash();
// //////////////////////////
int main()
{
init();
drea("/storage/emulated/0/9/X.png");
SDL_Delay(2000);
drea("/storage/emulated/0/9/'A.png");
SDL_Delay(2000);
}
// ////////////////////////////////
int init()
{
SDL_Init(0xffff);
wind = SDL_CreateWindow("窗口标题", 0, 0, 488, 400, 0);
rend = SDL_CreateRenderer(wind, -1, 1);
return 0;
}
// ++++++++++++++++++++++
void drea(char *img)
{SDL_RenderClear(rend);
surf = IMG_Load(img);
text = SDL_CreateTextureFromSurface(rend, surf);
SDL_FreeSurface(surf);
SDL_RenderCopy(rend, text, NULL, NULL);
SDL_RenderPresent(rend);
}
2015年12月15日 12点12分 2
level 1
0基础想自学编程从哪开始0基础想自学编程从哪开始
2019年11月20日 05点11分 10
level 2
我爱你
2019年11月29日 12点11分 11
level 2
我爱你
2019年12月03日 06点12分 15
level 2
产品经理学习应该怎么做?
2020年01月15日 11点01分 42
level 5
up
2020年02月19日 10点02分 49
level 4
你需要在第一张照片渲染过后清空上一张照片,然后,在刷新渲染器。
2020年02月20日 09点02分 51
1