Slick Forums

Discuss the Slick 2D Library
It is currently Sun Apr 20, 2014 3:11 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: App.setUndecorated?
PostPosted: Mon May 14, 2012 10:22 am 
Offline

Joined: Sun May 13, 2012 2:47 pm
Posts: 22
Hey, I bet that (almost) everyone here has used JFrame/Frame before Slick2D, am I right?

Before I used Slick2D and tried to make games with JFrame, I did frame.setUndecorated for me to make my own frames/borders.
Is this function included in Slick2D? If not, could it be added in the future? Also, is there a way to use these?

setAlwaysOnTop
setVisible
setOpacity

And a few others?

Could I add it myself? If yes, how?

_________________
Realistic graphics is for game designers without creativity.

Let's bring the wonder of technology into and cave and smash it so that we can have smashing cave technology!

The best way to learn about life is through death.


Top
 Profile  
 
 Post subject: Re: App.setUndecorated?
PostPosted: Mon May 14, 2012 11:46 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
setAlwaysOnTop
Not possible with LWJGL (native) Display. You can't request focus. A future release of LWJGL (3.0) has some things like this planned, but until then you might be able to achieve this with CanvasGameContainer + JWindow parent.

setVisible
Not possible with native display. You could achieve this with CanvasGameContainer.

setOpacity
Not possible without diving into native code and implementing it yourself for each platform. You could try CanvasGameContainer with a fancy JFrame, e.g. some Java 7 code.

undecorated
You can get this with a hidden LWJGL VM switch.
Code:
org.lwjgl.opengl.Window.undecorated=true


Reliable? I'm not sure. Maybe JWindow or an undecorated JFrame + CanvasGameContainer would be more reliable. I'd say test it out and see what works best for your game and your target audience.

If you want to add things like transparent windows, focusing, etc. to the LWJGL display, you'll need to poke around with the native code and implement it differently for each platform that you're supporting. Possible, but not easy.


Top
 Profile  
 
 Post subject: Re: App.setUndecorated?
PostPosted: Tue May 15, 2012 5:30 am 
Offline

Joined: Sun May 13, 2012 2:47 pm
Posts: 22
Thanks, yeah, working with the native code doesn't sound easy. It's the decorated part that is most important.

Edit: Where do I put it that line? I used System.setProperty(" org.lwjgl.opengl.Window.undecorated", "true"); But it didn't work.

Code:
package Main;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import Main.DATA.APP_DATA;


public class Main extends StateBasedGame{
   
   public static APP_DATA App = new APP_DATA();
   
   public static final int INTRO_0001 = 0;
   public static final int INTRO_0002 = 1;
   public static final int INTRO_0003 = 2;
   public static final int INTRO_0004 = 3;
   public static final int INTRO_0005 = 4;
   public static final int INTRO_0006 = 5;
   public static final int INTRO_0007 = 6;
   public static final int INTRO_0008 = 7;
   public static final int INTRO_0009 = 8;
   
   public Main(String name) {
      super(name);
      
      //Tried here
   }

   /**
    * @param args
    */
   

   @Override
   public void initStatesList(GameContainer gc) throws SlickException {
      //Tried here
      this.addState(new state_0001(INTRO_0001));
      this.addState(new state_0002(INTRO_0002));
      this.addState(new state_0003(INTRO_0003));
      this.addState(new state_0004(INTRO_0004));
      this.addState(new state_0005(INTRO_0005));
      this.addState(new state_0006(INTRO_0006));
      this.addState(new state_0007(INTRO_0007));
      this.addState(new state_0008(INTRO_0008));
      this.addState(new state_0009(INTRO_0009));
      this.enterState(INTRO_0001);
   }
   
   public static void main(String[] args) throws SlickException {
      //Tried here
      APP_DATA.app = new AppGameContainer(new Main("Funny"));
      APP_DATA.app.setDisplayMode(800, 600, false);
      APP_DATA.app.setShowFPS(false);
      APP_DATA.app.setTargetFrameRate(60);
      APP_DATA.app.start();
      //Tried here
   }
}


I also tried to add it to the VM project in eclipse, but doesn't work neither.

_________________
Realistic graphics is for game designers without creativity.

Let's bring the wonder of technology into and cave and smash it so that we can have smashing cave technology!

The best way to learn about life is through death.


Top
 Profile  
 
 Post subject: Re: App.setUndecorated?
PostPosted: Tue May 15, 2012 1:32 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
JVM argument would look like this:
Code:
-Dorg.lwjgl.opengl.Window.undecorated=true


It should work, but if it doesn't you may be stuck using a JFrame/JWindow.


Top
 Profile  
 
 Post subject: Re: App.setUndecorated?
PostPosted: Tue May 15, 2012 2:48 pm 
Offline

Joined: Sun May 13, 2012 2:47 pm
Posts: 22
Thanks, but the problem is that Window doesn't exist. I don't know if I am doing it wrong.
It seems that it should work, if it says that you can do in undecorated, I am sure that it would work.

Can you maybe send me something like an eclipse project?
Thanks!

_________________
Realistic graphics is for game designers without creativity.

Let's bring the wonder of technology into and cave and smash it so that we can have smashing cave technology!

The best way to learn about life is through death.


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

All times are UTC


Who is online

Users browsing this forum: No registered users 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