Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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  
  GUI for active rendering in Java2D  (Read 2159 times)
0 Members and 1 Guest are viewing this topic.
Offline kaffiene
« Posted 2012-11-29 01:53:23 »

I wrote a basic little artillery game in Java2D which runs well and looks pretty good.  Then I went to add some GUI elements to it.  Swing doesn't really work under active rendering.  Does anyone know of any good GUI toolkits that will work with active rendering?

Not the end of the world if there's nothing available - I'll just convert the code to libgdx or lwjgl.  That said, it runs great now so I'd like to avoid rearchitecting unless I absolutely have to.
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #1 - Posted 2012-11-29 02:03:37 »

I think a lot of times people have the main application utilize the standard swing GUI elements and such, or whatever standard toolkit of your choice

and then have an embedded`panel` in the screen, which utilizes active rendering.


"Experience is what you get when you did not get what you wanted"
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #2 - Posted 2012-11-29 06:14:50 »

Nope none that I know of. Back when I used to use Java2D, I simply created my own GUI "framework" that just consisted of a Button, Label, and Slider with update and render methods.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kaffiene
« Reply #3 - Posted 2012-11-29 07:18:01 »

that's what I started doing before I figured it wasn't the best use of my time :o)
Offline davedes
« Reply #4 - Posted 2012-11-29 07:29:57 »

Java2D isn't the best use of your time... Undecided

Offline kaffiene
« Reply #5 - Posted 2012-11-29 20:16:10 »

Java2D isn't the best use of your time... Undecided

My game is looking good and running at hundred to thousands of frames per second.  There's nothing wrong with Java2D for the right kind of game.
Offline theagentd

« JGO Bitwise Duke »


Medals: 366
Projects: 2
Exp: 8 years



« Reply #6 - Posted 2012-11-29 21:20:47 »

There's nothing wrong with Java2D for the right kind of game on the right kind of computers.

FTFY

Myomyomyo.
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #7 - Posted 2012-11-29 22:51:33 »

namrog84's suggestion is the way to go. Use a standard JFrame with normal Swing components and put your active rendered code on a panel by itself.

Offline noblemaster

« JGO Spiffy Duke »


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #8 - Posted 2012-11-30 03:24:07 »

You can tell Swing to do active rendering (although the article is in the "fullscreen" section, it works under windowed mode too!):
http://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html

Here is how to disable passive rendering:
Quote
Use the setIgnoreRepaint method on your application window and components to turn off all paint events dispatched from the operating system completely, since these may be called during inappropriate times, or worse, end up calling paint, which can lead to race conditions between the AWT event thread and your rendering loop.

Offline kaffiene
« Reply #9 - Posted 2012-12-01 13:09:10 »

Thanks for the suggestions, guys.

I decided not to go for the idea of having the active rendered content on another panel - that doesn't work for my design.

@noblemaster: yeah, I've read that stuff already: it doesn't work, or at least it didn't for me.

I've gone with refactoring the code into LWJGL code, rather than compromising the design.  It's been pretty easy: I just set the viewport upside down and the coordinates are all the same as the Java2d version so the code is happy.
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.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (60 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!