I am experimenting using niftygui in an android app and I am having a problem.
I am using a slightly modified TestNiftyGui.java and hellojme.xml.
I have changed it to have a mouse click on the panel cause a change of the text in the panel.
The mac version does exactly what I would expect, i.e., a click on the panel changes the text.
The android app requires that I do a touch and move into the panel and then touch two more times to get the text to change.
Code is following:
Morris
public class Main extends SimpleApplication implements ScreenController {
private Nifty nifty;
public static void main(String[] args){
Main app = new Main();
app.setPauseOnLostFocus(false);
app.start();
}
public void simpleInitApp()
{
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
Geometry geom = new Geometry(“Box”, b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“m_ColorMap”, assetManager.loadTexture(“Interface/Logo/Monkey.jpg”));
geom.setMaterial(mat);
rootNode.attachChild(geom);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.fromXml(“Interface/hellojme.xml”, “start”);
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
// disable the fly cam
flyCam.setEnabled(false);
}
public void bind(Nifty nifty, Screen screen)
{
this.nifty = nifty;
Screen myScreen = nifty.getCurrentScreen();
System.out.println("Enter Bind - screen = " + myScreen);
}
public void onStartScreen()
{
System.out.println(“Enter onStartScreen”);
}
public void onEndScreen()
{
System.out.println(“Enter onEndScreen”);
}
public void sayHello(String myarg)
{
System.out.println("Nifty says "+myarg);
Element niftyElement = nifty.getCurrentScreen().findElementByName(“myText”);
niftyElement.getRenderer(TextRenderer.class).setText(“New text”);
}
}