mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Displays OpenGL configuration on loading screen.
This commit is contained in:
parent
f961b43675
commit
af65c9cc6e
|
@ -2,6 +2,7 @@
|
|||
from operator import attrgetter
|
||||
from math import hypot, sqrt, atan2, degrees
|
||||
from time import clock
|
||||
from itertools import izip_longest
|
||||
import time
|
||||
import random
|
||||
import os
|
||||
|
@ -43,6 +44,15 @@ class Applet(pyglet.window.Window):
|
|||
super(Applet, self).__init__(*args, **kwargs)
|
||||
texture.init()
|
||||
|
||||
if hasattr(self.config, '_attribute_names'):
|
||||
info = [' %-17s %s' % (key + ':', getattr(self.config, key))
|
||||
for key in self.config._attribute_names]
|
||||
info = ['%-25s %-25s' % group for group in
|
||||
izip_longest(info[::2], info[1::2], fillvalue='')]
|
||||
info = 'OpenGL configuration:\n' + '\n'.join(info)
|
||||
else:
|
||||
info = 'Unknown OpenGL configuration'
|
||||
|
||||
self.loaded = False
|
||||
self.__load_started = False
|
||||
self._loading_phase = pyglet.text.Label(font_name='Consolas', font_size=20, x=10, y=self.height - 100,
|
||||
|
@ -51,6 +61,9 @@ class Applet(pyglet.window.Window):
|
|||
self._loading_label = pyglet.text.Label(font_name='Consolas', font_size=16, x=10, y=self.height - 200,
|
||||
color=(255, 255, 255, 255), width=self.width - 20, halign='center',
|
||||
multiline=True)
|
||||
self._info_label = pyglet.text.Label(font_name='Consolas', font_size=13, x=10, y=self.height - 320,
|
||||
color=(255, 255, 255, 255), width=self.width - 20,
|
||||
multiline=True, text=info)
|
||||
pyglet.clock.schedule_once(self.load, 0)
|
||||
|
||||
def load(self, *args, **kwargs):
|
||||
|
@ -349,7 +362,8 @@ class Applet(pyglet.window.Window):
|
|||
self._loading_phase.draw()
|
||||
self._loading_label.draw()
|
||||
if progress is not None:
|
||||
progress_bar(10, self.height - 300, self.width - 20, 50, progress)
|
||||
progress_bar(10, self.height - 240, self.width - 20, 50, progress)
|
||||
self._info_label.draw()
|
||||
|
||||
def on_draw(self, glMatrix=GLfloat * 16):
|
||||
if not self.loaded:
|
||||
|
|
Loading…
Reference in a new issue