Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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  
  Library Question  (Read 1091 times)
0 Members and 1 Guest are viewing this topic.
Offline Hazzy

Senior Newbie





« Posted 2011-12-05 10:59:07 »

I've been using the built in Java 2D libraries during my time learning Java but it really is a pain trying to get my program to work cross platform. I could test my game in Windows which would work fine; move to Linux and suddenly the whole thing is broke.

I was looking at libgdx which I grew fairly fond of, because you know, it just 'works'. My only problem with it is the reversed y coordinates which does my head in.
Now I'm taking my time learning JOGL but all I want to focus on is 2d graphics, not entirely focusing on 3d just yet.
Right now I'm unsure what to do (Stick with JOGL or is it overkill?) because I just want something that works without all the hassle of getting it to work on multiple platforms, or at least less problems than what the native Java libraries provide.

Would be helpful if anyone could give me a run-down on this.

Thanks!
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #1 - Posted 2011-12-05 11:02:20 »

JOGL is probably too low level an API for your requirements in this case.

There is most likely a way to flip the Y coordinates in LibGDX and as you are already invested in it, you should probably look up how to do that first.

If however you are looking for an alternative you should have a look at the Slick2D library, it has all the bells and whistles that a 2d games library needs and as you already know Java2D you won't have much of a problem moving over as the API's are very similar.
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #2 - Posted 2011-12-05 11:37:06 »

Define broke? I have my own gripes with java2d. But so far things have worked on all targets (windows, linux,mac, sun). My biggest problems have been high end performance. But i wouldn't call that broke.

I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2011-12-05 11:46:57 »

Hi

You can still tinker OpenGL a very little bit to flip the Y coordinates once for all, maybe with glRasterPos as I did in 2006. If this is the main problem with JOGL, you can go on using it. JOGL has an (experimental) Java2D bridge, maybe it could be useful in your case:
http://forum.jogamp.org/useful-Java2D-bridge-td3391708.html

JGame could do the job too and it is a bit less low level:
http://www.13thmonkey.org/~boris/jgame/

Slick2D is more used and maintained than JGame. As far as I know, LibGDX is less high level than Slick2D. Slick has a LibGDX backend and LibGDX can work with JOGL but I don't know which version it uses.

Define broke? I have my own gripes with java2d. But so far things have worked on all targets (windows, linux,mac, sun). My biggest problems have been high end performance. But i wouldn't call that broke.
I agree with you. The lack of speed was my main concern but it worked fine for my purposes.

Offline Hazzy

Senior Newbie





« Reply #4 - Posted 2011-12-05 11:57:40 »

JOGL is probably too low level for your requirements. You should have a look at the Slick2D library, it has all the bells and whistles that a 2d games library needs and as you already know Java2D you won't have much of a problem moving over as the API's are very similar.

In any event there is probably a way to flip the coordinates in LibGDX and as you are already invested in it, you should probably look up how to do that first.
Thanks, I found a way to flip the coordinates in libGDX from Google, so I have something else I need to look into more. :p (Cameras)
Taking a little look into Slick anyhow and I might have a try with LWJGL too and see how that goes.

Define broke? I have my own gripes with java2d. But so far things have worked on all targets (windows, linux,mac, sun). My biggest problems have been high end performance. But i wouldn't call that broke.
It did work fine for me, just I was spending too much time looking around for solutions to why something wouldn't work on another operating system.
Felt like dealing with IE6 all over again in terms of web development lol.
Offline gouessej
« Reply #5 - Posted 2011-12-05 12:06:30 »

Thanks, I found a way to flip the coordinates in libGDX from Google, so I have something else I need to look into more. :p (Cameras)
Taking a little look into Slick anyhow and I might have a try with LWJGL too and see how that goes.
LWJGL and JogAmp (JOGL + JOAL + JOCL) are quite similar and anyway what you did in LibGDX can be done in JOGL or LWJGL too.

It did work fine for me, just I was spending too much time looking around for solutions to why something wouldn't work on another operating system.
Felt like dealing with IE6 all over again in terms of web development lol.
Can you be more precise? What was broken in Java2D in your humble opinion? If it was a general problem with applets, giving up Java2D won't solve it.

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #6 - Posted 2011-12-05 12:06:55 »

Quote
It did work fine for me, just I was spending too much time looking around for solutions to why something wouldn't work on another operating system.
Felt like dealing with IE6 all over again in terms of web development lol.
So it worked, but it felt like it didn't work? I change 0 lines of code for the stuff i deploy on all targets... there are no workarounds. I have a lot of users for my work code. I am interested in what things didn't work cross platform.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Hazzy

Senior Newbie





« Reply #7 - Posted 2011-12-05 12:35:24 »

I guess I worded it wrong when I said that it was broke lol, as my problems were never exactly related to Java2D.
I didn't do any development with applets with it either.

No issues in terms of graphics though.

Everything else was just required a little extra work, for example playing sounds or getting form focus as it seemed to have different results from machine to machine for some reason.
I never managed to successfully get sound to work on Linux though, I was forced to reload every sound file I wanted to use because they would only play once, yet in Windows they would play infinite amount of times.

I guess I just forced my issues onto Java2D since I expected it to relate to everything else such as sound, input, etc... Which I was obviously wrong.
Heck, could just be my bad code. :p
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #8 - Posted 2011-12-05 12:41:34 »

The only thing that sux worse that the default java sound is linux sound. I have personally solved this by using openal via lwjgl.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline gouessej
« Reply #9 - Posted 2011-12-05 12:54:24 »

I never managed to successfully get sound to work on Linux though, I was forced to reload every sound file I wanted to use because they would only play once, yet in Windows they would play infinite amount of times.
Paul Lamb Sound Library and his single line mixer work fine even on Linux. Personally, I have been preparing my switch from Java Sound to OpenAL via JOAL 1.1.3 as it works like a charm Smiley

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

Senior Newbie





« Reply #10 - Posted 2011-12-05 13:00:59 »

Hah, I'm not the only one!
I feel a little happier inside.

Well I seem pretty satisfied with learning LWJGL so far, plenty of tutorials which are short and sweet Smiley.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #11 - Posted 2011-12-05 13:30:23 »

Well I seem pretty satisfied with learning LWJGL so far, plenty of tutorials which are short and sweet Smiley.
Do keep in mind that LWJGL is mostly just a low level binding to raw native libraries (like OpenGL, OpenAL, OpenCL), so to get to a point where you'll be able to write 2d games with it you'll not only have to know how to use OpenGL and OpenAL but also have to write some framework & boilerplate code and use various utility libraries (unless you write your own) to handle stuff like texture and sound loading. Once you're done you'll end up with something very similar to Slick2D, SPGL, JGame, the higher level 2d API of LibGDX, etc thus having reinvented alot of the wheel. However its a good idea to use it if your aim is just learning stuff and/or you prefer building your own tools before starting to work on an actual game.
Offline Hazzy

Senior Newbie





« Reply #12 - Posted 2011-12-05 13:41:33 »

Well I seem pretty satisfied with learning LWJGL so far, plenty of tutorials which are short and sweet Smiley.
Do keep in mind that LWJGL is mostly just a low level binding to raw c libraries (like OpenGL, OpenAL, OpenCL), so to get to a point where you'll be able to write 2d games with it you'll have to write your own framework code, various boilerplate code and use various utility libraries (unless you write your own) to handle stuff like texture and sound loading. Once you're done you'll end up with something very similar to Slick2D (or similar libraries) thus having reinvented the wheel. However its fine if your into just learning stuff and/or building your own tools before starting to work on the actual game.
That's my intention. Not that I plan to make my own library like Slick, else I would just simply use Slick to begin with. I just want to understand as much as possible.
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.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (29 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (56 views)
2014-10-14 00:39:48

TehJavaDev (55 views)
2014-10-14 00:35:47

TehJavaDev (46 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
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!