]> CRI, Mines Paris - PSL - minwii.git/blobdiff - src/app/globals.py
Affichage des wiimotes réellement disponibles.
[minwii.git] / src / app / globals.py
index 8261eda8d0f3c01e13a71c4d21c91c6150d31bbb..0dde5f3f11d4b2b705a3ef68e977b2495f75dbae 100755 (executable)
@@ -5,11 +5,23 @@ constantes globales partagées par plusieurs modules.
 $Id$
 $URL$
 """
 $Id$
 $URL$
 """
+from colorsys import hls_to_rgb
+from math import floor
 
 BACKGROUND_LAYER = 0
 FOREGROUND_LAYER = 1
 CURSOR_LAYER = 2
 
 BACKGROUND_LAYER = 0
 FOREGROUND_LAYER = 1
 CURSOR_LAYER = 2
-PLAYING_MODES = {'EASY':0
-                ,'NORMAL':1
-                ,'ADVANCED':2
-                ,'EXPERT':3}
+PLAYING_MODES = (('EASY'   , u'Facile'),
+                 ('NORMAL'  , u'Normal'),
+                 ('ADVANCED', u'Avancé'),
+                 ('EXPERT'  , u'Expert'))
+
+
+
+PLAYING_MODES_DICT = dict([(v[0], i) for i, v in enumerate(PLAYING_MODES)])
+
+def hls_to_rgba_8bits(h, l, s, a=1) :
+    #convert to rgb ranging from 0 to 255
+    rgba = [floor(255 * i) for i in hls_to_rgb(h, l, s) + (a,)]
+    return tuple(rgba)
+