Game Development Reference
In-Depth Information
15. After this, we're done and can call
removePreview
to discard
offScreeenView
:
app.getRenderManager().removePreView(offScreenView);
With the
Util
class done, we can create a screen
Controller
class. Perform the fol-
lowing additional six steps to do this:
1. Create a new class called
GameScreenController
that extends
NiftyController
.
2. For now, it only needs one public method called
createMinimap
that takes a
scene as the input.
3. The first thing the
createMinimap
method should do is call
Min-
iMapUtil.createMinimap
.
4. With the scene rendered, we can create
NiftyImage
with the
nifty.createImage
method.
5. Then, we can apply the image to our minimap element in the Nifty screen with
the following line:
screen.findElementByName("minimap").getRenderer(ImageRenderer.class).setImage(image);
6. Now, all we need to do is add a panel element called
minimap
to a screen that
uses
GameScreenController
as the controller.