enforce a single ShowBase

This commit is contained in:
David Rose 2011-09-28 22:49:53 +00:00
parent 5588210e22
commit 303b51198e

View File

@ -303,6 +303,10 @@ class ShowBase(DirectObject.DirectObject):
# Windows XP supports a 32-bit affinity mask
TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
# Make sure we're not making more than one ShowBase.
if hasattr(__builtin__, 'base'):
raise StandardError, "Attempt to spawn multiple ShowBase instances!"
__builtin__.base = self
__builtin__.render2d = self.render2d
__builtin__.aspect2d = self.aspect2d