Olby wrote:I don't want to change end user's desktop resolution because when the app will crash it will certainly leave the changed resolution and mess up the icons and such.
You're changing the desktop resolution temporarily, not system-wide. If your application crashes the operating system knows to reset the resolution when it ends. The exception is if you're compiling with the debugger on. In this case the debugger halts the program before it actually ends which may cause the IDE to be off the screen. But your resolution will still be restored when you release it from the debugger.
Olby wrote:I cannot get PGDK to work perfectly in fullscreen windowed mode just like it should work in DBPro. I tried the example posted by Mistrel before but that didn't work. Then I tried to stretch window created by PB to my screen resolution, but that made the program to run very very slowly.
You'll need to be more specific, especially regarding the "run very slowly" part. A compilable example would help. By my examples the frame rate is equivalent to DBP when comparing simple examples such as this one:
Code: Select all
Sync On
Make Object Cube 1,3
Repeat
Inc x#,0.2: Inc y#,0.4: Inc z#,0.8
Rotate Object 1,x#,y#,z#
Text 15,15,Str$(screen fps())
Sync
Until InKey$()<>""
End
Olby wrote:You should really include a template for creating the same fullscreen windowed mode DBPro uses without affecting users desktop resolution. It utilizes a stretching to stretch small resolutions to fullscreen, but when used with users real desktop resolution there is no quality loss.
I think you're misunderstanding the example I provided previously. It was merely demonstrating how to change the resolution and show the DBP window. You can expand on this principal to obtain whatever kind of effect you're hoping to achieve.
For example, to set the window to the size and resolution of the desktop you don't need the resolution changing code. This would work just fine:
Code: Select all
ExamineDesktops()
;/ Show the PureGDK render window
OpenWindow(0,0,0,DesktopWidth(0),DesktopHeight(0),"DarkBasic Professional - PureGDK",#PB_Window_BorderLess)
hDBWnd=OpenDBWnd(WindowID(0),0,0,DesktopWidth(0),DesktopHeight(0))
dbsetdisplaymode(DesktopWidth(0),DesktopHeight(0),32,0)
;/ Set the window to the to the top of the z-order
SetWindowPos_(hDBWnd,#HWND_TOPMOST,0,0,0,0,#SWP_NOREPOSITION|#SWP_NOSIZE)
;/ Uncomment to limit the frame rate
;dbSyncRate(60)
dbMakeObjectCube(1,3)
;/ Rotate the cube and update the screen
Repeat
;/ Uncomment this to reduce CPU usage
;Delay(1)
x.f+0.2: y.f+0.4: z.f+0.8
dbRotateObject(1,x.f,y.f,z.f)
dbText(15,15,Str(dbscreenfps()))
dbSync()
Until WindowEvent()=#WM_CLOSE Or Not dbInKey()=""
End
Unlike DBP, PureGDK does not stretch the resolution of the render window by default. If you want to use a lower resolution at a higher screen size then you will have to resize the window yourself:
Code: Select all
ExamineDesktops()
;/ Show the PureGDK render window
OpenWindow(0,0,0,DesktopWidth(0),DesktopHeight(0),"DarkBasic Professional - PureGDK",#PB_Window_BorderLess)
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480)
MoveWindow_(hDBWnd,0,0,DesktopWidth(0),DesktopHeight(0),1)
;/ Set the window to the to the top of the z-order
SetWindowPos_(hDBWnd,#HWND_TOPMOST,0,0,0,0,#SWP_NOREPOSITION|#SWP_NOSIZE)
;/ Uncomment to limit the frame rate
;dbSyncRate(60)
dbMakeObjectCube(1,3)
;/ Rotate the cube and update the screen
Repeat
;/ Uncomment this to reduce CPU usage
;Delay(1)
x.f+0.2: y.f+0.4: z.f+0.8
dbRotateObject(1,x.f,y.f,z.f)
dbText(15,15,Str(dbscreenfps()))
dbSync()
Until WindowEvent()=#WM_CLOSE Or Not dbInKey()=""
End