medfall

A super great game engine
Log | Files | Refs

spec.py (950B)


      1 from glad.parse import Spec
      2 
      3 
      4 class EGLSpec(Spec):
      5     NAME = 'egl'
      6 
      7 
      8 class GLSpec(Spec):
      9     NAME = 'gl'
     10 
     11     def __init__(self, root):
     12         Spec.__init__(self, root)
     13 
     14         self._profile = 'compatibility'
     15         self._remove = set()
     16 
     17     @property
     18     def profile(self):
     19         return self._profile
     20 
     21     @profile.setter
     22     def profile(self, value):
     23         if value not in ('core', 'compatibility'):
     24             raise ValueError('profile must either be core or compatibility')
     25 
     26         self._profile = value
     27 
     28     @property
     29     def removed(self):
     30         if self._profile == 'core':
     31             return frozenset(self._remove)
     32         return frozenset()
     33 
     34 
     35 class GLXSpec(Spec):
     36     NAME = 'glx'
     37 
     38 
     39 class WGLSpec(Spec):
     40     NAME = 'wgl'
     41 
     42 
     43 SPECS = dict()
     44 
     45 # reflection to fill SPECS
     46 import sys
     47 import inspect
     48 for name, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
     49     if issubclass(cls, Spec):
     50         SPECS[cls.NAME] = cls