Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Solved]-[libGDX] ((Game) Gdx.app.getApplicationListener()) error  (Read 2171 times)
0 Members and 1 Guest are viewing this topic.
Offline LordD
« Posted 2014-02-14 13:07:56 »

Hey guys !!

i am following dermetfan tutorials in youtube so i saw this tutorial which is the fifth tutorial and i had this problem and don't know what to do it just says that it's an wrong syntax
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
package com.me.game.screen;

import aurelienribon.tweenengine.BaseTween;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenCallback;
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.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.me.mygdxgame.Accessor;
import com.me.mygdxgame.MyGdxGame;

public class ScreenManager implements Screen {

   public Texture image;
   public Sprite splash;
   public SpriteBatch batch;
   public TweenManager tm;

   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      tm.update(delta);
      batch.begin();
      splash.draw(batch);
      batch.end();
   }

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

   }

   @Override
   public void show() {
      tm = new TweenManager();
      Tween.registerAccessor(Sprite.class, new Accessor());
      batch = new SpriteBatch();
      image = new Texture("data/10.06.png");
      splash = new Sprite(image);
      splash.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      Tween.set(splash, Accessor.Aplha).target(0).start(tm);
      Tween.to(splash, Accessor.Aplha, 2.5f).target(1).repeatYoyo(1, 2).setCallback(new TweenCallback(){
           

           
               
               public void onEvent(int type, BaseTween<?> source) {
                  ((Game) Gdx.app.getApplicationListener())

                 
               }
}).start(tm);
   }

   @Override
   public void hide() {

   }

   @Override
   public void pause() {

   }

   @Override
   public void resume() {

   }

   @Override
   public void dispose() {
      Gdx.app.log("Dispose()", " Closing the app now");
      batch.dispose();
      splash.getTexture().dispose();

   }

}

Not an native english speaker  Tongue  sorry for my bad english.
Offline xsvenson
« Reply #1 - Posted 2014-02-14 13:12:51 »

A stacktrace would be nice, but currently the line
1  
((Game) Gdx.app.getApplicationListener())

does currently nothing.

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Offline LordD
« Reply #2 - Posted 2014-02-14 13:15:54 »

A stacktrace would be nice, but currently the line
1  
((Game) Gdx.app.getApplicationListener())

does currently nothing.

I know that but it just gives me error from here even if i made it to ((Game) Gdx.app.getApplicationListener()).setScreen(new var); it would also be an error.

Not an native english speaker  Tongue  sorry for my bad english.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #3 - Posted 2014-02-14 15:47:42 »

A stacktrace would be nice, but currently the line
1  
((Game) Gdx.app.getApplicationListener())

does currently nothing.

I know that but it just gives me error from here even if i made it to ((Game) Gdx.app.getApplicationListener()).setScreen(new var); it would also be an error.

This is a common problem I have when doing this and it is purely down to imports, just type the entire thing, hover over "Game" and import that, then import your screen. Problem solved.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline LordD
« Reply #4 - Posted 2014-02-14 19:34:39 »

Quote

This is a common problem I have when doing this and it is purely down to imports, just type the entire thing, hover over "Game" and import that, then import your screen. Problem solved.


Thank you for helping me the problem is solved Smiley

Not an native english speaker  Tongue  sorry for my bad english.
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (489 views)
2018-06-10 19:43:48

EgonOlsen (553 views)
2018-06-10 19:43:44

EgonOlsen (405 views)
2018-06-10 19:43:20

DesertCoockie (701 views)
2018-05-13 18:23:11

nelsongames (1013 views)
2018-04-24 18:15:36

nelsongames (979 views)
2018-04-24 18:14:32

ivj94 (1503 views)
2018-03-24 14:47:39

ivj94 (556 views)
2018-03-24 14:46:31

ivj94 (1244 views)
2018-03-24 14:43:53

Solater (559 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!