Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Alternatives to Swing  (Read 1737 times)
0 Members and 1 Guest are viewing this topic.
Offline fletchergames

Senior Member





« Posted 2007-05-07 21:51:15 »

Swing doesn't seem as slow to me as some say it is.  However, there is at least one issue that could be faster: Swing has its own double buffering.  Shutting it off causes flicker even when I use a BufferStrategy.  I certainly don't need to double buffer twice.

The obvious alternative is the AWT.  The problem I have with the AWT is that it has only a tiny percentage of the features that Swing does.

One issue that I have with both AWT and Swing is the AWT Event Dispatch Thread.  Now that I know a bit about Swing, it's not that big of a deal, but it's still annoying.  I would rather call a method like "checkForKeyboardInput" than have AWT's passive input-checking.  This seems to be a common preference among game programmers.  I would rather not have the AWT Event Dispatch Thread and have everything included in my main loop with a few simple method calls.  Then I could use multithreading as needed and have it in my own control.

There's SWT, but that doesn't seem to be able to use full-screen exclusive mode.  It also isn't that much different from Swing.  Though it's better in some ways, it's also worse in others.

I've heard of various game programming libraries.  Slick seems to be the most programmer friendly.  Jogl and LWGL are very low level libraries that serve the same purpose.  Do any of these libraries (or others) include any alternative gui?

What is everyone else here using?  Though I can't change for the project I'm almost done with or the project that I'm going to revisit briefly, I may change we start our next new project.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2007-05-07 22:08:31 »

I think double-doublebuffering is the least of your problems. The last 'blit' of a big buffer to another big buffer should be 'fast enough' in most cases.

About the input-handling: I remember kevin glass wrote an input-framework that could be backed by quite a few implementations, like AWT/Swing, JInput and LWJGL. The front-end had methods like isKeyDown(...) and could iterate over the (queued) events.

I bet you'll find it somewhere on cokeandcode or newdawnsoftware, otherwise google might find it, or kevin himself might point you in the right direction!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Linuxhippy

Senior Member


Medals: 1


Java games rock!


« Reply #2 - Posted 2007-05-07 22:26:58 »

I wrote a quite large project using LwVCL
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline broumbroum

Junior Member





« Reply #3 - Posted 2007-05-07 22:58:23 »

hi!
I've been developing under Java2 for a while with AWT/Swing libs to make a small 2Dimensional game framework, LJGWL-like but on my own.
It is seemly important to use DBffr' for any real-time Graphics application, if you intend to get an user.friendly interface.

So I also faced the EDT issues about refresh speed, both with AWT and Swing. Therefore I looked for another way to render components, and that is, JCSP which involves USA students in the project. JCSP for Java communicating seuential processes renders Java components throughout an integrated Channels-Processes network that make the Components Active.

You can find some piece of my work-in-progress at souceforge.net listed below. I'm about to get the graphics rendering active. And also at JCSP they're gonna get out of the Swing implementation of their project.
 Grin 

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline fletchergames

Senior Member





« Reply #4 - Posted 2007-05-08 18:20:56 »

I've written my own "GameKeyListener" with methods like isKeyPressed, wasKeyReleased, etc.  It's mostly the strange weirdness that happens from time-to-time that I don't like.

For instance, I added my KeyListener to every component in my game due to focusing issues.  It wouldn't be a problem if I just drew whatever I wanted onto the JFrame, but I use actual Swing components.  I request focus as necessary and make as many components as possible unfocusable, but it doesn't work well enough.

Since I'm detected key presses no matter what screen is being displayed (each "screen" is a different card in a card layout), I was detecting Escape key releases on the menu screen (the Escape key is used in the game screen to go to the menu screen).  This caused the game to freeze after returning to the game screen.  I don't know exactly why this happened, but explicitly checking for input in the menu screen (and then ignoring the input) fixed this bug.  It shouldn't have mattered because I was clearing the input when I shifted screens anyways, but it did.

That's a problem I fixed, but it was annoying.  I want the power of Swing without having to use code I don't understand.  I've learned more about Swing, but not enough to write perfect code.  It's just one of those problems we all have to deal with.

I have tried writing my own gui code in both C and Java.  I've had some limitted success, but Swing is by far better.  That's not much of a surprise as it was written by professionals.  Still, I like having complete control of my code.

LwVCL seems like an acceptable alternative to Swing.  Some items look strange when selected, but that's probably configurable.

JCSP seems to claim to magically fix the multithreading issues I was complaining about.

Both libraries seem to still use the AWT in some way.  They also both seem to have no tutorials, but they do have javadoc-created documentation.  I think it wouldn't be too hard to figure out either one of them.

It's weird, but I think what I really want is to implement most of the same features myself but in a vastly different way.  From previous experience, I know that it would probably take me years and that I would probably just find out that I like the already available ways better.

If I had a little bit more than 10 times the amount of money I have now, I could live at poverty level indefinetly from the interest alone (if I ignore inflation).  And then I could do sit down and write my own gui library.  As it is, I guess I'll take some time after my current project's done to try out some of the libraries mentioned and see which one is the best for me.
Offline cylab

JGO Ninja


Medals: 43



« Reply #5 - Posted 2007-05-08 23:11:25 »

If you just need a GUI in your game and are not searching for a general purpose swing replacement, FengGui seems to provide a reasonable set of GUI components for OpenGL games.

Mathias - I Know What [you] Did Last Summer!
Offline fletchergames

Senior Member





« Reply #6 - Posted 2007-05-10 16:00:01 »

FengGui looks ok, and seems to be better documented than the other options.  I've added it to my list of libraries to look at.

I think I'll have to include the full embedded JRE anyways to satisfy Sun's license, so replacing Swing completely wouldn't help me that much.
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.

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

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

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

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

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

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

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

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

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56
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!