3

i have defined the main menus of my game using the Tripleplay framework for PlayN. unfortunately I cannot get it to display on my Nexus 7.

What's really strange about this - if i run the Java version everything works fine - yet whenever I run the Android version nothing displays - the logs state that the whole UI is built

Has anybody had any problem using the Tripleplay framework on Android - the Java works fine.

Here is the code:

public class MainMenuStateImpl extends AbstractState implements MenuState {

  private Interface ui;
  private GroupLayer groupLayer;

  @Inject
  public MainMenuStateImpl(StateManager stateManager) {
    super(stateManager);
  }

  @Override
  public void initialize() {
    PlayN.log().debug("initializing main menu");
    groupLayer = graphics().createGroupLayer();
    graphics().rootLayer().add(groupLayer);
    ui = new Interface();

    final Root root = ui.createRoot(AxisLayout.vertical().gap(15), SimpleStyles.newSheet());
    PlayN.log().debug("setting root to size " + graphics().width() + ", " + graphics().height());
    root.setSize(graphics().width(), graphics().height());
    stateManager.getImageCache().cache("img/menu_background.png", new Callback.Default<Image>() {

      @Override
      public void onSuccess(Image image) {
        // groupLayer.add(graphics().createImageLayer(image));
        root.addStyles(Style.BACKGROUND.is(Background.image(image)));
        groupLayer.add(root.layer);
        // graphics().rootLayer().add(root.layer);

        final Group buttons = new Group(AxisLayout.vertical().offStretch());
        root.add(new Label("RunRun:"), buttons);

        PlayN.log().debug("adding level groups to menu");
        final LevelGroupMetadataCache cache = (LevelGroupMetadataCache) stateManager.getContext()
        .get(ContextKeys.LEVEL_GROUP_METADATA_CACHE);
        for (final LevelGroupMetadata levelGroup : cache) {
          final Button button = new Button(levelGroup.getName());
          buttons.add(button);
          button.clicked().connect(new UnitSlot() {

            @Override
            public void onEmit() {
              stateManager.getContext().set(ContextKeys.LEVEL_GROUP,
              cache.get(levelGroup.getName()));
              stateManager.goTo(stateManager.getLevelGroupMenuState());
            }
          });
        }
        PlayN.log().debug("finished creating ui for main menu");
        PlayN.log().debug("ui = " + ui);
      }
    });
  }

  @Override
  public void destroy() {
    groupLayer.destroy();
  }

  @Override
  public void update(float delta) {
    ui.update(delta);
  }

  @Override
  public void paint(float alpha) {
    ui.paint(alpha);
  }
}

all the log statements appear in my logcat - but nothing is rendering - in Android only - everything works fine when i run the java version...

I'm completely at a loss as to how to fix this or what to do.

Any help would be greatly appreciated

sean christe
  • 879
  • 2
  • 7
  • 24
  • it turns out no library is working - i hardcoded my way past the menu to the level (which uses box2d) - everything's there - i don't get any class not found or exceptions thrown - it just seems like nothing from the libraries is actually working - in the java version (using guice 3.0) everything works fine - android deployment none of the 3rd party libs work at all except for roboguice to inject everything. ALSO - the showcase deploys fine to my device and all the tripleplay and box2d work - don't know what the issue is here. – sean christe Feb 13 '13 at 13:35
  • Did you try the emulator? Which 3rd party libs? Did you build the libs for android yourself? – Shark Feb 20 '13 at 13:20
  • i cannot try the emulator - unable to use lwjgl in an emulator since my computer doesn't support it - the 3rd party libs are javax.inject, tripleplay 1.5, and jbox2d 1.5.1, for the core project, guice 3.0 in the java project (which works fine), and roboguice 2 with guice 3.0 no aop in the android project. android version builds and deploys, don't get any no class def found errors - but its like the libraries just don't ever do anything -... it's actually pretty bizarre – sean christe Feb 22 '13 at 21:31

0 Answers0