Is there a way to use this before importing DirectStart (opening the window)? I want to use this code so I can set my game to fullscreen at the users resolution.
I can acomplish this on Windows using pyWin and the folowing code:
from pandac.PandaModules import loadPrcFileData, WindowProperties
loadPrcFileData("", "window-type none")
from direct.showbase.ShowBase import ShowBase
ShowBase()
base.makeDefaultPipe()
wprops = WindowProperties.getDefault()
# Now set 'props' with whatever properties you want.
# At this point you can use base.pipe.getDisplayInformation()
# and base.pipe.getDisplayWidth/Height() if you need.
base.openDefaultWindow(props = wrops)
Looks like there already was a pipe when you tried to open one. Maybe you didn’t specify “win-type none” correctly, or maybe that code is called twice, accidentally?
No, I did it on purpose, to avoid inline imports and keep them at module-level, since you’ll want to put the part that starts with “ShowBase()” in a function or class… There’s a reason why it’s possible this way, too.
Secondly, this is rather less confusing, I think. Importing a class and instancing it is IMO less confusing than a magic import line that does who-knows-what.
agree with pro_r - that Directstart is not quite a pythonic way to go
I guess I start to use the other way, unless somebody’ll find a strong reason to use the former one
Pro_rsoft, I put the code you suggested into a file without anything to interfere with it and it works but it seems like the loadPrcFileData() lines I added aren’t taking effect before the window opens
You forgot the ShowBase() call to open the window and initialize “base”. But the fact that it didn’t error there means the window got already opened way before this code happened.
Before this file is loaded/imported, are you sure there is no other file importing DirectStart or opening a window?
I tossed around some print functions and everything is working right
PandaModules Imported
Window Type set to none
ShowBase Imported
ShowBase() Initialized
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Default Pipe Created
wprops Defined
Got the width and height of the screen
Set to fullscreen
Resolution set to: 1440x900
:display:gsg:glgsg(warning): Buffers advertised as supported by OpenGL runtime, but could not get pointers to extension functions.
:display:gsg:glgsg(warning): Occlusion queries advertised as supported by OpenGL runtime, but could not get pointers to extension functions.
Main window opened
It doesn’t look like anything is opening the window beforehand.