OpenWindowedScreen

Windows specific forum
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

OpenWindowedScreen

Post by Brujah »

I am trying to get all the functions from the linux version under windows.
This works quite well, but with the following I have a problem.

I want to enable the users to switch from fullscreen to windowed mode and vica versa.
I try this with the following routine:

Procedure fullscreen()

Shared win_mode

If win_mode = 1
win_mode = 2
Result = OpenWindowedScreen(WindowID, 10, 10, 640, 480, 1, 0, 0)
Else
win_mode = 1
If OpenScreen(640,480,32,"Vollbild") = 0
EndIf
EndIf

EndProcedure


But when I call this in Windows to change to windowed I get an error message that I do not understand.
Linux just reopens the screen and everything works fine.

Closing the screen before reopening it also gives me an error.
What can I do?
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

atm i only managed to switch from windowed mode to fullscreen without any problem... but back to windowed will crash! i still think its a DX/windows related problem (losing the DC or something needed!?)

Code: Select all

Global lWindowExist, lScreenExist, lWinMode, res

Procedure MyFullScreen(lScreenMode)
 If lScreenMode = 1
  lWinMode = 1
  If lScreenExist : CloseScreen() : EndIf
  If lWindowExist : CloseWindow(0) : EndIf
  lWindowExist = OpenWindow(0,0,0,640,480,#PB_Window_SystemMenu,"WindowedMode")
  lScreenExist = OpenWindowedScreen(WindowID(), 0, 0, 640, 480, 0, 0, 0)
 Else
  lWinMode = 2
  If lWindowExist : CloseWindow(0) : EndIf
  If lScreenExist : CloseScreen() : EndIf
  lScreenExist = OpenScreen(640,480,32,"FullScreen") = 0
 EndIf
EndProcedure

InitSprite()
InitKeyboard()
MyFullScreen(1) 

Repeat
 ClearScreen(0,0,0)
 ExamineKeyboard()

 ;-------- Select ScreenMode --------
 
 If KeyboardPushed(#PB_Key_F1) And lWinMode = 2
   MyFullScreen(1)
 EndIf
  
 If KeyboardPushed(#PB_Key_F2) And lWinMode = 1
   MyFullScreen(2)
 EndIf
 
 ;-------- Check only if WindowedMode --------
 
 If lWinMode = 1
  lEvent = WindowEvent()
  If lEvent = #PB_Event_CloseWindow
   lExitProgram = 1
  EndIf
 EndIf
 ;-------- Draw TestObject and FlipBuffers --------
 
 If StartDrawing(ScreenOutput())
   Box(x,300,50,50,$FFFFFF)
   StopDrawing()
 EndIf
  
 x=x+2
 If x >= 690 : x=-50 : EndIf
  
 FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or lExitProgram
End
Btw, i think it makes more sence, to poste this problem in the "Coding Questions" section!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Post Reply