Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  Libgdx Gwt Module... How to? Errors  (Read 1699 times)
0 Members and 1 Guest are viewing this topic.
Offline Andre Lopes
« Posted 2013-11-02 23:21:00 »

Please, im totally new with GWT and Those Gwt-modules... Heres all the information i have , please help! Im reading more tutorials and googling but im not getting what i should do... Should i make a module for each class?


1  
2  
3  
        [ERROR] [com.me.mygdxgame.GwtDefinition] - Errors in 'file:/D:/ArcherProjectLEGACY/my-gdx-game/src/com/me/mygdxgame/MyGdxGame.java'
   [ERROR] [com.me.mygdxgame.GwtDefinition] - Line 24: No source code is available for type br.views.MenuView; did you forget to inherit a required module?
   [ERROR] [com.me.mygdxgame.GwtDefinition] - Line 26: No source code is available for type br.data.SaveData; did you forget to inherit a required module?


Hi guys, the libgdx game loads but then it gives me that error.. It shows libgdx loading bar but then that happens.


The my-gdx-game project have this xml :

1  
2  
3  
4  
5  
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
   <source path="com/me/mygdxgame" />
</module>




The Gwt/HTML project have this xml :
1  
2  
3  
4  
5  
6  
7  
8  
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
   <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
   <inherits name='MyGdxGame' />
   <entry-point class='com.me.mygdxgame.client.GwtLauncher' />
   <set-configuration-property name="gdx.assetpath" value="../my-gdx-game-android/assets" />
</module>




The main Class is this :

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  
package com.me.mygdxgame;

import br.views.MenuView;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Screen;

public class MyGdxGame extends Game implements ApplicationListener,Screen {
   @Override
    public void create() {
        //GraphicAvailability.hasGl2Avaiable();
        setScreen(new MenuView());
       
        //SaveData sd = new SaveData();
        //sd.saveDebugData();
    }

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

    @Override
    public void render() {
        super.render();
    }

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

    @Override
    public void pause() {
        super.pause();
    }

    @Override
    public void resume() {
        super.resume();
    }

    @Override
    public void render(float delta) {
     
    }

    @Override
    public void show() {
       
    }

    @Override
    public void hide() {
     
    }
}


Offline SHC
« Reply #1 - Posted 2013-11-03 02:07:37 »

What is
br.views.MenuView
class? I think there are some errors in that.

Offline Andre Lopes
« Reply #2 - Posted 2013-11-03 13:44:36 »

What is
br.views.MenuView
class? I think there are some errors in that.

SHC, thanks for the reply, i still have the same issue, heres the class :

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  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
package br.views;

import br.data.LoadData;
import br.data.Options;
import br.dir.DirectoriesMenuView;
import br.views.levels.LevelOne;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.backends.openal.Ogg.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
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.utils.ClickListener;

/**
 *
 * @author André Vinícius Lopes
 */

public class MenuView implements Screen {

    private Sprite background;
    private SpriteBatch batch;

    private Table table;
    private Stage stage;

    private TextureAtlas buttonSwitcherPack;
    private BitmapFont simpleBlackFont, simpleWhiteFont;
    private Skin skin;
    private TextButton buttonStart;
    private TextButton buttonLoad;
    private TextButton buttonOptions;

    @Override
    public void dispose() {
        background.getTexture().dispose();
        batch.dispose();
        stage.dispose();
        buttonSwitcherPack.dispose();
        simpleBlackFont.dispose();
        simpleWhiteFont.dispose();
        skin.dispose();

    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        batch.begin();
        batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        batch.end();

        //Table.drawDebug(stage);
        table.debug();
        stage.act(delta);
        stage.draw();
    }

    @Override
    public void resize(int width, int height) {
        stage.setViewport(width, height, true);

        int w = (Gdx.graphics.getWidth() / 2);
        int h = (Gdx.graphics.getHeight() - Gdx.graphics.getHeight() / 5);

        table.setPosition(w, h);

        table.invalidateHierarchy();
        buttonLoad.invalidate();
        buttonStart.invalidate();

    }

    @Override
    public void show() {

        final DirectoriesMenuView directoriesMenuView = new DirectoriesMenuView();

        background = directoriesMenuView.getBackground();
        batch = new SpriteBatch();
        buttonSwitcherPack = new TextureAtlas();
        buttonSwitcherPack.addRegion("buttonNormal", directoriesMenuView.getButtonNormal());
        buttonSwitcherPack.addRegion("buttonPressed", directoriesMenuView.getButtonPressed());
        skin = new Skin(buttonSwitcherPack);
        simpleBlackFont = directoriesMenuView.getSimpleBlackFont();
        simpleWhiteFont = directoriesMenuView.getSimpleWhiteFont();

        //Create Stage
        stage = new Stage();
        //Make the Stage Accept inputs
        Gdx.input.setInputProcessor(stage);

        //Create Table
        table = new Table();

        //Create First Button
        TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
        textButtonStyle.up = skin.getDrawable("buttonNormal");
        textButtonStyle.down = skin.getDrawable("buttonPressed");
        textButtonStyle.font = simpleWhiteFont;
        textButtonStyle.pressedOffsetX = 1;
        textButtonStyle.pressedOffsetY = -1;

        buttonOptions = new TextButton("Options", textButtonStyle);
        buttonOptions.addCaptureListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                if (Options.isSoundOn()) {
                 
                    Music music = (Music) Gdx.audio.newMusic(directoriesMenuView.getButtonOptionsSound());
                    music.setLooping(false);
                    music.play();
                }

                ((Game) Gdx.app.getApplicationListener()).setScreen(new OptionsView());
                dispose();
            }
        });

        //Add style to Button
        buttonStart = new TextButton("Start", textButtonStyle);
        buttonStart.addCaptureListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                if (Options.isSoundOn()) {
                    Music music = (Music) Gdx.audio.newMusic((directoriesMenuView.getMenuViewButtonSound()));
                    music.setLooping(false);
                    music.play();
                }
                ((Game) Gdx.app.getApplicationListener()).setScreen(new LevelOne());
                dispose();
            }
        });

        //Create Second Button
        buttonLoad = new TextButton("Load", textButtonStyle);
        buttonLoad.addListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                if (Options.isSoundOn()) {
                    Music music = (Music) Gdx.audio.newMusic(directoriesMenuView.getButtonLoadSound());
                    music.setLooping(false);
                    music.play();
                }
                try {
                    LoadData ld = new LoadData();
                    ld.loadData();
                    dispose();
                } catch (Exception ex) {
                    System.out.println("Error Loading Data" + ex.getMessage());

                }
            }
        });

        //Create Label
        Label label = new Label("Archer Hunter", new Label.LabelStyle(simpleBlackFont, Color.BLACK));

        //Add actors to Table.
        table.add(label);
        table.row();
        table.add(buttonStart);
        table.row();
        table.add(buttonLoad);
        table.row();
        table.add(buttonOptions);

        //Configure Table
        Table.drawDebug(stage);
        table.debug();
        table.setPosition(((float) Gdx.graphics.getWidth() / 2f), ((float) Gdx.graphics.getHeight() - (float) Gdx.graphics.getHeight() / 5f));

        //Add Table To Stage
        stage.addActor(table);
    }

    @Override
    public void hide() {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nexsoftware

Junior Devvie


Medals: 9



« Reply #3 - Posted 2013-11-03 15:49:58 »

GWT needs to know exactly where to get all sources from. Since br.views is not a sub-package of com.me.mygdxgame, it cannot be found. Define that as a source path in your gwt module definition, or move that to the com.me.mygdxgame package. Also, even if it could find the source, it won't compile because you reference com.badlogic.gdx.backends.openal.Ogg.Music - You should reference com.badlogic.gdx.audio.Music instead.
Offline Andre Lopes
« Reply #4 - Posted 2013-11-03 16:57:02 »

GWT needs to know exactly where to get all sources from. Since br.views is not a sub-package of com.me.mygdxgame, it cannot be found. Define that as a source path in your gwt module definition, or move that to the com.me.mygdxgame package.

Also, even if it could find the source, it won't compile because you reference com.badlogic.gdx.backends.openal.Ogg.Music - You should reference com.badlogic.gdx.audio.Music instead.

Yay thanks for the answer m8.

I fixed this :
1  
 Also, even if it could find the source, it won't compile because you reference com.badlogic.gdx.backends.openal.Ogg.Music - You should reference com.badlogic.gdx.audio.Music instead.


Now, about  this :
1  
GWT needs to know exactly where to get all sources from. Since br.views is not a sub-package of com.me.mygdxgame, it cannot be found. Define that as a source path in your gwt module definition, or move that to the com.me.mygdxgame package. 


I dont know what to do, heres a screenshot of my eclipse project.

http://imageshack.us/a/img96/6991/rmiv.jpg




-----

Edit :

I did this :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module>
   <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
   <inherits name='MyGdxGame' />
    <inherits name="br.views"/>
     <inherits name="br.dir"/>
   <entry-point class='com.me.mygdxgame.client.GwtLauncher' />
   <set-configuration-property name="gdx.assetpath" value="../my-gdx-game-android/assets" />
</module>


And got this...

Quote
[ERROR] Unable to find 'br/views.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Offline Andre Lopes
« Reply #5 - Posted 2013-11-03 18:51:03 »

Alright, i did a little thing to help sort stuff out....

http://img17.imageshack.us/img17/7598/3y8c.jpg


It loads the game, but when i click starts, it locks down and dont start the game.

It just loads the first View Class.It does make the sound but nothing else happens.

Ah, also, this shows up in eclipse :

http://www.java-gaming.org/?action=pastebin&id=755

Some kind of Error it seems.

Offline SHC
« Reply #6 - Posted 2013-11-04 13:24:42 »

I'm not sure of this, so I can't do any much help. Sorry.

Offline JVallius
« Reply #7 - Posted 2013-11-04 13:31:01 »

Maybe it is easier to create a new project and copy/paste your code in there.

Offline Andre Lopes
« Reply #8 - Posted 2013-11-04 14:52:01 »

Maybe it is easier to create a new project and copy/paste your code in there.


Thats what i did, i put all the code in the same package in setup UI.

IDK whats happening.

When i press Load it says it doesnt find one of the images.... weird.
Offline SHC
« Reply #9 - Posted 2013-11-04 15:11:25 »

When i press Load it says it doesnt find one of the images.... weird.

Try refreshing every project in Eclipse. I think this should solve your problem.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andre Lopes
« Reply #10 - Posted 2013-11-04 16:14:28 »

Still nothing. I updated all libraries.
When i do, it stop working, so i change this in XML :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<module>
    <entry-point class="com.me.mygdxgame.client.GwtLauncher"/>
    <set-configuration-property name="gdx.assetpath" value="../my-gdx-game-android/assets"/>
    <inherits name="com.badlogic.gdx.backends.gdx_backends_gwt"/>
    <inherits name='MyGdxGame'/>
    </module>

Exactly , this is what i do :
add this line :     <inherits name='MyGdxGame'/>

And it loads, but still gives that error.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (69 views)
2014-11-03 22:04:50

BurntPizza (67 views)
2014-11-03 18:54:52

moogie (82 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!