Close ScrenRes without ending program

New to FreeBASIC? Post your questions here.
Post Reply
lucidapogee
Posts: 19
Joined: Mar 06, 2023 2:07
Location: Arizona
Contact:

Close ScrenRes without ending program

Post by lucidapogee »

What's the proper way to close a ScreenRes graphics window without ending the program?
fxm
Moderator
Posts: 12110
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Close ScrenRes without ending program

Post by fxm »

Code: Select all

Screen 0
for example.

Otherwise (from SCREEN (GRAPHICS)):
Note on using Screen 0
Screen 0 closes any graphics window, but also clears the console window if it exists.
Screen 0, , , GFX_SCREEN_EXIT (with GFX_SCREEN_EXIT=&h80000000) also closes any graphics window, but does not clear the console window if it exists (previous text is preserved).
lucidapogee
Posts: 19
Joined: Mar 06, 2023 2:07
Location: Arizona
Contact:

Re: Close ScrenRes without ending program

Post by lucidapogee »

Thank you.

That part about preserving the text will be handy.
fxm
Moderator
Posts: 12110
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Close ScrenRes without ending program

Post by fxm »

lucidapogee wrote: Mar 13, 2023 7:00 That part about preserving the text will be handy.
Moreover, this does not modify the previous configuration of the console window.
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Close ScrenRes without ending program

Post by mrminecrafttnt »

You can use both, console and screen at same time:

Code: Select all

screenres 320,240
print "Click the console"
Dim a As String
Open Cons For Output As #1
Open Cons For Input As #2
Print #1,"Please write something and press ENTER"
Line Input #2,a
Print #1, "You wrote";a
Print #1, "Now click back to your screen - nothing more happens here ";a
print "YEP THIS WORKES SURE:";a
Close #1
Close #2
Sleep
print 
lucidapogee
Posts: 19
Joined: Mar 06, 2023 2:07
Location: Arizona
Contact:

Re: Close ScrenRes without ending program

Post by lucidapogee »

Thant's awesome. :idea: I was wondering how to do that.

Thanks for sharing!
Post Reply