"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched c-beams glitter in the dark near Tanhauser Gate. All those moments will be lost in time, like tears in rain. Time to die." —Blade Runner


Programming graphics is of the utmost importance in games programming. In most circumstances this is the most time-consuming part of your game loop, and it is essential that it is as efficient as possible. In this chapter you will learn the major aspects of coding 2D graphics in Java. We will first take a look at creating and loading graphics. Then we will look at manipulating graphics, beginning with rendering, where you will be introduced to making a game loop. We will then look at some important new features to Java 1.4, such as the BufferStrategy class and full-screen exclusive mode. We will also pay particular attention to apps and applets throughout the chapter, showing you the few differences in getting your games working in terms of graphics.