Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (555)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Setting Up libGDX?  (Read 3662 times)
0 Members and 1 Guest are viewing this topic.
Offline _Scyth_

Junior Member





« Posted 2012-12-30 17:18:53 »

Ok, so following the posts on the discussion about why people are still using java2D I have decided I want to try out libGDX. I was linked to where to download a libGDX ui setup application and then a tutorial for libGDX.

The ui app has created four projects for me. I only want to program for desktop, what do I do now? I'm really confused. I don't know what projects I need to work in or what other libraries I may/ may not need for libGDX.

Can someone help me please?

   ~Scyth
Offline PeterNicholson

Senior Member


Medals: 3
Projects: 1



« Reply #1 - Posted 2012-12-30 17:21:52 »

His might help you: Link

Subscribe to me on YouTube: http://youtube.com/javaprogrammerguy
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #2 - Posted 2012-12-30 17:21:57 »

Just start coding in the libgdx project.
To start the project you coded, run the -desktop project. Everything is fine now.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline _Scyth_

Junior Member





« Reply #3 - Posted 2012-12-30 17:26:25 »

I tried google and there was nothing that helped.

Matheus I have four projects:

game
game-android
game-desktop
game-html

in eclipse there's errors beside the andriod and html one, probably because I do not have the libraries for those.

what one do I code in?
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #4 - Posted 2012-12-30 17:29:06 »

Write your game code in "game", and start your game via "game-desktop".

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #5 - Posted 2012-12-30 17:30:24 »

http://www.youtube.com/watch?v=nOQt94fcoFo

How was there nothing that helped in google? That's how everyone else figured it out. I have to question your motivation if you have to ask just for the setup.
Offline _Scyth_

Junior Member





« Reply #6 - Posted 2012-12-30 17:38:48 »

Thanks matheus Smiley

@Jimmit, all that kept coming up was code.google.com or whatever
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #7 - Posted 2012-12-30 18:03:06 »

http://code.google.com/p/libgdx/wiki/ProjectSetupNew

theres a tool on this site that creates the projects for you if your having trouble

Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #8 - Posted 2012-12-30 18:25:31 »

What's wrong with code.google.com? You know it's not all actual code, right? Some libgdx tutorials are on code.google.com, although some of them are outdated. The project setup remains the same tho.
Offline Ultroman

JGO Knight


Medals: 25
Projects: 1


Snappin' at snizzes since '83


« Reply #9 - Posted 2012-12-30 19:48:58 »

If you have no desire to make the game work on Android or HTML5, you can simply delete those folders (or untick them while setting up the project in the project setup UI).

- Jonas
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline davedes
« Reply #10 - Posted 2012-12-30 19:51:23 »

I tried google and there was nothing that helped.

Matheus I have four projects:

game
game-android
game-desktop
game-html

in eclipse there's errors beside the andriod and html one, probably because I do not have the libraries for those.

what one do I code in?
Yes, the android and HTML ones will give you errors and you won't be able to compile them without the proper SDKs.

It doesn't matter if you are just developing for desktop, though. Put your game code in "game" and to test it run the main class in "game-desktop", like matheus said. Put your resources in assets/data of "game-android."

Another way to set it up is to create a new class library in Eclipse, and point to LibGDX's JARs and natives. Then you don't need android/HTML projects, just one project for everything. This is standard practice for installing any 3rd party library in Java, and something you should get comfortable with if you plan to continue using Java. Smiley

Offline badlogicgames
« Reply #11 - Posted 2012-12-30 19:53:43 »

Is there anything we can do to make this easier? I'm a bit at a loss, feedback is appreciated.

http://www.badlogicgames.com - musings on Android and Java game development
Offline davedes
« Reply #12 - Posted 2012-12-30 19:57:29 »

If the setuptool allowed you to export a desktop-only project, I bet that would make things easier for beginners hoping to use LibGDX instead of Java2D/Slick2D. Smiley Just my two cents...

Offline LunaticEdit

Senior Member


Medals: 8
Projects: 1



« Reply #13 - Posted 2012-12-30 20:02:21 »

Just letting you know I ATTEMPTED to use libgdx but I cannot due to a bug with it and mac OSX's java 1.7 implementation - so if you plan on using it, you may want to stick with the older 1.6 release of java. I simply cannot use it as I rely on a number of 1.7 features. Oh well.

Offline davedes
« Reply #14 - Posted 2012-12-30 20:14:09 »

Why do you rely on 1.7 features? You realize that all Mac users < 10.7 (i.e. Snow Leopard and older) will not be able to play your game? Even if you're just using Java2D.

The bug is not because of LibGDX but because of LWJGL (or, more specifically, some drastic changes that were introduced with Java 7). The LWJGL devs have mostly fixed it, although it still needs more testing.

Offline LunaticEdit

Senior Member


Medals: 8
Projects: 1



« Reply #15 - Posted 2012-12-30 20:26:58 »

Why do you rely on 1.7 features? You realize that all Mac users < 10.7 (i.e. Snow Leopard and older) will not be able to play your game? Even if you're just using Java2D.

The bug is not because of LibGDX but because of LWJGL (or, more specifically, some drastic changes that were introduced with Java 7). The LWJGL devs have mostly fixed it, although it still needs more testing.

This is one thing I'll never understand about APIs. There's 5 versions of something, and only the oldest versions are acceptable to use. Java 1.7 is great, has lots of new features and is a joy to work with. The reality is nothing supports it, so it's effectively useless for anything. By the time 1.7 has any support I'm sure 1.8 will be out. I guess I'll go back and switch out a lot of my clean exception handlers and switches back into noisy catch and if/else blocks..

Offline davedes
« Reply #16 - Posted 2012-12-30 20:46:16 »

If you're relying that much on String switch and combined exception catches, I wonder whether you are doing something wrong... Wink

I haven't had a need for String switch since enums were introduced. Hopefully the introduction of String switch doesn't encourage Java programmers to go back to using Strings as constants....

Offline LunaticEdit

Senior Member


Medals: 8
Projects: 1



« Reply #17 - Posted 2012-12-30 20:52:01 »

If you're relying that much on String switch and combined exception catches, I wonder whether you are doing something wrong... Wink

I haven't had a need for String switch since enums were introduced. Hopefully the introduction of String switch doesn't encourage Java programmers to go back to using Strings as constants....

Ye of little faith..


It is incredibly useful for XML processing:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
    private void processPropertyXML(final Element propertyElement) {
        final String propName = propertyElement.getAttribute("name");
        final String propValue = propertyElement.getAttribute("value");

        switch(propName) {
            case "DefaultStage": _defaultStage = propValue; break;
            case "PlayerStartX": _playerStartX = Integer.parseInt(propValue); break;
            case "PlayerStartY": _playerStartY = Integer.parseInt(propValue); break;
        }
    }


Of course when the input can be controlled enums provide the typical solution:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
    private void handleStageMessages() throws Exception {
        Message m;
        if ((m = Messenger.getInstance().popMessage(MessageClass.Stage)) == null) {
            return;
        }

        do {
            switch (m.getMessageType()) {
                case CoinGenerated:         generateCoin((Coin)m.getData());                break;
                case CoinDestroyed:         destroyCoin((Coin)m.getData());                 break;
                case ProjectileGenerated:   generateProjectile((Projectile)m.getData());    break;
                case ProjectileDestroyed:   destroyProjectile((Projectile) m.getData());    break;
                case WarpActivated:         warpActivated((WarpZone)m.getData());           break;
                default:
                    throw new Exception("Unknown message type encountered in the messenger!");
            }
        } while ((m = Messenger.getInstance().popMessage(MessageClass.Stage)) != null);
    }


Now imagine that top block with a bunch of if() {  } else if() { } else if ()s...

Offline davedes
« Reply #18 - Posted 2012-12-30 21:28:29 »

Agreed that XML parsing is much clearer with string switch. But is it worth losing potentially hundreds of users?

I used to write XML parsers like that; they got quite long-winded and difficult to scale and debug. Nowadays I lean towards JSON and other means of serialization.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
class Level {
    public int playerX;
    public int playerY;
    public String someData;

    Level() { }
}

... load level from file ...

Level level = gson.fromJson(reader, Level.class);


But I guess that's just preference. Smiley

Offline Cero
« Reply #19 - Posted 2012-12-30 21:45:34 »

It IS sad. The only problem is linux and mac distribution - if it was available by default, it wouldn't be a problem.
Not that I use 7 features...

Well we can hope: "I anticipate rapid adoption of Java 8 (much faster than 7)"

Offline Mike

JGO Wizard


Medals: 74
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #20 - Posted 2012-12-31 10:14:47 »

Is there anything we can do to make this easier? I'm a bit at a loss, feedback is appreciated.

I actually set up a LibGDX project yesterday and ran into several issues. After some googling it was all fixable though but I ended up on stackoverflow to get the answers instead of in the wiki or so.

The issues I had:
Had to get the Android SDK and GWT plugin (of the correct eclipse version, accidentally downloading the wrong version broke my eclipse Smiley)
Had to set up the Android emulator (as I don't have an android phone)
Had to run a few "Quick fix" to solve some dependency issues
Had to rename the class in the Application project as it had the same name as the class in my game project

All in all it went okay and if you cannot google yourself to solve these kind of issues it will probably be quite hard to create a game. Maybe add a troubleshooting section to the wiki?

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Cero
« Reply #21 - Posted 2012-12-31 15:37:31 »

Is there anything we can do to make this easier? I'm a bit at a loss, feedback is appreciated.

I actually set up a LibGDX project yesterday and ran into several issues. After some googling it was all fixable though but I ended up on stackoverflow to get the answers instead of in the wiki or so.

The issues I had:
Had to get the Android SDK and GWT plugin (of the correct eclipse version, accidentally downloading the wrong version broke my eclipse Smiley)
Had to set up the Android emulator (as I don't have an android phone)
Had to run a few "Quick fix" to solve some dependency issues
Had to rename the class in the Application project as it had the same name as the class in my game project

All in all it went okay and if you cannot google yourself to solve these kind of issues it will probably be quite hard to create a game. Maybe add a troubleshooting section to the wiki?

Mike

Android SDK and GWT plugin: well it cant be helped if you want to use those platforms
Android emulator: same thing
you dont need these things if you just use libgdx for pc
add a troubleshooting / "Quick fix": I'm guessing you are using the ui project generator thingy - and it has a warning and explanation for the quick fix

there are some issues, like when you already have a project to kinda merge it with these templates - or the naming issue, I recall that too
but it has been a while and the code may have changed

if time/work wasn't an issue, I would suggest an eclipse plugin itself. It would have dependencies on those needed plugins and you could just go "new libgdx project" and so on

Offline Mike

JGO Wizard


Medals: 74
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #22 - Posted 2012-12-31 22:32:02 »

An Eclipse Plugin would be an awesome way to set it up!

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline LunaticEdit

Senior Member


Medals: 8
Projects: 1



« Reply #23 - Posted 2012-12-31 22:37:32 »

Just reporting in that porting to libgdx went pretty well. The major issue I ran into was the fact that jBox2d is SLIGHTLY different from stock. It's not super changed, but it's changed ~just enough~ to be annoying. The last thing I have to solve is why I'm getting crashes on body removal; it was rock solid with official jbox2d, but is crashy using the libgdx version. I'm also not sure why you guys decided to do things like rename ENUMs and such. For example, is it REALLY necessary to change BodyType.DYNAMIC to BodyDef.BodyType.DynamicBody? Body on the end is a bit redundent as it is off of the BodyType enum.

Nonetheless, I got to take my android to work and show off my game so in the end it went pretty well.

Offline ReBirth
« Reply #24 - Posted 2013-01-01 00:06:16 »

Stay on official Gdx project setup, it's safer and guaranteed to be working.

Offline _Scyth_

Junior Member





« Reply #25 - Posted 2013-01-01 00:55:10 »

Thank's, I got it setup, and am learning it.

Sorry, I thought code.google.com was just code but when i went on it, I followed a few tutorials on it. It's quite good.
Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #26 - Posted 2013-01-01 01:36:23 »

Like I said, be very careful - several parts of LibGDX have been replaced and some of those tutorials are deprecated/outdated.
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #27 - Posted 2013-01-01 14:26:49 »

It IS sad. The only problem is linux and mac distribution - if it was available by default, it wouldn't be a problem.
Not that I use 7 features...

It's pretty solid on linux now... Switched to java 7 since about 3 months ago. Never had any problems with it. Liked the String-switches and the new File IO Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Ultroman

JGO Knight


Medals: 25
Projects: 1


Snappin' at snizzes since '83


« Reply #28 - Posted 2013-01-01 17:41:47 »

Is there anything we can do to make this easier? I'm a bit at a loss, feedback is appreciated.
If there is, I don't see it. People can't expect everything to go well the first time they do something. That's why we have prototyping in the first place. There will always be newbies asking these questions, because they got stuck halfway through the first set up, and feel they've exhausted google by searching "this library does not work help", instead of searching for "libgdx project setup tutorial".

Learn by doing, and if after 2-3 hours you still haven't got anything on the screen, and you've been following a tutorial, then ask your question on a forum. The best way to learn how something works, is to stick your hand in it, and feel around. Don't think you're starting your awesome platform game the first time you set up libgdx. Getting Box2D physics implemented will take a long time, especially if you had problems with something as simple as the project setup. Just take it slow, and be happy for each new piece you get working.

- Jonas
Offline davedes
« Reply #29 - Posted 2013-01-01 18:10:30 »

Quote
People can't expect everything to go well the first time they do something.
The first priority of a game development toolset should be easy set up. Press button A to download, press button B to install, press button C to compile and run your first game.

LibGDX is pretty easy to set up right now, but as with everything in life, there is still room for improvement. Smiley

Pages: [1] 2
  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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (24 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (48 views)
2014-08-09 21:09:32
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!