Chapter 2. Working with 2D Graphics

In this chapter, we will cover the following recipes:

  • Texture rendering with SpriteBatch
  • More effective rendering with regions and atlases
  • Taking advantage of Libgdx sprites
  • Rendering sprite-sheet-based animations
  • Understanding orthographic cameras
  • Using ShapeRenderer for debug graphics
  • Handling multiple screen sizes with viewports

Introduction

Games are interactive experiences that provide feedback to the player mainly through visual elements and audio cues. As a result, rendering becomes one of the most important pillars games are built upon. This chapter will take us on a journey through the basics of the Libgdx 2D graphics API.

You will learn how to efficiently render both static and animated sprites and handle the view with orthographic cameras. Moreover, we will present a series of solutions on how to deal with different screen sizes and resolutions, a very common problem when targeting tablets and phones.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.217.198