# Libgdx - Viewport for Tetris-style game [duplicate]

I'm a beginner in libgdx, and I'm trying to create my first game. It's pretty simple, circles are falling from the top and sides of the screen, and the user needs to "blow" them before they touch the ground. It is a single screen game, where the world isn't moving, like Tetris.

My problem is that I'm having bad time understanding what viewports should I use, and when.

So, what viewport should I use for this type of game, without generating black bars or stretching the graphics? Will it be possible to check the screen width and height, and act accordingly? let's say the screen is 400x800, can I save it in the code and just spawn the circles out of the screen?

Again, I don't want my graphics to be stretched, since the circles will look weird.

Thanks.

• This question has been asked a lot. – Vaillancourt Oct 31 '15 at 12:25

You might want to use a ScreenViewport or ExtendedViewport. See the libgdx wiki.
You can access the screen size with Gdx.graphics.getXXX() where XXX is either width or height, so you can use this information to spawn your circles outside the current view.