# Path: sc8pr/geom.py
# def sigma(*args):
#     "Sum one or more vectors"
#     return tuple(sum(x[i] for x in args) for i in range(len(args[0])))
# 
# def delta(v2, v1=None, mag=None):
#     "v2 - v1, rescaled to specified magnitude"
#     if v1:
#         x = v2[0] - v1[0]
#         y = v2[1] - v1[1]
#     else: x, y = v2
#     if mag is not None:
#         r = hypot(x, y)
#         if r:
#             mag /= r
#             x *= mag
#             y *= mag
#     return x, y


import sys, pygame
from random import randint
from traceback import format_exc
from zipfile import ZipFile
from pathlib import Path
from sc8pr.geom import sigma, delta


scale = pygame.transform.smoothscale

def nothing(*args): pass
  
def modKeys():
    key = pygame.key.get_pressed()
    m = 0
    if key[pygame.K_LALT] or key[pygame.K_RALT]: m += 1
    if key[pygame.K_LCTRL] or key[pygame.K_RCTRL]: m += 2
    if key[pygame.K_LSHIFT] or key[pygame.K_RSHIFT]: m += 4
    return m

def resolvePath(rel, start=__file__, isDir=False):
    "Return an absolute path relative to a starting file or folder"
    p = Path(start)
    if not isDir: p = p.parent
    return str(p.joinpath(rel).resolve())

def _rgba(*args):
    "Generate a sequence of pygame.Color instances"
    for c in args:
        t = type(c)
        if t is bool: # Random color
            c = [randint(0,255) for i in range(4 if c else 3)]
        yield pygame.Color(c) if t is str else pygame.Color(*c)

def rgba(*args):
    "Return a color or list of colors from str or tuple data"

# Path: sc8pr/geom.py
# def sigma(*args):
#     "Sum one or more vectors"
#     return tuple(sum(x[i] for x in args) for i in range(len(args[0])))
# 
# def delta(v2, v1=None, mag=None):
#     "v2 - v1, rescaled to specified magnitude"
#     if v1:
#         x = v2[0] - v1[0]
#         y = v2[1] - v1[1]
#     else: x, y = v2
#     if mag is not None:
#         r = hypot(x, y)
#         if r:
#             mag /= r
#             x *= mag
#             y *= mag
#     return x, y


# Path: sc8pr/util.py
import sys, pygame
from random import randint
from traceback import format_exc
from zipfile import ZipFile
from pathlib import Path
from sc8pr.geom import sigma, delta



scale = pygame.transform.smoothscale

def nothing(*args): pass
  
def modKeys():
    key = pygame.key.get_pressed()
    m = 0
    if key[pygame.K_LALT] or key[pygame.K_RALT]: m += 1
    if key[pygame.K_LCTRL] or key[pygame.K_RCTRL]: m += 2
    if key[pygame.K_LSHIFT] or key[pygame.K_RSHIFT]: m += 4
    return m

def resolvePath(rel, start=__file__, isDir=False):
    "Return an absolute path relative to a starting file or folder"
    p = Path(start)
    if not isDir: p = p.parent
    return str(p.joinpath(rel).resolve())

def _rgba(*args):
    "Generate a sequence of pygame.Color instances"
    for c in args:
        t = type(c)
        if t is bool: # Random color
            c = [randint(0,255) for i in range(4 if c else 3)]
        yield pygame.Color(c) if t is str else pygame.Color(*c)

def rgba(*args):
    "Return a color or list of colors from str or tuple data"

    c = list(_rgba(*args))