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-7. Take a coding shortcut: press Alt+Enter to bring up a helper dialog, and select Implement all abstract methods<br />

Note that the an @Override keyword precedes the public void handle method access keyword, return type<br />

keyword, and method name. This tells the <strong>Java</strong> compiler that your .handle() method is going to replace (override)<br />

AnimationTimer’s .handle() method, which is why the error indicates that you have to override abstract method<br />

.handle(long).<br />

You certainly do not want your .handle() method to throw 60 UnsupportedOperationException() errors every<br />

single second of your game loop; however, you are going to leave this in there for now so that you can see what it does<br />

and also learn a bit more about the NetBeans error console.<br />

As Figure 7-8 demonstrates, once you select the Implement all abstract methods option, the <strong>Java</strong> code is error<br />

free, and the basic package-import-class-method structure for the class is in place. Now, you should be able to create<br />

a GamePlayLoop object using this class, so let’s switch gears and do some programming in the InvinciBagel <strong>Java</strong> class,<br />

in which you create a GamePlayLoop object, and then profile the application to see what it does.<br />

Figure 7-8. NetBeans creates a public void handle(long now) bootstrap method with UnsupportedOperationException<br />

www.it-ebooks.info<br />

151

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

Saved successfully!

Ooh no, something went wrong!