switch between full and windowed 3D screen
Posted: Sun Nov 04, 2018 5:01 pm
I have a tip to switch between standard 2D graphics full screen to windowed one, and viceversa and it works nicely.
But when try to do it using Engine3D, then it does not work.
Is there a way to do it for 3D screen ?
But when try to do it using Engine3D, then it does not work.
Is there a way to do it for 3D screen ?
Code: Select all
Macro initsprograma()
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,3,#PB_Absolute)
LoadTexture(0,"soil_wall.jpg")
CreateMaterial(0,TextureID(0))
CreateCube(0,1)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
EndMacro
If InitEngine3D()=0
MessageRequester("Error","The 3D Engine can't be initialized",0):End
EndIf
If InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0
MessageRequester("Error","The graphics Engine can't be initialized",0):End
EndIf
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
If ExamineDesktops()=0
MessageRequester("Error","Can not examine desktops",0):End
EndIf
Global pantallacompleta.b=0,bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u,FrecuenciadeMuestreo.u=60
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
initsprograma()
Macro cambiarpantalla()
CloseScreen()
If IsWindow(0):CloseWindow(0):EndIf
pantallacompleta.b!1
If pantallacompleta.b
RX=FRX:RY=FRY
OpenScreen(RX,RY,bitplanes.a,"cuerpo TID",#PB_Screen_WaitSynchronization,FrecuenciadeMuestreo.u)
Else
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
EndIf
initsprograma()
EndMacro
Repeat
ExamineKeyboard()
If pantallacompleta.b=0
WaitWindowEvent()
EndIf
RenderWorld()
FlipBuffers()
If KeyboardReleased(#PB_Key_C)
cambiarpantalla()
EndIf
Until KeyboardPushed(#PB_Key_Escape)