mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 05:01:57 -04:00
Make sky disablable, and disable by default on macOS
This commit is contained in:
parent
9cdf3b8513
commit
e72a3bc623
|
@ -134,10 +134,10 @@ class LoaderWindow(pyglet.window.Window):
|
|||
self.flip()
|
||||
self.dispatch_events()
|
||||
|
||||
def load(self):
|
||||
def load(self, **kwargs):
|
||||
start = time.clock()
|
||||
with glContext(self._main_context):
|
||||
world = World('world.json', self._load_callback)
|
||||
world = World('world.json', self._load_callback, **kwargs)
|
||||
print('Loaded in %s seconds.' % (time.clock() - start))
|
||||
return world
|
||||
|
||||
|
@ -167,10 +167,10 @@ class LoaderConsole(object):
|
|||
def _load_callback(self, phase, message, progress):
|
||||
print(message, file=self._output)
|
||||
|
||||
def load(self):
|
||||
def load(self, **kwargs):
|
||||
start = time.clock()
|
||||
with glContext(self._main_context):
|
||||
world = World('world.json', self._load_callback)
|
||||
world = World('world.json', self._load_callback, **kwargs)
|
||||
print('Loaded in %s seconds.' % (time.clock() - start), file=self._output)
|
||||
return world
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ def main():
|
|||
parser = argparse.ArgumentParser(prog='punyverse', description='''
|
||||
Python simulator of a puny universe.
|
||||
''')
|
||||
parser.set_defaults(sky=not macos)
|
||||
parser.add_argument('-D', '--debug', help='Enable pyglet OpenGL debugging', action='store_true')
|
||||
parser.add_argument('-d', '--high-depth', help='Use a larger depth buffer',
|
||||
const=32, default=24, dest='depth', nargs='?', type=int)
|
||||
|
@ -23,6 +24,10 @@ def main():
|
|||
action='store_false', dest='vsync')
|
||||
parser.add_argument('-n', '--normal', help='Enables the use of normal maps',
|
||||
action='store_true')
|
||||
parser.add_argument('-s', '--sky', help='Enables the sky', dest='sky',
|
||||
action='store_true')
|
||||
parser.add_argument('-S', '--no-sky', help='Disables the sky', dest='sky',
|
||||
action='store_false')
|
||||
args = parser.parse_args()
|
||||
|
||||
versioning = dict(major_version=3, minor_version=3)
|
||||
|
@ -70,7 +75,7 @@ def main():
|
|||
loader.context.set_current()
|
||||
|
||||
loader.set_main_context(punyverse.context)
|
||||
world = loader.load()
|
||||
world = loader.load(sky=args.sky)
|
||||
punyverse.context.set_current()
|
||||
punyverse.initialize(world)
|
||||
loader.close()
|
||||
|
|
|
@ -30,7 +30,7 @@ class World(object):
|
|||
'belt': ('belt.vertex.glsl', 'model.fragment.glsl'),
|
||||
}
|
||||
|
||||
def __init__(self, file, callback):
|
||||
def __init__(self, file, callback, sky=True):
|
||||
self.tracker = []
|
||||
self.x = None
|
||||
self.y = None
|
||||
|
@ -40,6 +40,8 @@ class World(object):
|
|||
self.asteroids = AsteroidManager(self)
|
||||
self.cam = Camera()
|
||||
|
||||
self._sky = sky
|
||||
|
||||
self._program = None
|
||||
self.callback = callback
|
||||
self.programs = self._load_programs()
|
||||
|
@ -127,7 +129,7 @@ class World(object):
|
|||
'Loading %s.' % name, i / belt_count)
|
||||
self.tracker.append(Belt(name, self, info))
|
||||
|
||||
if 'sky' in root:
|
||||
if 'sky' in root and self._sky:
|
||||
def callback(index, file):
|
||||
self.callback('Loading sky...', 'Loading %s.' % file, index / 6)
|
||||
self.tracker.append(Sky(self, root['sky'], callback))
|
||||
|
|
Loading…
Reference in a new issue