28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7 ■ The Foundation of Game Play Loop: The <strong>Java</strong>FX Pulse System and the Game Processing Architecture<br />

Figure 7-10. At the end of the .start() method, instantiate the gamePlayLoop object by using the <strong>Java</strong> new keyword<br />

The logic of this code placement (at the end), is to set up all your static objects, in terms of creation and<br />

configuration, and then create the dynamic object at the end that will be processing the pulse-related logic.<br />

Profiling the GamePlayLoop Object: Running NetBeans Profiler<br />

Let’s run NetBeans Profiler, using a Profile ➤ Project Profile menu sequence, to determine if you can see the<br />

GamePlayLoop object that you have created in any of the profiling views. As Figure 7-11 demonstrates, the<br />

GamePlayLoop call takes less than 2 milliseconds to set up the GamePlayLoop object in memory for your use,<br />

using very little overhead.<br />

Figure 7-11. Use a Profile ➤ Profile Project menu sequence to start the Profiler and look at GamePlayLoop memory use<br />

www.it-ebooks.info<br />

153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!