LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: tlf30 on November 26, 2011, 00:55:14

Title: Title bar and multi window support
Post by: tlf30 on November 26, 2011, 00:55:14
I'm working on a game client, everything works good except the way the title bar looks. I was wondering if there was a way to have it take on the theme of the OS.
Title: Re: Change the look of the title bar
Post by: kappa on November 26, 2011, 01:19:42
The look of the title bar should be set automatically by the window manager of the OS, which OS are you running on?
Title: Re: Change the look of the title bar
Post by: tlf30 on December 06, 2011, 02:53:29
I'm using windows 7 pro with the alienware overlay on the OS. This is how the title bar looks:
Title: Re: Change the look of the title bar
Post by: tlf30 on December 10, 2011, 02:13:34
I have icons and a background texture for the title bar, I just need a way to swap them out with the ones lwjgl gives it.
Title: Re: Change the look of the title bar
Post by: jediTofu on December 10, 2011, 06:50:24
You'll have to set Undecorated to true:

http://www.lwjgl.org/wiki/index.php?title=LWJGL_Hidden_Switches

Then draw the title bar and mini/max/close buttons using OpenGL via LWJGL.

Else you'll have to modify the native code as there is no other way that I know of.
Title: Re: Change the look of the title bar
Post by: tlf30 on December 12, 2011, 21:10:13
Does undecorating take away the border?
Title: Re: Change the look of the title bar
Post by: jediTofu on December 13, 2011, 02:19:58
It has no border for me on linux; tested with this:

java -cp .:res:jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:jar/jinput.jar: -Djava.library.path=native/linux -Dorg.lwjgl.opengl.Window.undecorated=true org.lwjgl.test.WindowCreationTest

http://www.lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL

I assume Windows probably uses WM_POPUP or something and doesn't have border as well.
Title: Re: Change the look of the title bar
Post by: tlf30 on December 13, 2011, 03:03:19
Im not sure on doing it this way, my frame rate is already deathly low.
Title: Re: Change the look of the title bar
Post by: jediTofu on December 13, 2011, 14:02:22
You could also stick the game window inside JFrame and modify the look&feel to use your icons.  Of course, AWT's Frame would be better to use, but no idea how to modify the icons through that.
Title: Re: Change the look of the title bar
Post by: tlf30 on December 13, 2011, 17:19:52
How would I get the lwjgl canvas in a JFrame.
Title: Re: Change the look of the title bar
Post by: CodeBunny on December 14, 2011, 19:21:06
Place an AWT Canvas onto a JFrame, then:

Display.setParent(the_canvas_to_use).
Title: Re: Change the look of the title bar
Post by: tlf30 on December 14, 2011, 19:53:45
I'll try that! Thanks.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 23, 2012, 08:29:41
Changing the canvas over was voted down in my last development meeting, it there a way of adding custom title bar theme support to lwjgl?
Title: Re: Change the look of the title bar
Post by: princec on January 23, 2012, 09:01:42
Yes, tell the rest of the development team if they want to do it they have to do what you say.

Cas :)
Title: Re: Change the look of the title bar
Post by: tlf30 on January 24, 2012, 06:57:07
That wont work. Really all that we need is the correct title bar when using themes like on alienware computers.
Title: Re: Change the look of the title bar
Post by: Matzon on January 24, 2012, 08:18:36
well, send us a big fat top-specced alienware computer so we can start looking into it ;)
I am not aware of anyone else having this issue - and certainly not the developers.

I think the quickest way to fix this is to look into what is needed and implement it yourself.
Then provide a patch that we can apply.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 24, 2012, 22:16:57
If you could tell me where in lwjgl it gives the display its title bar I could build a fix.
Title: Re: Change the look of the title bar
Post by: Matzon on January 24, 2012, 23:15:56
http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/native/windows/opengl/context.c?revision=3731&view=markup
Title: Re: Change the look of the title bar
Post by: tlf30 on January 25, 2012, 00:25:07
Somthing is wrong with the lwjgl.dll when getting the system window style properties.
Title: Re: Change the look of the title bar
Post by: princec on January 25, 2012, 09:32:03
It was raining outside my house yesterday.

Cas :)
Title: Re: Change the look of the title bar
Post by: tlf30 on January 25, 2012, 16:24:27
It was snowing at my house yesterday.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 04:20:17
How can I edit the dll file to look for whats wrong? ???
Title: Re: Change the look of the title bar
Post by: princec on January 26, 2012, 08:37:52
You didn't get my hint so I shall spell it out to you: what goes wrong? Give us logs, stacktraces, outputs, descriptions. Be professional! Our time is valuable.

Cas :)
Title: Re: Change the look of the title bar
Post by: Simon Felix on January 26, 2012, 11:29:38
Why does my game not work?
Title: Re: Change the look of the title bar
Post by: Mickelukas on January 26, 2012, 11:32:27
You forgot to double click the icon, d'oh!

Mike
Title: Re: Change the look of the title bar
Post by: Evil-Devil on January 26, 2012, 16:36:14
Does that Alienware overlay work with other applications?

And seriously is it really that important?
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 20:27:55
There are no errors just the windows clasic like theme. Also it works on all programs unless they where built using lwjgl.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 20:31:50
And YES it is important. The game needs to actually work on all systems not just a little, but in all ways.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 20:50:50
Just updated to lwjgl 2.8.3 still no fix. :-\
Title: Re: Change the look of the title bar
Post by: kappa on January 26, 2012, 20:55:47
Quote from: tlf30 on January 26, 2012, 20:50:50
Just updated to lwjgl 2.8.3 still no fix. :-\
Well we can't fix a problem which we can't reproduce or know the cause of.

You should either provide some useful information or try debug LWJGL to find the source of the problem.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 21:02:17
I have never used netbeans debugger, how do I turn lwjgl on debug mod in netbeans
Title: Re: Change the look of the title bar
Post by: kappa on January 26, 2012, 21:05:36
Quote from: tlf30 on January 26, 2012, 21:02:17
I have never used netbeans debugger, how do I turn lwjgl on debug mod in netbeans

*sigh*, its not Java code you need to be looking at but likely the native Windows API part.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 21:08:00
How do I look at that?
Title: Re: Change the look of the title bar
Post by: kappa on January 26, 2012, 21:11:32
Well I'd start by writing a simple native application using the Windows API, something that just creates a window to see if it suffers from the same problem. Then I'd compare my simple program with how LWJGL creates the window to try narrow down the issue.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 21:15:39
Where will I find the window API? I have only used Swing when making GUI applications.
Title: Re: Change the look of the title bar
Post by: kappa on January 26, 2012, 21:18:06
In that case you should ask one of the other developers on your team, maybe one of them knows C and has used the Windows API.

Also do stay open to the possibility that this isn't a bug with LWJGL but the Alienware Overlay, maybe try another theme?
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 21:22:35
I'm the only one that has used C, but that was raw C for building an OS with assembly. I taught the rest of my team how to program, all they know is java. From looking at the lwjgl code it looks like the lwjgl.dll works with the windows system, there is probably somthing wrong in there, I just do not have a way to open it.
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 21:35:20
Here is the title bar on a white and black background, as you can see there are transparent parts. Also attached is the theme it should be...
Title: Re: Change the look of the title bar
Post by: tlf30 on January 26, 2012, 22:46:34
When turning off the alienwre theme it works correctly. The theme is managed with: stardock my colors
Title: Re: Change the look of the title bar
Post by: tlf30 on January 27, 2012, 22:44:33
It looks as if only themes run by stardock my colors theme manager do not work.
Title: Re: Change the look of the title bar
Post by: CodeBunny on January 28, 2012, 00:49:42
Does a JFrame have the correct look and feel, btw?
Title: Re: Change the look of the title bar
Post by: tlf30 on January 28, 2012, 00:57:37
Yes.
Title: Re: Change the look of the title bar
Post by: CodeBunny on January 29, 2012, 18:05:42
Then I would recommend that instead of messing around with native code, use Display.setParent. Its performance isn't particularly worse, and you have a fast solution to the problem. Explain to your team that it's the simplest reliable solution, and doesn't really have a downside. They're creating a restriction that is essentially pointless, and if they aren't strong programmers, they shouldn't be advising you on how to program.

Additionally, you can very easily port your game to an applet, if that is something you're interested in.
Title: Re: Change the look of the title bar
Post by: tlf30 on February 08, 2012, 06:39:24
Is there no way to download a stardock theme and look for the problem, a lot of people use stardock themes.
Title: Re: Change the look of the title bar
Post by: Simon Felix on February 08, 2012, 16:11:06
Quote from: tlf30 on February 08, 2012, 06:39:24
Is there no way to download a stardock theme and look for the problem, a lot of people use stardock themes.

Sure. You can download free themes from here:
http://www.wincustomize.com/explore/objectdock/sort/popular (http://www.wincustomize.com/explore/objectdock/sort/popular)
Title: Re: Change the look of the title bar
Post by: tlf30 on February 08, 2012, 21:56:52
AWT fails, so far the icons are not working correctly, we will have to rebuild them. Also putting the lwjgl window in AWT is glichy. I have traced the problem with the title bar to the lwjgl.dll, but I have no idea how the stardock themes work so I am not able to fix the problem. There has to be a way to get overlay themes running and apply them to the title bar because no other programs has this problem only lwjgl built ones.
Title: Re: Change the look of the title bar
Post by: Peter M Ashford on February 09, 2012, 02:46:12
Quote from: tlf30 on January 23, 2012, 08:29:41
Changing the canvas over was voted down in my last development meeting, it there a way of adding custom title bar theme support to lwjgl?

Is there any technical reason why you can't apply the solution you were given? 

It seems odd (and moderately offensive) to have a group of non-programmers rejecting the advice that a group of domain experts have given you (at great length, I might add)

Title: Re: Change the look of the title bar
Post by: Evil-Devil on February 09, 2012, 14:34:31
Stardock?!

Don't get me wrong, but you want the lwjgl team to create a fix/workaround that works with propritary software like stardock?
That's hilarious!

As CodeBunny allready suggested you should try to go with Display.setParent or switch to Fullscreen. Or is there any particular reason to have a windowed viewport?
Title: Re: Change the look of the title bar
Post by: tlf30 on February 09, 2012, 16:16:32
We need the window and fullscreen options, because some computers, esspecially thoughs that do not have the correct drivers, will have thier screens just go black. Also we have been working with fullscreen is there a way to support multiple screens?
Title: Re: Change the look of the title bar
Post by: CodeBunny on February 09, 2012, 19:25:38
Not that I know of, no. The Display is a single, static entity.

Potentially you could work out something similar with multiple AWTGLCanvases; however, that would most likely be impossible to make rigorous. Such functionality would probably be waaaay too much work for far too little payoff.
Title: Re: Change the look of the title bar
Post by: tlf30 on February 09, 2012, 19:48:36
How have other games made multipal screens work, there has got to be a was to split the canvas between 2 screens and identify them sepratly.
Title: Re: Change the look of the title bar
Post by: tlf30 on February 09, 2012, 19:53:18
IDEA:
could you open 2 windows from the same program then put each one to fullscreen on one of the 2 screens?
Title: Re: Change the look of the title bar
Post by: CodeBunny on February 09, 2012, 20:42:27
You're starting to get very far afield. I'd recommend that you focus on the topic of this thread; if you want to start a new topic on multi-monitor fullscreen apps with LWJGL, that's a better idea.

I'm not sure, but I've always assumed that multi-monitor fullscreen was something the graphics card did on its own, not something that applications managed. A quick look on Wikipedia seems to support this (http://en.wikipedia.org/wiki/Multi-monitor#Span_or_extended_desktop_mode (http://en.wikipedia.org/wiki/Multi-monitor#Span_or_extended_desktop_mode)). However, there does seem to be a mention of how you can explicitly program such functionality (http://en.wikipedia.org/wiki/Multi-monitor#Programming (http://en.wikipedia.org/wiki/Multi-monitor#Programming)).

As to your idea, that's what I was alluding to, yes. However, AWTGLCanvas is the only way to have multiple display surfaces concurrently in LWJGL, and it's been very unstable when I've used it. Additionally, you need to impose some sort of artificial mechanics to prevent one of the windows from being moved, minimized, closed, etc. without the other following suit.
Title: Re: Title bar and multi window support
Post by: tlf30 on February 10, 2012, 23:45:43
Well, if lwjgl can go into fullscreen, then there should be a way to look to see if multiple scrren are there, then be able to use each one independently.
Title: Re: Title bar and multi window support
Post by: CodeBunny on February 11, 2012, 14:02:28
...You have no idea of how the GPU / fullscreen applications work if you think that. It's simply not that easy.

You also seem to be forgetting that LWJGL is just an OpenGL wrapper API with very few embellishments (OpenAL and JInput, basically); adding a complex AI for something as esoteric as multi-monitor fullscreen is just not fully in line with LWJGL itself. Please note that a focused API is much better than an API with a bunch of random features added in. In this case, especially because this particular addition would come in priority after a long line of other functionality.

Side Note: It's confusing to randomly rename the topic on a whim - please don't do that. Again, start a new topic.