BBC BASIC for Windows
Programming >> Graphics and Games >> Full-screen
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1381336938

Full-screen
Post by Usama Amin on Oct 9th, 2013, 4:42pm

Hi guys,
I am currently working on a game in which a certain key is pressed to toggle full screen, to enter full screen I am using the following code:
GWL_STYLE = -16
HWND_TOPMOST = -1
WS_VISIBLE = &10000000
WS_CLIPCHILDREN = &2000000
WS_CLIPSIBLINGS = &4000000
SYS "GetSystemMetrics", 0 TO xscreen%
SYS "GetSystemMetrics", 1 TO yscreen%
SYS "SetWindowLong", @hwnd%, GWL_STYLE, WS_VISIBLE + \
\ WS_CLIPCHILDREN + WS_CLIPSIBLINGS
SYS "SetWindowPos", @hwnd%, HWND_TOPMOST, 0, 0, xscreen%, yscreen%, 0
can anybody tell me how to get out without terminating the program?
Thanks
Usama
Re: Full-screen
Post by admin on Oct 9th, 2013, 5:31pm

on Oct 9th, 2013, 4:42pm, Usama Amin wrote:
can anybody tell me how to get out without terminating the program?

You mean to restore it to a regular window? Basically you simply need to reverse the effects of the SetWindowLong and SetWindowPos, something like this:

Code:
      GWL_STYLE = -16
      HWND_NOTOPMOST = -2
      SWP_FRAMECHANGED = 32
      SYS "SetWindowLong", @hwnd%, GWL_STYLE, &16CF0000
      SYS "SetWindowPos", @hwnd%, HWND_NOTOPMOST, 100, 100, 800, 600, SWP_FRAMECHANGED
      VDU 26 

Richard.
Re: Full-screen
Post by Usama Amin on Oct 9th, 2013, 6:08pm

Thanks! Works perfectly