Robovm excpetion

37 views
Skip to first unread message

AceEX

unread,
Sep 14, 2014, 11:38:52 AM9/14/14
to rob...@googlegroups.com

i'm working on a game for a few months now.. it works perfectly on desktop and on android, but on the mac i'm getting an error and have no idea what to do from there... i'm guessing it has some problem with the Robovm.. the application starts with the splash screen and when it goes to the main menu screen i'm getting the following error

Exception
CODE: SELECT ALL
java.lang.ExceptionInInitializerError
   at com.badlogic.gdx.graphics.Camera.<init>(Camera.java)
   at com.badlogic.gdx.graphics.OrthographicCamera.<init>(OrthographicCamera.java)
   at com.dic.Screens.MainMenuScreen.<init>(MainMenuScreen.java)
   at com.dic.Screens.SplashScreen$1.onEvent(SplashScreen.java)
   at aurelienribon.tweenengine.BaseTween.callCallback(BaseTween.java)
   at aurelienribon.tweenengine.BaseTween.updateStep(BaseTween.java)
   at aurelienribon.tweenengine.BaseTween.update(BaseTween.java)
   at aurelienribon.tweenengine.TweenManager.update(TweenManager.java)
   at com.dic.Screens.SplashScreen.render(SplashScreen.java)
   at com.badlogic.gdx.Game.render(Game.java)
   at com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(IOSGraphics.java)
   at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(IOSGraphics.java)
   at org.robovm.apple.uikit.UIView.$cb$drawRect$(UIView.java)
   at org.robovm.apple.uikit.UIApplication.main(Native Method)
   at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
   at com.mygdx.game.IOSLauncher.main(IOSLauncher.java)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=24; index=24
   at com.badlogic.gdx.math.Frustum.<clinit>(Frustum.java)
   ... 16 more


MainMenuScreen Class
CODE: SELECT ALL
package com.dic.Screens;

import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenManager;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.dic.Helpers.AssetLoader;
import com.dic.Mikmakfly.MyGdxGame;
import com.dic.TweenAccessors.TableAccessor;
import com.dic.TweenAccessors.TextButtonAccessor;

public class MainMenuScreen implements Screen {
   
   private ShapeRenderer shapeRenderer;
   private SpriteBatch batcher;
   private OrthographicCamera cam;
   private TextureRegion menu;

   private float screenWidth;
   private float screenHeight;
   private float gameWidth;
   private float gameHeight;
   private Stage stage;
   private Skin skin;
   private TweenManager manager;
   private TextButton connectButton;
   private TextButton gameButton;
   private TextButton loginButton;
   private TextButton connect3;
   
   public MainMenuScreen(final MyGdxGame game)
   {
      screenWidth = Gdx.graphics.getWidth();
      screenHeight = Gdx.graphics.getHeight();
      
      gameWidth=136;
      gameHeight = screenHeight / (screenWidth / gameWidth);
      
      cam = new OrthographicCamera();
      cam.setToOrtho(true, 136, gameHeight);
      
      batcher = new SpriteBatch();
      batcher.setProjectionMatrix(cam.combined);
      
      shapeRenderer = new ShapeRenderer();
      shapeRenderer.setProjectionMatrix(cam.combined);
      
      stage = new Stage(new FitViewport(gameWidth, gameHeight));
      
        Gdx.input.setInputProcessor(stage); 
        
      skin = new Skin(Gdx.files.internal("uiskin.json"));
      
      manager = new TweenManager();
      Tween.registerAccessor(TextButton.class, new TextButtonAccessor());
      Tween.registerAccessor(Table.class, new TableAccessor());

      menu = AssetLoader.menu;

      TextureRegion upRegion = AssetLoader.logout;
      TextureRegion downRegion =  AssetLoader.login;
      
      TextButtonStyle style = new TextButtonStyle();
      style.up = new TextureRegionDrawable(upRegion);
      style.down = new TextureRegionDrawable(downRegion);
      BitmapFont lb= new BitmapFont();
      style.font = lb;
      
      connectButton= new TextButton("",style);
      gameButton= new TextButton("",style);
      loginButton= new TextButton("",style);
      connect3= new TextButton("",style);
      
      final Table table= new Table(skin);
      table.setPosition(gameWidth/2, gameHeight/2);
      
      table.add(gameButton).width(30).height(15).padBottom(3).row();
      table.add(loginButton).width(30).height(15).padBottom(3).row();
      table.add(connectButton).width(30).height(15).padBottom(3).row();
      table.add(connect3).width(30).height(15).padBottom(3).row();
      
      stage.addActor(table);
      
      connectButton.addListener(new ClickListener()
      {
         @Override 
         public void clicked(InputEvent event, float x, float y)
         {
            
            game.setScreen(new GameScreen(1, game));

         /*   
            Tween.from(table, TableAccessor.SCALE, .8f).target(40,40)  // the target can be relative to the current values
             .ease(Quad.IN)           // the easing function can be modified
            .start(manager);
            login();
            */
         }
      });
      
      
      
      gameButton.addListener(new ClickListener()
      {
         @Override 
         public void clicked(InputEvent event, float x, float y)
         {
            stage.addAction(Actions.sequence(Actions.fadeOut(1), Actions.run(new Runnable() {
               
               @Override
               public void run() {
                  game.setScreen(new GameScreen(2 , game));
                  
               }
            })));
         }
      });
      
      connect3.addListener(new ClickListener()
      {
         @Override 
         public void clicked(InputEvent event, float x, float y)
         {
            stage.addAction(Actions.sequence(Actions.fadeOut(1), Actions.run(new Runnable() {
               
               @Override
               public void run() {
                  game.setScreen(new GameScreen(6, game));
                  
               }
            })));
         }
      });
      
      loginButton.addListener(new ClickListener()
      {
         @Override 
         public void clicked(InputEvent event, float x, float y)
         {
            stage.addAction(Actions.sequence(Actions.fadeOut(1), Actions.run(new Runnable() {
               
               @Override
               public void run() {
                  game.setScreen(new GameScreen(4, game));
                  
               }
            })));
         }
      });
      
   }
      
   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      
      batcher.begin();
      batcher.draw(menu,0,0, gameWidth, gameHeight);
      batcher.end();
      
      manager.update(delta);
      
       stage.act(delta);
        stage.draw();
   }
   
   @Override
   public void resize(int width, int height) {
   }

   @Override
   public void show() {
      // TODO Auto-generated method stub
      
   }

   @Override
   public void hide() {
      // TODO Auto-generated method stub
      
   }

   @Override
   public void pause() {
      // TODO Auto-generated method stub
      
   }

   @Override
   public void resume() {
      // TODO Auto-generated method stub
      
   }

   @Override
   public void dispose() {
      // TODO Auto-generated method stub
      
   }
   
}

some additional details:
i'm working with : osx mavericks , libgdx-1.3.1 , java 1.7

thanks for the help!

Niklas Therning

unread,
Sep 15, 2014, 2:40:36 AM9/15/14
to AceEX, rob...@googlegroups.com
That reminds of a bug we had some time ago but which have been fixed since. Please try with the alpa-01 version of RoboVM or the latest SNAPSHOT of both libGDX and RoboVM.

--
You received this message because you are subscribed to the Google Groups "RoboVM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robovm+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages