Displays OpenGL configuration on loading screen.

This commit is contained in:
Quantum 2014-01-05 20:02:25 -05:00
parent f961b43675
commit af65c9cc6e

View file

@ -2,6 +2,7 @@
from operator import attrgetter from operator import attrgetter
from math import hypot, sqrt, atan2, degrees from math import hypot, sqrt, atan2, degrees
from time import clock from time import clock
from itertools import izip_longest
import time import time
import random import random
import os import os
@ -43,6 +44,15 @@ class Applet(pyglet.window.Window):
super(Applet, self).__init__(*args, **kwargs) super(Applet, self).__init__(*args, **kwargs)
texture.init() 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.loaded = False
self.__load_started = False self.__load_started = False
self._loading_phase = pyglet.text.Label(font_name='Consolas', font_size=20, x=10, y=self.height - 100, 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, 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', color=(255, 255, 255, 255), width=self.width - 20, halign='center',
multiline=True) 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) pyglet.clock.schedule_once(self.load, 0)
def load(self, *args, **kwargs): def load(self, *args, **kwargs):
@ -349,7 +362,8 @@ class Applet(pyglet.window.Window):
self._loading_phase.draw() self._loading_phase.draw()
self._loading_label.draw() self._loading_label.draw()
if progress is not None: 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): def on_draw(self, glMatrix=GLfloat * 16):
if not self.loaded: if not self.loaded: