Page 1 of 1

Windowed Full Screen

Posted: Mon Jan 09, 2017 10:30 am
by coco2
How do you create a windowed full screen? I've been searching but can't find much.

Edit, I found some code on the forum and this is what I came up with. Am I doing it right?

Code: Select all

InitSprite()
InitKeyboard()
InitMouse()

#Flags=#PB_Window_Invisible|#PB_Window_Maximize|#PB_Window_BorderLess
OpenWindow(0,0,0,320,240,"screen",#Flags)
HideWindow(0,#False)
;SmartWindowRefresh(0,#True)

OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowHeight(0),0,0,0,#PB_Screen_NoSynchronization)

Repeat
  ClearScreen(8723235)
  FlipBuffers()
  Repeat
    Event = WindowEvent()
    If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
  Until Event = 0
  ExamineKeyboard()
  ExamineMouse()
  If KeyboardReleased(#PB_Key_Escape) : Quit = 1 : EndIf
Until Quit

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 11:03 am
by falsam

Code: Select all

InitSprite()
InitKeyboard()

OpenScreen(1024, 768, 32, "")

Repeat     
  ClearScreen(RGB(75, 0, 130))
  ExamineKeyboard()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 11:20 am
by coco2
That's a "classic" full screen, I am trying to do "windowed" full screen. Have a look at my code.

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 11:32 am
by falsam
Ooops sorry. I read too quickly.

Without hide OpenWindow()

Code: Select all

InitSprite()
InitKeyboard()
InitMouse()

OpenWindow(0, 0, 0, 0, 0, "FullScreen", #PB_Window_BorderLess | #PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0))

Repeat   
  Repeat
    Event = WindowEvent()
    If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf 
  Until Event=0
  
  ClearScreen(RGB(75, 0, 130))
  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_Escape) : Quit = 1 : EndIf
  FlipBuffers()  
Until Quit

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 11:51 am
by coco2
Thank you very nice example

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 12:08 pm
by coco2
Is there a way to disable Alt+F4 in windowed full screen mode? :?:

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 12:13 pm
by falsam
coco2 wrote:Is there a way to disable Alt+F4 in windowed full screen mode? :?:

Code: Select all

InitSprite()
InitKeyboard()
InitMouse()

OpenWindow(0, 0, 0, 0, 0, "FullScreen", #PB_Window_BorderLess | #PB_Window_Maximize)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0))

Repeat   
  Repeat : Until WindowEvent() = 0
  
  ClearScreen(RGB(75, 0, 130))
  ExamineKeyboard()
  FlipBuffers()  
  
Until KeyboardReleased(#PB_Key_Escape)

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 1:19 pm
by coco2
Thank you, yes my bad I forgot I was quitting with #PB_Event_CloseWindow

I just need to code it in to my game.

Re: Windowed Full Screen

Posted: Mon Jan 09, 2017 11:57 pm
by J. Baker
I'm curious. Why a full screen window?

Re: Windowed Full Screen

Posted: Tue Jan 10, 2017 3:01 am
by coco2
Keep in mind I'm a beginner at this and I'm just stating my opinion. The classic full screen is old school. You need to code in a special way of handling alt+tab. It can only output to one screen (desktop 0 in Purebasic). I want my game engine to have the ability to output to 3 screens.

Re: Windowed Full Screen

Posted: Tue Jan 10, 2017 4:12 am
by Mistrel
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Because an application running in full-screen mode takes over the screen, debugging the application requires either a separate monitor or the use of a remote debugger. Use the DirectX Control Panel Tool to enable multiple-monitor debugging. One advantage of a windowed-mode application is that you can step through the code in a debugger without multiple monitors or a remote debugger.
https://www.thurrott.com/windows/window ... windows-10
Full screen exclusive mode was created back in the original release of DirectDraw to provide games with enhanced performance when using the entire screen,” Mr,. Langley says. “The downside of full screen exclusive mode is that it makes the experience for gamers who wish to do other things on their system, such as alt-tab to another application or run the Windows GameDVR, more clunky with excessive flicker and transition time. We thought it would be cool if gamers could have the versatility of gaming in a window with the performance of full screen exclusive. So, with Windows 10, DirectX 12 games which take up the entire screen perform just as well as the old full screen exclusive mode without any of the full screen exclusive mode disadvantages.
Etc..

Re: Windowed Full Screen

Posted: Tue Jan 10, 2017 4:13 am
by Mistrel
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Because an application running in full-screen mode takes over the screen, debugging the application requires either a separate monitor or the use of a remote debugger. Use the DirectX Control Panel Tool to enable multiple-monitor debugging. One advantage of a windowed-mode application is that you can step through the code in a debugger without multiple monitors or a remote debugger.
https://www.thurrott.com/windows/window ... windows-10
Full screen exclusive mode was created back in the original release of DirectDraw to provide games with enhanced performance when using the entire screen,” Mr,. Langley says. “The downside of full screen exclusive mode is that it makes the experience for gamers who wish to do other things on their system, such as alt-tab to another application or run the Windows GameDVR, more clunky with excessive flicker and transition time.
Etc..

Re: Windowed Full Screen

Posted: Fri Dec 01, 2017 4:33 pm
by mrw
Just wanted to add a reason to use a real Fullscreen.
If you have a monitor that has a very high resolution a fullscreen window will always be that high resolution, which could cause slow performance.
With a real fullscreen you can set it to any allowed resolution. The lower resolution the faster performance.

Otherwise I also like the OS friendly way of the fullscreen window. Especially when you have multiple monitors. But its not always the best.