DEFAULT_VOLUME = 1.0
NO_SOUND = os.environ.get("TABAK_NO_SOUND", "").lower() in ("1", "y", "yes")
+
+# Color constants
+COLOURS = {
+ "red": (255, 0, 0),
+ "green": (0, 255, 0),
+ "blue": (0, 0, 255),
+ "cyan": (0, 255, 255),
+ "yellow": (255, 255, 0),
+ "magenta": (255, 0, 255),
+ "white": (255, 255, 255),
+}
import pygame.locals as pgl
import pygame.rect
-from .constants import LIGHT_CATEGORY, FITTINGS_CATEGORY
+from .constants import LIGHT_CATEGORY, FITTINGS_CATEGORY, COLOURS
from .rays import RayPolyManager
from .utils import DetailedTimer
from .loader import loader
class BaseLight(object):
""" Common light functionality. """
- COLOURS = {
- "red": (255, 0, 0),
- "green": (0, 255, 0),
- "blue": (0, 0, 255),
- "cyan": (0, 255, 255),
- "yellow": (255, 255, 0),
- "magenta": (255, 0, 255),
- "white": (255, 255, 255),
- }
-
# defaults
RAY_MANAGER = RayPolyManager
FITTING_IMG = None
return surf
def light_colour(self):
- light_colour = self.COLOURS[self.colour]
+ light_colour = COLOURS[self.colour]
intensity = int(255 * self.intensity)
return light_colour + (intensity,)
def fitting_image(self):
if self._fitting_image is None:
- fitting_colour = self.COLOURS[self.colour]
+ fitting_colour = COLOURS[self.colour]
self._fitting_image = loader.load_image(
"48", self.FITTING_IMG,
transform=Multiply(colour=fitting_colour))
class MultiColourLamp(BaseLight):
FITTING_IMG = "lamp.png"
- DEFAULT_COLOURS = sorted(BaseLight.COLOURS.keys())
+ DEFAULT_COLOURS = sorted(COLOURS.keys())
def __init__(self, **kw):
self.colour_cycle = kw.pop("colours", None)