Simulating ALT+ENTER through code.

General FreeBASIC programming questions.
Post Reply
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Simulating ALT+ENTER through code.

Post by relsoft »

Hi anyone knows how to simulate ALT+ENTER through code? I don't want to call screenres again and load my assets just to switch from Windowed to Fullscreen.

Thanks!

Oh yeah, it has to be cross-platform.
Cherry
Posts: 358
Joined: Oct 23, 2007 12:06
Location: Austria
Contact:

Re: Simulating ALT+ENTER through code.

Post by Cherry »

Well, then I would just save the screen contents into an image buffer (and the cursor position and current color, if needed), call screenres and load the data back from the buffer to the screen.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Re: Simulating ALT+ENTER through code.

Post by relsoft »

Cherry wrote:Well, then I would just save the screen contents into an image buffer (and the cursor position and current color, if needed), call screenres and load the data back from the buffer to the screen.
The idea is not to use screenres. I have done this by using screenres but it seems hackish and i needed to reload gfx assets for opengl screens.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Simulating ALT+ENTER through code.

Post by D.J.Peters »

The FreeBASIC gfx lib is limited to a fixed size (the result of Screen() or ScreenRes())
The gfx window has one device context and in the case of opengl one render context also.
If you change the size of the window a new device context is created and the old opengl render context are destroyed.

If you need a resizeable opengl environment you have to use lib's like glut or better freeglut.

With this or other libs you can enter or leave a fullscreen environment without to destroy the opengl render context.

Currently i use the glCanvas from the IUP lib i can switch between DesktopFullSize or any WindowSize
and i can share the opengl rendercontext with other windows also.

With this feature you can have more views of your scene in diffrent windows (top,left,camera ..)
and all windows share the same glLists and textures.

Joshy
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Re: Simulating ALT+ENTER through code.

Post by relsoft »

D.J.Peters wrote:The FreeBASIC gfx lib is limited to a fixed size (the result of Screen() or ScreenRes())
The gfx window has one device context and in the case of opengl one render context also.
If you change the size of the window a new device context is created and the old opengl render context are destroyed.

If you need a resizeable opengl environment you have to use lib's like glut or better freeglut.

With this or other libs you can enter or leave a fullscreen environment without to destroy the opengl render context.

Currently i use the glCanvas from the IUP lib i can switch between DesktopFullSize or any WindowSize
and i can share the opengl rendercontext with other windows also.

With this feature you can have more views of your scene in diffrent windows (top,left,camera ..)
and all windows share the same glLists and textures.

Joshy
I generally use glfw for this on a non FB language:

http://rel.phatcode.net/junk.php?id=129

But I was wondering if there is a workaround for gfxlib2.
Cherry
Posts: 358
Joined: Oct 23, 2007 12:06
Location: Austria
Contact:

Re: Simulating ALT+ENTER through code.

Post by Cherry »

relsoft wrote:
Cherry wrote:Well, then I would just save the screen contents into an image buffer (and the cursor position and current color, if needed), call screenres and load the data back from the buffer to the screen.
The idea is not to use screenres. I have done this by using screenres but it seems hackish and i needed to reload gfx assets for opengl screens.
Oh, I understand. I didn't know about the OpenGL problem (for gfxlib-only screens this should work fine).
Post Reply