The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
[2.0.4]-How To Clip Standard SDL2 Drawing Area?
JeZ-l-Lee


Joined: 20 Sep 2009
Posts: 572
Location: Long Island, New York, United States, Earth
Hi,

I've been away a very long time...but I have returned to SDL2.
Is there a way to clip the standard SDL2 drawing area?
I wish to make a 4 player simultaneous game with 4 separate player screens.
How can I clip the SDL2 drawing area when drawing each individual player screen?
(all 4 player screens would be on one large game window)
Thanks!
Re: [2.0.4]-How To Clip Standard SDL2 Drawing Area?
JeZ-l-Lee


Joined: 20 Sep 2009
Posts: 572
Location: Long Island, New York, United States, Earth
JeZ-l-Lee wrote:
Hi,

I've been away a very long time...but I have returned to SDL2.
Is there a way to clip the standard SDL2 drawing area?
I wish to make a 4 player simultaneous game with 4 separate player screens.
How can I clip the SDL2 drawing area when drawing each individual player screen?
(all 4 player screens would be on one large game window)
Thanks!
Hi Again,

Would: "SDL_RenderSetViewport()" do the above?
https://wiki.libsdl.org/SDL_RenderSetViewport?highlight=%28%5CbCategoryRender%5Cb%29%7C%28CategoryEnum%29%7C%28CategoryStruct%29
I don't have a running alpha version to test it yet.
(will be using a modified version of the "TetriCrisis 4 110% A.I. Turbo" game engine)
Thanks!

Here is the title screen logo:

(made in Microsoft Office 2013 Publisher exported to NeoPaint 5)
Naith


Joined: 03 Jul 2014
Posts: 158
SDL_RenderSetViewport() function will indeed do what you want. Check out this tutorial for more information: http://lazyfoo.net/tutorials/SDL/09_the_viewport/index.php
[2.0.4]-How To Clip Standard SDL2 Drawing Area?
Jonny D


Joined: 12 Sep 2009
Posts: 932
If you want clipping instead of a viewport, use SDL_RenderSetClipRect():https://wiki.libsdl.org/SDL_RenderSetClipRect



Jonny D




On Sun, Jun 19, 2016 at 4:38 PM, Naith wrote:
Quote:
SDL_RenderSetViewport() function will indeed do what you want. Check out this tutorial for more information: http://lazyfoo.net/tutorials/SDL/09_the_viewport/index.php


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org