Input key over-rides

I am trying to put an image on the screen when a cursor key is pressed (for example when the left arrow key is pressed). Is there an easy way to do this? (is there a test routine I can use?)

tomcat

An easy way would be to add the image as an ortho Quad, UIBillboard or whatnot to your scene. Set it to force cull true. Then, in your update, simply check for the key press… if it’s pressed, set force cull on your image to false. if not, set it to true. Here’s the catch: when you check the key press, make sure you ALLOW repeats in the check call. eg: (in your update method)


if (KeyBindingManager.getKeyBindingManager()
  .isValidCommand("show_image", true))  // TRUE being the important thing here.
    myImage.setForceCull(false);
else
    myImage.setForceCull(true);



That should give you the effect you are looking for. Of course, you'll need to setup the key command first: (in your init method)

KeyBindingManager.getKeyBindingManager().set("show_image", KeyInput.KEY_LEFT);