# Path: core/config.py
# def get_sprite(frame):
# def load_image(name):
# def load_sound(name):
# def load_text(name, lang):
# def loop_sound(sound):
# def on_off(condition):
# def percent_str(var):
# def play_music(name):
# def set_volume():
# def init_music_volume():
# def show_fps():
# def take_screenshot():
# def toggle_frame_limit():
# def toggle_fullscreen():
# def toggle_pause():
#     def __init__(self, *keys):
# APP_DATA_WIN = 'APPDATA'
# APP_DATA_LIN = 'HOME'
# BLIT_FLAGS    = HWSURFACE | HWACCEL | ASYNCBLIT | RLEACCEL
# CURSOR_BEEP   = load_sound('cursor.wav')
# CURSOR_SELECT = load_sound('select.wav')
# DATA_STORE    = join(environ[APP_DATA_WIN if 'win' in sys.platform else APP_DATA_LIN], 'Invasodado')
# DEBUG         =  __debug__ and not hasattr(sys, 'frozen') #cx_freeze adds 'frozen' to the sys module
# DEPTH         = 8
# EARTH         = load_image('earth.png')
# ENCODING      = 'utf-8'
# EVENTS_OK     = (KEYDOWN, MOUSEBUTTONDOWN, QUIT)
# FONT          = pygame.font.Font(join('gfx', 'font.ttf'), 18)
# FULL_FLAGS    = FULLSCREEN | HWSURFACE | DOUBLEBUF
# GRID_BG       = load_image('bg.png')
# ON_OFF        = {
#                  'en' : ("Off", "On"),
#                  'es' : ("No" , "Sí"),
#                 }
# PAUSE         = load_sound('pause.wav')
# SCREEN_DIMS   = tuple(pygame.display.list_modes())
# SCREEN_HEIGHT = screen.get_height()
# SCREEN_RECT   = Rect((0, 0), screen.get_size())
# SCREEN_WIDTH  = screen.get_width()
# SPRITES       = load_image('sprites.png')
# EARTH = EARTH.subsurface(Rect(0, 0, EARTH.get_width(), EARTH.get_height() / 2))
# class Enum:
# 
# Path: core/particles.py
# class ParticlePool:
#     '''
#     A pool of particles that multiple emitters can draw from.
#     Each pool may hold one type of particle.
# 
#     @ivar particles_in: Particles not visible on-screen
#     @ivar particles_out: Particles visible on-screen
#     '''
# 
#     def __init__(self, image, move_func=_p_move, appear_func=_p_appear):
#         self.appear_func   = appear_func
#         self.image         = image
#         self.move_func     = move_func
#         self.particles_in  = set()
#         self.particles_out = set()
# 
#     def get_particle(self):
#         '''
#         Returns a spare Particle, or creates a new one if none exist.
#         '''
#         if not self.particles_in:
#         #If we don't have any particles to spare...
#             self.particles_in.add(Particle(self.image, self.move_func, self.appear_func))
# 
#         particle = self.particles_in.pop()
#         self.particles_out.add(particle)
#         return particle
# 
#     def clean(self):
#         '''
#         Removes all particles that are off-screen from the game, but not from
#         memory.
#         '''
#         particles_to_remove = set(filterfalse(config.SCREEN_RECT.colliderect, self.particles_out))
#         self.particles_in.update(particles_to_remove)
#         self.particles_out -= particles_to_remove


from random    import uniform, choice
from itertools import chain
from pygame.constants import *
from pygame           import Color, Rect
from core           import config
from core.particles import ParticlePool
'''
This module just provides some useful tools for the various color-reliant
objects in Invasodado to use.  Nothing too special here.
'''



### Constants #################################################################
'''
@var RED, GREEN, BLUE, YELLOW, PURPLE, WHITE, BLACK: Common game colors.
     They are not necessarily "pure" (i.e. BLUE isn't #0000FF).
@var LIST: Colors that in-game objects are allowed to be.
@var COLOR_KEY: The transparent color on the main spritesheet, defaults to
     whatever's in the bottom-left corner.
@var COLOR_BLIND_FRAMES: The shapes that are placed over game objects in colorblind mode.
@var COLOR_BLIND_SYMBOLS: Mapping of LIST plus WHITE to COLOR_BLIND_FRAMES
'''

RED    = Color('#FF3333')
GREEN  = Color('#4FFF55')
BLUE   = Color('#585EFF')
YELLOW = Color('#EBFF55')
PURPLE = Color('#FF55D5')
WHITE  = Color('#FFFFFF')
BLACK  = Color('#000000')

COLOR_BLIND_FRAMES  = tuple(Rect(32 * i, 32, 32, 32) for i in range(4, 10))
COLOR_BLIND_SYMBOLS = {

# Path: core/config.py
# def get_sprite(frame):
# def load_image(name):
# def load_sound(name):
# def load_text(name, lang):
# def loop_sound(sound):
# def on_off(condition):
# def percent_str(var):
# def play_music(name):
# def set_volume():
# def init_music_volume():
# def show_fps():
# def take_screenshot():
# def toggle_frame_limit():
# def toggle_fullscreen():
# def toggle_pause():
#     def __init__(self, *keys):
# APP_DATA_WIN = 'APPDATA'
# APP_DATA_LIN = 'HOME'
# BLIT_FLAGS    = HWSURFACE | HWACCEL | ASYNCBLIT | RLEACCEL
# CURSOR_BEEP   = load_sound('cursor.wav')
# CURSOR_SELECT = load_sound('select.wav')
# DATA_STORE    = join(environ[APP_DATA_WIN if 'win' in sys.platform else APP_DATA_LIN], 'Invasodado')
# DEBUG         =  __debug__ and not hasattr(sys, 'frozen') #cx_freeze adds 'frozen' to the sys module
# DEPTH         = 8
# EARTH         = load_image('earth.png')
# ENCODING      = 'utf-8'
# EVENTS_OK     = (KEYDOWN, MOUSEBUTTONDOWN, QUIT)
# FONT          = pygame.font.Font(join('gfx', 'font.ttf'), 18)
# FULL_FLAGS    = FULLSCREEN | HWSURFACE | DOUBLEBUF
# GRID_BG       = load_image('bg.png')
# ON_OFF        = {
#                  'en' : ("Off", "On"),
#                  'es' : ("No" , "Sí"),
#                 }
# PAUSE         = load_sound('pause.wav')
# SCREEN_DIMS   = tuple(pygame.display.list_modes())
# SCREEN_HEIGHT = screen.get_height()
# SCREEN_RECT   = Rect((0, 0), screen.get_size())
# SCREEN_WIDTH  = screen.get_width()
# SPRITES       = load_image('sprites.png')
# EARTH = EARTH.subsurface(Rect(0, 0, EARTH.get_width(), EARTH.get_height() / 2))
# class Enum:
# 
# Path: core/particles.py
# class ParticlePool:
#     '''
#     A pool of particles that multiple emitters can draw from.
#     Each pool may hold one type of particle.
# 
#     @ivar particles_in: Particles not visible on-screen
#     @ivar particles_out: Particles visible on-screen
#     '''
# 
#     def __init__(self, image, move_func=_p_move, appear_func=_p_appear):
#         self.appear_func   = appear_func
#         self.image         = image
#         self.move_func     = move_func
#         self.particles_in  = set()
#         self.particles_out = set()
# 
#     def get_particle(self):
#         '''
#         Returns a spare Particle, or creates a new one if none exist.
#         '''
#         if not self.particles_in:
#         #If we don't have any particles to spare...
#             self.particles_in.add(Particle(self.image, self.move_func, self.appear_func))
# 
#         particle = self.particles_in.pop()
#         self.particles_out.add(particle)
#         return particle
# 
#     def clean(self):
#         '''
#         Removes all particles that are off-screen from the game, but not from
#         memory.
#         '''
#         particles_to_remove = set(filterfalse(config.SCREEN_RECT.colliderect, self.particles_out))
#         self.particles_in.update(particles_to_remove)
#         self.particles_out -= particles_to_remove


# Path: core/color.py
from random    import uniform, choice
from itertools import chain
from pygame.constants import *
from pygame           import Color, Rect
from core           import config
from core.particles import ParticlePool

'''
This module just provides some useful tools for the various color-reliant
objects in Invasodado to use.  Nothing too special here.
'''



### Constants #################################################################
'''
@var RED, GREEN, BLUE, YELLOW, PURPLE, WHITE, BLACK: Common game colors.
     They are not necessarily "pure" (i.e. BLUE isn't #0000FF).
@var LIST: Colors that in-game objects are allowed to be.
@var COLOR_KEY: The transparent color on the main spritesheet, defaults to
     whatever's in the bottom-left corner.
@var COLOR_BLIND_FRAMES: The shapes that are placed over game objects in colorblind mode.
@var COLOR_BLIND_SYMBOLS: Mapping of LIST plus WHITE to COLOR_BLIND_FRAMES
'''

RED    = Color('#FF3333')
GREEN  = Color('#4FFF55')
BLUE   = Color('#585EFF')
YELLOW = Color('#EBFF55')
PURPLE = Color('#FF55D5')
WHITE  = Color('#FFFFFF')
BLACK  = Color('#000000')

COLOR_BLIND_FRAMES  = tuple(Rect(32 * i, 32, 32, 32) for i in range(4, 10))
COLOR_BLIND_SYMBOLS = {

                        id(RED)    : config.get_sprite(COLOR_BLIND_FRAMES[0]),