Windowed Full Screen

Advanced game related topics
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Windowed Full Screen

Post 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
Last edited by coco2 on Mon Jan 09, 2017 11:16 am, edited 1 time in total.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Windowed Full Screen

Post by falsam »

Code: Select all

InitSprite()
InitKeyboard()

OpenScreen(1024, 768, 32, "")

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

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Windowed Full Screen

Post by coco2 »

That's a "classic" full screen, I am trying to do "windowed" full screen. Have a look at my code.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Windowed Full Screen

Post 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

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Windowed Full Screen

Post by coco2 »

Thank you very nice example
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Windowed Full Screen

Post by coco2 »

Is there a way to disable Alt+F4 in windowed full screen mode? :?:
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Windowed Full Screen

Post 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)

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Windowed Full Screen

Post 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.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Windowed Full Screen

Post by J. Baker »

I'm curious. Why a full screen window?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Windowed Full Screen

Post 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.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Windowed Full Screen

Post 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..
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Windowed Full Screen

Post 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..
mrw
User
User
Posts: 76
Joined: Wed Dec 31, 2014 1:01 pm

Re: Windowed Full Screen

Post 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.
Post Reply