toonbase: Save screenshots to screenshots directory

This commit is contained in:
John Cote 2021-07-05 20:16:39 -04:00
parent bd36f6c463
commit dc3e915b71
2 changed files with 11 additions and 8 deletions

View file

@ -10,6 +10,8 @@ class OTPBase(ShowBase):
def __init__(self, windowType = None): def __init__(self, windowType = None):
self.wantEnviroDR = False self.wantEnviroDR = False
ShowBase.__init__(self, windowType=windowType) ShowBase.__init__(self, windowType=windowType)
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
OTPBase.notify.info('__astron__ == %s' % __astron__)
if config.GetBool('want-phase-checker', 0): if config.GetBool('want-phase-checker', 0):
from direct.showbase import Loader from direct.showbase import Loader
Loader.phaseChecker = self.loaderPhaseChecker Loader.phaseChecker = self.loaderPhaseChecker
@ -227,3 +229,8 @@ class OTPBase(ShowBase):
self.wantEnviroDR = not self.win.getGsg().isHardware() or config.GetBool('want-background-region', 1) self.wantEnviroDR = not self.win.getGsg().isHardware() or config.GetBool('want-background-region', 1)
self.backgroundDrawable = self.win self.backgroundDrawable = self.win
return result return result
def isMainWindowOpen(self):
if self.win != None:
return self.win.isValid()
return 0

View file

@ -52,8 +52,6 @@ class ToonBase(OTPBase.OTPBase):
sys.exit(1) sys.exit(1)
self.disableShowbaseMouse() self.disableShowbaseMouse()
base.debugRunningMultiplier /= OTPGlobals.ToonSpeedFactor base.debugRunningMultiplier /= OTPGlobals.ToonSpeedFactor
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
ToonBase.notify.info('__astron__ == %s' % __astron__)
self.toonChatSounds = self.config.GetBool('toon-chat-sounds', 1) self.toonChatSounds = self.config.GetBool('toon-chat-sounds', 1)
self.placeBeforeObjects = config.GetBool('place-before-objects', 1) self.placeBeforeObjects = config.GetBool('place-before-objects', 1)
self.endlessQuietZone = False self.endlessQuietZone = False
@ -205,8 +203,11 @@ class ToonBase(OTPBase.OTPBase):
self.walking = pressed self.walking = pressed
def takeScreenShot(self): def takeScreenShot(self):
if not os.path.exists('screenshots/'):
os.mkdir('screenshots/')
namePrefix = 'screenshot' namePrefix = 'screenshot'
namePrefix = launcher.logPrefix + namePrefix namePrefix = 'screenshots/' + launcher.logPrefix + namePrefix
timedif = globalClock.getRealTime() - self.lastScreenShotTime timedif = globalClock.getRealTime() - self.lastScreenShotTime
if self.glitchCount > 10 and self.walking: if self.glitchCount > 10 and self.walking:
return return
@ -400,8 +401,3 @@ class ToonBase(OTPBase.OTPBase):
def playMusic(self, music, looping = 0, interrupt = 1, volume = None, time = 0.0): def playMusic(self, music, looping = 0, interrupt = 1, volume = None, time = 0.0):
OTPBase.OTPBase.playMusic(self, music, looping, interrupt, volume, time) OTPBase.OTPBase.playMusic(self, music, looping, interrupt, volume, time)
def isMainWindowOpen(self):
if self.win != None:
return self.win.isValid()
return 0