Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Maximized Windowed Resolution Error

Author
Message
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 11th Dec 2013 14:04
Hey everybody,

I'm working on function that change the resolution whenever you manually resize a 'windowed' screen. I have a little process that compensates for the actual window borders.Whenever I have a new resolution, I adapt the actual window size so everything looks perfectly fine. Works great!



The problem is a maximised 'windowed' screen... I cannot resize the window, since it's at it's max. If I wish to adapt the resolution itself, I get an error that that resolution is not supported.

Anyone else ran into this problem or know of another way to get a fitting 3D screen into a maximised 'windowed' window?

Thanks!

Regards Sph!nx
www.mental-image.net
Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Dec 2013 14:56
Isn't it just set display mode desktop width(), desktop height, 32, ... when its maximized..?


"Why do programmers get Halloween and Christmas mixed up?"
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 11th Dec 2013 15:05 Edited at: 11th Dec 2013 15:08
Hey Rudolpho,

Nope, I'm afraid not. I've tested it with several images with different grids (also 1x1) and it clearly shows errors in the render (Cropping). Whenever I retrieve the resolutions by screen width()/screen height() it gives desktop resolution, but it does not match.

For non-maximized 'windowed' windows I retrieve the border data from the DLL and resize the actual window... but that does not work in maximized mode and adapting the resolution height gives the error (problem in maximised window is height, not the borders on the side, like in non-maximised.)

Regards Sph!nx
www.mental-image.net
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 11th Dec 2013 20:54
Been there.

What is a maximized window? With or without launchbar visible? For example, some apps like installers have maximized window height = screen height and are hover the launchbar.

Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Dec 2013 21:06
So you want the exact dimensions of the renderable area without the borders, title bar and taskbar?
I think the italic part is what is causing you troubles in that case.


"Why do programmers get Halloween and Christmas mixed up?"
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 11th Dec 2013 21:12
Quote: "and taskbar?"

I thought it is called launchbar...

I am sure that there is a function to get it's height.

Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 11th Dec 2013 21:16 Edited at: 11th Dec 2013 21:21
Quote: "So you want the exact dimensions of the renderable area without the borders, title bar and taskbar?
I think the italic part is what is causing you troubles in that case."


Exactly! I thought I did that in the function that reads the dll (see the snippet in first post), but whenever I use those, I get an crash telling me that the resolutions are unsupported or something.

Any ideas on how to get those proper values?

Quote: "...italic part is what is causing you troubles in that case."
What do you mean by Italic part?

Edit
mr Handy, missed your first post. Will check out the link! ty

Regards Sph!nx
www.mental-image.net
Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Dec 2013 22:50
Quote: "I thought it is called launchbar..."

Maybe it is now, think it was called the taskbar in Windows XP at least, but they do like to change the names of things...

Quote: "What do you mean by Italic part?"

The slanted text (like bold but the other thing).

Anyway, I had a look and this seems to work:


I admit it was a bit hidden away in a function you wouldn't directly think of in this context.


"Why do programmers get Halloween and Christmas mixed up?"
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 11th Dec 2013 23:01
It's the taskbar yes.

Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 12th Dec 2013 01:11 Edited at: 12th Dec 2013 01:13
Thanks Rudolpho, but it did not work.

Tried both setting the desktop resolution, which gives a visual error in the loaded image. When setting resolution by the retrieved data from the dll, I get an error.

Here is your code I altered for what I need:

I've blocked the line that set the resolution to retreived data...that one give the error message.

For test image I use a 1024x1024 black and white grid image of grid size 1x1... so all overlapping or stretching of pixels are visible.

Regards Sph!nx
www.mental-image.net
Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 12th Dec 2013 01:43
You can only set the display mode to one that is supported by your graphics card. Usually these are common 4:3 / 16:9 resolutions.
Anything in-between will result in stretching.
What you can do is set the display mode to the closest higher resolution than your window and then set camera view to trim away the parts that aren't visible due to your window borders etc.

So for a maximized window you would then set the display mode to your full desktop resolution and change the camera view to those values I guess (I've never tried though, but theoretically it should work I believe).
What I meant by "it seems to work" was that if I took a screenshot and put it in photoshop, the dimensions of the client area of the window seemed to indeed match the values returned by that approach.


"Why do programmers get Halloween and Christmas mixed up?"
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 12th Dec 2013 14:25
Thanks for all your help so far Rudolpho, much appreciated!

For non maximised I stretch the window or im maximised adapt the resolution (which does not work) but I haven't thought of camera view. Still experimenting away!

I'll post my end results here when I'm done!

Regards Sph!nx
www.mental-image.net
MonoCoder
19
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 12th Dec 2013 17:49
I've expanded some of the given code into an example as I've had trouble with this too and I'm quite sure it's a bug in dbp. Hopefully it can help clarifying the issue.

This lets you minimise and maximise the window, and drag it around in normal state. Additionally, press F and it will take up the full screen (this doesn't break, funnily enough), and press R to return to the previous state.



As you can see, when the window is maximised, I set the dbp display mode to be 1 pixel less than the desired width (the window itself can be the full size, no issue). Set display mode to the full width, however, and the program crashes. This is the issue, and the only workarounds are resorting to fullscreening, manually forcing the maximised window to be a pixel thinner, or just putting up with the artifact pictured here (I suspect that for anything more than a blank screen, that'll be unacceptably distracting).
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 12th Dec 2013 17:56
Wow, Thanks MonoCoder! I've compiled it and will study it carefully!

I also have another solution, kinda working.

When maximising this happens:
- Restore (window)
- set desktop resolution
- Move window to 0,0,0

Still needs to be added:
- Find out what monitor/resolution is used and adapt to that data

The biggest problem with this is, that the window is basically restored, so the restore action is no longer possible. A workaround is to write my own function, but I have no clue on how to manipulate the titlebar button.

Regards Sph!nx
www.mental-image.net

Login to post a reply

Server time is: 2025-05-17 11:03:11
Your offset time is: 2025-05-17 11:03:11