_Scyth_
|
 |
«
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
|
|
|
|
|
matheus23
|
 |
«
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.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
_Scyth_
|
 |
«
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?
|
|
|
|
matheus23
|
 |
«
Reply #4 - Posted
2012-12-30 17:29:06 » |
|
Write your game code in "game", and start your game via "game-desktop".
|
|
|
|
Jimmt
|
 |
«
Reply #5 - Posted
2012-12-30 17:30:24 » |
|
http://www.youtube.com/watch?v=nOQt94fcoFoHow 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.
|
|
|
|
_Scyth_
|
 |
«
Reply #6 - Posted
2012-12-30 17:38:48 » |
|
Thanks matheus  @Jimmit, all that kept coming up was code.google.com or whatever
|
|
|
|
|
Jimmt
|
 |
«
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.
|
|
|
|
Ultroman
|
 |
«
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!
|
|
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. 
|
|
|
|
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.
|
|
|
|
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.  Just my two cents...
|
|
|
|
LunaticEdit
|
 |
«
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.
|
|
|
|
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.
|
|
|
|
LunaticEdit
|
 |
«
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..
|
|
|
|
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... 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....
|
|
|
|
LunaticEdit
|
 |
«
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... 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...
|
|
|
|
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. 
|
|
|
|
|
Mike
|
 |
«
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  ) 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
|
|
|
|
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  ) 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
|
|
|
|
Mike
|
 |
«
Reply #22 - Posted
2012-12-31 22:32:02 » |
|
An Eclipse Plugin would be an awesome way to set it up!
Mike
|
|
|
|
LunaticEdit
|
 |
«
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.
|
|
|
|
ReBirth
|
 |
«
Reply #24 - Posted
2013-01-01 00:06:16 » |
|
Stay on official Gdx project setup, it's safer and guaranteed to be working.
|
|
|
|
_Scyth_
|
 |
«
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.
|
|
|
|
Jimmt
|
 |
«
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.
|
|
|
|
matheus23
|
 |
«
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 
|
|
|
|
Ultroman
|
 |
«
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
|
|
|
davedes
|
 |
«
Reply #29 - Posted
2013-01-01 18:10:30 » |
|
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. 
|
|
|
|
|