# Path: roglick/engine/ecs/base.py
# class Entity(object):
#     """An Entity is really little more than a lookup key for Components"""
#     __slots__ = ("_eid",)
# 
#     def __init__(self, eid):
#         self._eid = eid
# 
#     def __repr__(self):
#         return "{name}({eid})".format(
#                 name=type(self).__name__,
#                 eid=self._eid)
# 
#     def __hash__(self):
#         return self._eid
# 
#     def __eq__(self, rhs):
#         return hash(self) == hash(rhs)
# 
# Path: roglick/engine/ecs/component.py
# class ComponentBase(object, metaclass=ComponentMeta):
#     """Base class for Components to inherit from.
# 
#     Components should primarily just be data containers; logic should live
#     elsewhere, mostly in Systems."""
#     __slots__ = ()
#     _properties = ()
# 
#     def __init__(self, *args, **kwargs):
#         """A generic init method for initializing properties.
# 
#         Properties can be set on initialization via either positional or
#         keyword arguments. The _properties property should be a tuple of
#         2-tuples in the form (k,v), where k is the property name and v is the
#         property's default value; positional initialization follows the same
#         order as _properties.
#         """
#         # Start by initializing our properties to default values
#         for k,v in self._properties:
#             setattr(self, k, v)
# 
#         # For any positional arguments, assign those values to our properties
#         # This is done in order of our __slots__ property
#         for k,v in zip(self.__slots__, args):
#             setattr(self, k, v)
#         # For any keyword arguments, assign those values to our properties
#         # Keywords must of course match one of our properties
#         for k in kwargs:
#             setattr(self, k, kwargs[k])
# 
#     def __repr__(self):
#         values = []
#         for k, default in self._properties:
#             values.append("{k}={v}".format(k=k, v=getattr(self, k)))
# 
#         values = ", ".join(values)
# 
#         return "{cls}({values})".format(
#                 cls = self.__class__.__name__,
#                 values = values)
# 
# Path: roglick/engine/ecs/exceptions.py
# class NoComponentForEntityError(Exception):
#     """Exception raised when an Entity does not have this Component"""
#     def __init__(self, entity, component_type):
#         super().__init__("{entity} has no {component_type}".format(
#             entity=entity, component_type=component_type))
# 
# class NotAComponentError(Exception):
#     """Exception raised when using a component that doesn't subclass Component
#     """
#     def __init__(self, obj):
#         super().__init__("{obj} is of type {kind} instead of Component".format(
#             obj=obj, kind=type(obj).__name__))


from .base import Entity
from .component import ComponentBase
from .exceptions import NoComponentForEntityError, NotAComponentError
    @property
    def pc(self):
        return self._pc

    def create_entity(self):
        """Creates and returns a new Entity."""
        entity = Entity(self._next_eid)
        self._next_eid += 1
        return entity

    def destroy_entity(self, entity):
        """Remove an Entity and all its Components.

        Since our only storage of Entities is as dictionary keys, it's
        sufficient to remove all Components for the Entity; if an Entity
        doesn't index any Components, for all intents and purposes it doesn't
        exist.
        """
        # We can't iterate directly over the dict, as we're modifying it
        ctypes = self._components.keys()
        for ctype in ctypes:
            # We already have logic to do this, so be DRY
            self.remove_component(entity, ctype)

    def set_component(self, entity, component):
        """Set the given Component for the Entity.

        This method will either add a new Component, or overwrite an existing
        one.
        """

# Path: roglick/engine/ecs/base.py
# class Entity(object):
#     """An Entity is really little more than a lookup key for Components"""
#     __slots__ = ("_eid",)
# 
#     def __init__(self, eid):
#         self._eid = eid
# 
#     def __repr__(self):
#         return "{name}({eid})".format(
#                 name=type(self).__name__,
#                 eid=self._eid)
# 
#     def __hash__(self):
#         return self._eid
# 
#     def __eq__(self, rhs):
#         return hash(self) == hash(rhs)
# 
# Path: roglick/engine/ecs/component.py
# class ComponentBase(object, metaclass=ComponentMeta):
#     """Base class for Components to inherit from.
# 
#     Components should primarily just be data containers; logic should live
#     elsewhere, mostly in Systems."""
#     __slots__ = ()
#     _properties = ()
# 
#     def __init__(self, *args, **kwargs):
#         """A generic init method for initializing properties.
# 
#         Properties can be set on initialization via either positional or
#         keyword arguments. The _properties property should be a tuple of
#         2-tuples in the form (k,v), where k is the property name and v is the
#         property's default value; positional initialization follows the same
#         order as _properties.
#         """
#         # Start by initializing our properties to default values
#         for k,v in self._properties:
#             setattr(self, k, v)
# 
#         # For any positional arguments, assign those values to our properties
#         # This is done in order of our __slots__ property
#         for k,v in zip(self.__slots__, args):
#             setattr(self, k, v)
#         # For any keyword arguments, assign those values to our properties
#         # Keywords must of course match one of our properties
#         for k in kwargs:
#             setattr(self, k, kwargs[k])
# 
#     def __repr__(self):
#         values = []
#         for k, default in self._properties:
#             values.append("{k}={v}".format(k=k, v=getattr(self, k)))
# 
#         values = ", ".join(values)
# 
#         return "{cls}({values})".format(
#                 cls = self.__class__.__name__,
#                 values = values)
# 
# Path: roglick/engine/ecs/exceptions.py
# class NoComponentForEntityError(Exception):
#     """Exception raised when an Entity does not have this Component"""
#     def __init__(self, entity, component_type):
#         super().__init__("{entity} has no {component_type}".format(
#             entity=entity, component_type=component_type))
# 
# class NotAComponentError(Exception):
#     """Exception raised when using a component that doesn't subclass Component
#     """
#     def __init__(self, obj):
#         super().__init__("{obj} is of type {kind} instead of Component".format(
#             obj=obj, kind=type(obj).__name__))


# Path: roglick/engine/ecs/managers.py
from .base import Entity
from .component import ComponentBase
from .exceptions import NoComponentForEntityError, NotAComponentError

    @property
    def pc(self):
        return self._pc

    def create_entity(self):
        """Creates and returns a new Entity."""
        entity = Entity(self._next_eid)
        self._next_eid += 1
        return entity

    def destroy_entity(self, entity):
        """Remove an Entity and all its Components.

        Since our only storage of Entities is as dictionary keys, it's
        sufficient to remove all Components for the Entity; if an Entity
        doesn't index any Components, for all intents and purposes it doesn't
        exist.
        """
        # We can't iterate directly over the dict, as we're modifying it
        ctypes = self._components.keys()
        for ctype in ctypes:
            # We already have logic to do this, so be DRY
            self.remove_component(entity, ctype)

    def set_component(self, entity, component):
        """Set the given Component for the Entity.

        This method will either add a new Component, or overwrite an existing
        one.
        """

        if not isinstance(component, ComponentBase):