天天看點

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 );