Java Code Examples for com.badlogic.gdx.ApplicationListener

The following are top voted examples for showing how to use com.badlogic.gdx.ApplicationListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: feup-lpoo-armadillo   File: GameTest.java   Source Code and License 6 votes vote down vote up
@BeforeClass
public static void init() {
    // Note that we don't need to implement any of the listener's methods
    application = new HeadlessApplication(new ApplicationListener() {
        @Override public void create() {}
        @Override public void resize(int width, int height) {}
        @Override public void render() {}
        @Override public void pause() {}
        @Override public void resume() {}
        @Override public void dispose() {}
    });

    // Use Mockito to mock the OpenGL methods since we are running headlessly
    Gdx.gl20 = Mockito.mock(GL20.class);
    Gdx.gl = Gdx.gl20;
}
 
Example 2
Project: NoRiskNoFun   File: GdxTest.java   Source Code and License 6 votes vote down vote up
@BeforeClass
public static void init() {
    // Note that we don't need to implement any of the listener's methods
    application = new HeadlessApplication(new ApplicationListener() {
        @Override public void create() {}
        @Override public void resize(int width, int height) {}
        @Override public void render() {}
        @Override public void pause() {}
        @Override public void resume() {}
        @Override public void dispose() {}
    });

    // Use Mockito to mock the OpenGL methods since we are running headlessly
    Gdx.gl20 = Mockito.mock(GL20.class);
    Gdx.gl = Gdx.gl20;
}
 
Example 3
Project: guitar-finger-trainer   File: HtmlLauncher.java   Source Code and License 6 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new GftGame();
}
 
Example 4
Project: RavTech   File: HtmlLauncher.java   Source Code and License 6 votes vote down vote up
@Override
 public ApplicationListener createApplicationListener () {
  RavTech ravtech = new RavTech(new HtmlEngineConfiguration());
  HookApi.addHook("onBoot", new Hook() {
		  @Override
		  public void run() {
			  RavTech.files.loadAsset("map.scene", Scene.class);
			  RavTech.files.finishLoading();
			  RavTech.currentScene = RavTech.files.getAsset("map.scene", Scene.class);
		  }
	  });
  HookApi.addHook("onUpdate", new Hook() {
	int i = 0;
	@Override
	public void run() {
		i++;
		GameObject.find("Camera").transform.setLocalPosition(0, (float)(Math.sin(i * 0.01) * 5));
	}
});

    return ravtech;
 }
 
Example 5
Project: Mindustry   File: HtmlLauncher.java   Source Code and License 5 votes vote down vote up
@Override
 public ApplicationListener createApplicationListener() {
     instance = this;
     setLogLevel(LOG_NONE);
     setLoadingListener(new LoadingListener() {
         @Override
         public void beforeSetup() {

         }

         @Override
         public void afterSetup() {
             scaleCanvas();
             setupResizeHook();
         }
     });

     Net.setClientProvider(new WebsocketClient());
     
     Mindustry.platforms = new PlatformFunction(){
     	DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss");

@Override
public String format(Date date){
	return format.format(date);
}

@Override
public String format(int number){
	return NumberFormat.getDecimalFormat().format(number);
}

@Override
public void openLink(String link){
	Window.open(link, "_blank", "");
}
     };
     
     return new Mindustry();
 }
 
Example 6
Project: EarthInvadersGDX   File: HtmlLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new Game(new Advertisements() {
                @Override
                public void showAds() {

                }
        });
}
 
Example 7
Project: Cubes_2   File: ServerCompatibility.java   Source Code and License 5 votes vote down vote up
@Override
protected void run(ApplicationListener applicationListener) {
  HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration();
  config.renderInterval = -1; // internal loop called from within create()
  
  new HeadlessApplication(applicationListener, config);
}
 
Example 8
Project: Cubes_2   File: AndroidCompatibility.java   Source Code and License 5 votes vote down vote up
@Override
protected void run(ApplicationListener applicationListener) {
	AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
	config.useAccelerometer = false;
	config.useCompass = false;
	config.useWakelock = true;
	config.useImmersiveMode = true;
	androidLauncher.initialize(applicationListener, config);
}
 
Example 9
Project: gdx-controllerutils   File: ControllerMappingsTest.java   Source Code and License 5 votes vote down vote up
@BeforeClass
public static void init() {
    // Note that we don't need to implement any of the listener's methods
    Gdx.app = new HeadlessApplication(new ApplicationListener() {
        @Override
        public void create() {
        }

        @Override
        public void resize(int width, int height) {
        }

        @Override
        public void render() {
        }

        @Override
        public void pause() {
        }

        @Override
        public void resume() {
        }

        @Override
        public void dispose() {
        }
    });

    // Use Mockito to mock the OpenGL methods since we are running headlessly
    Gdx.gl20 = Mockito.mock(GL20.class);
    Gdx.gl = Gdx.gl20;
}
 
Example 10
Project: Cubes   File: ServerCompatibility.java   Source Code and License 5 votes vote down vote up
@Override
protected void run(ApplicationListener applicationListener) {
  HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration();
  config.renderInterval = -1; // internal loop called from within create()
  
  new HeadlessApplication(applicationListener, config);
}
 
Example 11
Project: Cubes   File: AndroidCompatibility.java   Source Code and License 5 votes vote down vote up
@Override
protected void run(ApplicationListener applicationListener) {
  AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
  config.useAccelerometer = false;
  config.useCompass = false;
  config.useWakelock = true;
  config.useImmersiveMode = true;
  androidLauncher.initialize(applicationListener, config);
}
 
Example 12
Project: trascendentAR   File: ARLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public void initialize(ApplicationListener listener, AndroidApplicationConfiguration config){
    //Las siguientes dos lines son necesaria para poder aƱadir markers de la manera que ARToolKit lo maneja
    AssetHelper assetHelper = new AssetHelper(getAssets());
    assetHelper.cacheAssetFolder(this, "Data");

    mainLayout = new FrameLayout(this);
    config.r = 8;
    config.g = 8;
    config.b = 8;
    config.a = 8;

    //Configuraciones basicas
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    gameView = initializeForView(listener, config);

    if(graphics.getView() instanceof SurfaceView){
        SurfaceView glView = (SurfaceView)graphics.getView();
        glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    }

    setContentView(mainLayout);
}
 
Example 13
Project: JGame   File: HtmlLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new JGame();
}
 
Example 14
Project: odb-dynasty   File: HtmlLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new GdxArtemisGame();
}
 
Example 15
Project: eamaster   File: SwingTestRunner.java   Source Code and License 5 votes vote down vote up
public SwingTestRunner() {
        logger.info("Starting application");


        LwjglApplicationConfiguration configuration = new LwjglApplicationConfiguration();
        configuration.width = 1200;
        configuration.height = 900;
        configuration.samples = 4;

        logger.info("Config is: {}x{}", configuration.width, configuration.height);

        ApplicationListener app = new WheelRenderer();
        lwjglCanvas = new LwjglCanvas(app, configuration);


        logger.info("Application listener used is {}", app.getClass());

        setName("Test frame ooo");

        JButton b = new JButton("lol");
        b.addActionListener(e -> {
            logger.info("Button clicked");
//            ((WheelRenderer) app).doStuff();
//            lwjglCanvas.stop();
//            getContentPane().remove(lwjglCanvas.getCanvas());
        });

        Container c = getContentPane();
        lwjglCanvas.getCanvas().setBounds(0, 0, 1200, 900);
        b.setBounds(900, 0, 100, 900);
        c.add(lwjglCanvas.getCanvas(), BorderLayout.LINE_START);
        c.add(b, BorderLayout.CENTER);

        pack();
        setVisible(true);
        setSize(1300, 900);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    }
 
Example 16
Project: gdx-backend-jglfw   File: JglfwGraphics.java   Source Code and License 5 votes vote down vote up
void sizeChanged (int width, int height) {
	if (isMac) {
		glfwShowWindow(window); // This is required to refresh the NSOpenGLContext on OSX!
	}
	width = Math.max(1, width);
	height = Math.max(1, height);
	this.width = width;
	this.height = height;
	Gdx.gl.glViewport(0, 0, width, height);
	ApplicationListener listener = Gdx.app.getApplicationListener();
	if (listener != null) listener.resize(width, height);
	requestRendering();
}
 
Example 17
Project: braingdx   File: AppRunner.java   Source Code and License 5 votes vote down vote up
public static void run(final Class<? extends ApplicationListener> cl, ExecutorService executor) {
   executor.submit(new Callable<Integer>() {

      @Override
      public Integer call() throws Exception {
         return process.exec(AppRunner.class, cl);
      }

   });
}
 
Example 18
Project: gdx-lml   File: HtmlLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public ApplicationListener createApplicationListener() {
    // GWT applications don't like to be closed, so we're turning off the logging:
    setLogLevel(Application.LOG_NONE);
    // Normally you just wouldn't include an exit button on this platform.
    return new Core();
}
 
Example 19
Project: Planet-Generator   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new PlanetGeneratorGame();
}
 
Example 20
Project: libgdx-learnlib   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new MyGdxGame();
}
 
Example 21
Project: odb-artax   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener() {
    return new GdxArtemisGame();
}
 
Example 22
Project: penguins-in-space   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new Asteroids();
}
 
Example 23
Project: FlappyChapa   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new FlappyChapa();
}
 
Example 24
Project: Caramelos   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new CaramelosGame();
}
 
Example 25
Project: Flappy-Baranus   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new FlappyBaran();
}
 
Example 26
Project: projecttd   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener() {
    return new ProjectTD();
}
 
Example 27
Project: curiosone-app   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new MyGdxGame();
}
 
Example 28
Project: NotDarkorbit   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new NotDarkOrbit();
}
 
Example 29
Project: Klooni1010   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
    return new Klooni(null);
}
 
Example 30
Project: Ponytron   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new PonytronGame();
}
 
Example 31
Project: gdx-cclibs   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new ExampleRunner(null);
}
 
Example 32
Project: gdx-complextext   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new MyGdxGame();
}
 
Example 33
Project: odb-little-fortune-planet   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener() {
    return new GdxArtemisGame();
}
 
Example 34
Project: MyRoom   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new ZombieBirdGame();
}
 
Example 35
Project: blueirisviewer   File: GwtLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener getApplicationListener () {
	return new BlueIrisViewer(null);
}
 
Example 36
Project: Onyx   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new OnyxGame();
}
 
Example 37
Project: GangsterSquirrel   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new MainGameClass();
}
 
Example 38
Project: nomoore   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener () {
        return new MyGdxGame();
}
 
Example 39
Project: le-pendu   File: HtmlLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener getApplicationListener () {
        return new LePendu();
}
 
Example 40
Project: ColorGuard   File: GwtLauncher.java   Source Code and License 4 votes vote down vote up
@Override
public ApplicationListener createApplicationListener() {
    return new ColorGuardGame();
}