Slick Forums

Discuss the Slick 2D Library
It is currently Fri Apr 18, 2014 10:35 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue May 27, 2008 11:21 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Is it possible to have my Slick game in a resizable window? Do I have to use CanvasGameContainer for this?

I would just be using the resizable window for easy of testing. My game will (probably) always be fullscreen, but testing it this way ensures it works at any resolution.

Maybe I'm taking the wrong approach... So far I've been developing my game to support rendering properly for any size window. This way users can make full use of higher resolution screens. I have seen ScaledGameContainer, but for my game, truly supporting the higher resolution allows more players to play simultaneously on a single monitor.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 11:37 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Yes, you need to use CanvasGameContainer.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 1:42 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
K, works for me. I did find the API somewhat awkward in one place...
Code:
((AppGameContainer)canvasContainer.getContainer()).setForceExit(false);


Hmmm... I have a simple Swing UI that configures and starts my game. If I run my game, exit the game, then run it again, the TT fonts are corrupted and images are all white. What do I need to do to stop the game correctly?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 7:17 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
You need to use the same thread to start the GUI the second time. The thread is what keys the instance of OpenGL. You might get away with turning shared context on, I think thats in the AppGameContainer interface also.

If you haven't already could you raise an RFE to have that API changed, it's a relict of when canvas and app game containers were considerbly different.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 7:45 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
GameContainer.enableSharedContext(); // == fabulous :)

RFE created.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 28, 2009 9:39 am 
Offline

Joined: Mon Sep 28, 2009 9:34 am
Posts: 3
Sorry to open up an old thread.

I would just like to know if you got this working in a smooth manner NateS?

I have a JFrame with a CanvasGameContainer in it and I'm rendering a jpg as a background image. During resize, there's a lot of flickering going on.

I did try to force double buffering upon it, but I saw no improvement.

Any ideas?

Cheers,
Viktor


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 29, 2009 4:42 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
I don't think there is a solution. Flicker on window resize doesn't look great, but isn't too big of a deal since it happens so rarely, right?

_________________
SingSong Karaoke - http://singthegame.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 29, 2009 9:30 am 
Offline

Joined: Mon Sep 28, 2009 9:34 am
Posts: 3
Hmmm. But I'm talking about a _lot_ of flickering, including weird blocky patterns.

I have created a vanilla Swing frame with a background and there are no issues there.

Without having dug through the code, I'm guessing that there might be conflicts between Swing's updates and Slick's render loop. Could that be a lead? Maybe I could pause the game loop during resize?

Thanks a lot!

//V


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 01, 2009 12:20 pm 
Offline

Joined: Mon Sep 28, 2009 9:34 am
Posts: 3
Solved!

NateS, why didn't you tell me that you had already solved it? : )

I found this tip from you in another thread:

"Use GameContainer#setAlwaysRender(true)."

(Thread was: http://slick.javaunlimited.net/viewtopic.php?p=10580)

Resize is now smoooooth!

//Viktor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: Dan and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group