+ 4

Is there an equivalent package in Java than Pygame in Python?

I like Pygame very much on Python, so that I'd want to learn Java with something similar. I know some graphical packages for Java, such as Swing, but I'ven't done much yet to learn any of those. Lists of any Java graphical packages or classes are preferred, but if there is one that is especially like Pygame it would be cool. I like Pygame because much more things in it needs to be created by yourself, compared to many other graphical packages. For example to create button, with Pygame you should know the button position and sizes, and use cursor position to know whether cursor is rolled over the button and when the wanted mouse button is pressed. In some other graphical packages you would only need to tell program that there is button and rest is done automatically.

15th Oct 2019, 2:14 PM
Seb TheS
Seb TheS - avatar
3 Antworten
+ 2
This is the question that i was looking for a very long time. Both yes and no. Since pygame is focused on 2d functionality you may not find these things in typical java libraries except 1 library and that is libGDX. Rest of the things use jmonkeygame engine and LWGL lightweight game library. Swing is purely evil because they have lots of things missing for a typical game like sprites most importantly. But it is possible to make a snake game without any sprites. Check my github for it. I have used awt and swing and i know its pain. Conclusion go for LWGL if you know openGL and very low level, go for jmonkey game engine if you want high level so much and tons of classes which supports 2D and 3D. Go for libGDX if you want the exact functions that you want from pygame which is actually mid level so it teaches you many things. personal opinion: pygame is a bae but python's oop drives me crazy like i feel i am writing a bash script. With libGDX things will get harder than pygame due to java's OOP.
15th Oct 2019, 2:47 PM
Talha Altınel (The Last Sith Lord)
Talha Altınel (The Last Sith Lord) - avatar
+ 2
But stick to libGDX so you can even release your game on a mobile after all much effort in java. LibGDX provides cross platform functionality and mid weight. Pygame is built on top of SDL which is a C library so you mostly worked with modules and their bindings rather than oop. Java will make you learn OOP more with libGDX
15th Oct 2019, 2:54 PM
Talha Altınel (The Last Sith Lord)
Talha Altınel (The Last Sith Lord) - avatar