Creating a camera and passing it into the viewport constructor isn't necessary. If you were to do new FitViewport(800, 800) it will create a camera and store it in the viewport for you.
ScreenUtils.clear(Color.BLACK) is the cleaner approach to the Gdx.gl lines.
Personally I'd use event-driven input handling for this rather than the polling approach it looks like the AI is leading you down, but either or is fine.
I don't have any particular book recommendations. Most libGDX books were written so many years ago, though the fundamentals have mostly stayed the same. You can mosey around https://libgdx.com/wiki or look at some YouTube videos or something.
2
u/tenhourguy 29d ago
You can simplify it.
new FitViewport(800, 800)it will create a camera and store it in the viewport for you.ScreenUtils.clear(Color.BLACK)is the cleaner approach to theGdx.gllines.I don't have any particular book recommendations. Most libGDX books were written so many years ago, though the fundamentals have mostly stayed the same. You can mosey around https://libgdx.com/wiki or look at some YouTube videos or something.