3

I am having trouble getting a html version of my programme to appear. I am using LibGDX 1.3.1 and running in Java it works fine.

I uploaded the game here:

http://www.darkflame.co.uk/MeshExplorer/index.html

The libgdx loading bar appears and finishes - and in Chromes network tag I can see assets loading. However, nothing appears other then the rectangle of the expected game size.

Most confusingly for me though, I dont see any crashes or logs from my code. That is, there is nothing after "SoundManager 2 loaded (OK) "

Given that the first lines of my main core class are:

   game=this;
   font = new BitmapFont();
   batch = new SpriteBatch();

   Gdx.app.log(logstag, "loading..");

I expected at least to see "loading.."

I even added some gwt logs to html launcher

 public class HtmlLauncher extends GwtApplication {
   static Logger Log = Logger.getLogger("HtmlLauncher");

    @Override
    public GwtApplicationConfiguration getConfig () {
       Log.info("GwtApplicationConfiguration");
      System.out.print("GwtApplicationConfiguration");
            return new GwtApplicationConfiguration(640, 480);
    }

    @Override
    public ApplicationListener getApplicationListener () {
          Log.info("test, returning class ME() ");
          System.out.print("test, returning class ME() ");
            return new ME();
    }

}

again, nothing.

I am at a lose how to disorganize this problem further. It just seems like libgdx isn't even attempting to run my code.

Simon Forsberg
  • 13,086
  • 10
  • 64
  • 108
darkflame
  • 998
  • 1
  • 9
  • 23

1 Answers1

2

The default logging level in the html target is LOG_ERROR. You would not see any Gdx.app.log messages unless you set the logging level to LOG_INFO.

Calling Gdx.app.setLogLevel(LOG_INFO) in your getConfig or getApplicationListener methods should do the trick.

nEx.Software
  • 6,782
  • 1
  • 26
  • 34
  • Placing that in the htmlauncher classes makes it crash on launch with: "Cannot set property 'n' of undefined" However, putting it in the core class in onCreate works and the logs following it show up. I am puzzled, however, why the regular log statements I tried (System.out.print and Log.info) didnt result in output to the normal javascript console - which I prefer as I can actually select and copy stuff from it. GDXs logbox seems to block selections being made. – darkflame Sep 14 '14 at 16:07
  • GWT doesn't translate `System.out.println` or `Logger` calls to `console.log` calls. – nEx.Software Sep 14 '14 at 16:11
  • `Logger logger = Logger.getLogger("Name");` `logger.log(Level.SEVERE, "this message should get logged");` Works just fine in GWT - thats what I normally use and is being used here. Pretty sure its just java.util.logging emulated. – darkflame Sep 14 '14 at 16:27
  • LibGDX makes no modification to Logger, so I couldn't tell you why it isn't working if it normally does for you. – nEx.Software Sep 14 '14 at 16:28
  • ah, I found my mistake. I needed to set it to inherit logger in the gwt.xml. Even though its emulated it wont respond correctly to levels set without that [DevGuideLogging](http://www.gwtproject.org/doc/latest/DevGuideLogging.html#Super_Simple_Recipe_for_Adding_Logging) – darkflame Sep 14 '14 at 16:45