天天看点

SDL2.0多分屏显示

参考http://blog.csdn.net/leixiaohua1020/article/details/38868499

SDL_Rect用于确定SDL_Texture显示的位置。一个SDL_Texture可以指定多个不同的SDL_Rect.

SDL_Rect sdlRect;

sdlRect.x=0;

sdlRect.y=0;

sdlRect.w=screen_w;

sdlRect.h=screen_h;

SDL_Rect sdlRect2;

sdlRect2.x = screen_w;  //此处确定第二分屏显示位置

sdlRect2.y = 0;

sdlRect2.w = screen_w;

sdlRect2.h = screen_h;

SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, &sdlRect);

SDL_RenderCopy( sdlRenderer, sdlTexture, NULL, &sdlRect2 );