ó
X–Tc           @   s`   d  Z  d d l Z d d l Z d d l Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d S(   ss   Various functions and classes meant for prototyping and debugging. These
should never show up in a production game.iÿÿÿÿNt	   DebugTextc           B   s5   e  Z d  Z d d „ Z d „  Z e d „  e ƒ Z RS(   sp  
    A simple Sprite subclass for rapidly rendering text on the screen.

    :param scene: The parent View or Scene that this will live in.
    :type scene: :class:`View <spyral.View>` or :class:`Scene <spyral.Scene>`
    :param str text: The string that will be rendered.
    :param color: A three-tuple of RGB values ranging from 0-255. Defaults to
                  black (0, 0, 0).
    :type color: A three-tuple.

    .. attribute:: text

        The string that will be rendered. Line breaks ("\\n") and other
        special characters will not be rendered correctly. Set-only (as opposed
        to read-only).

    i    c         C   sX   t  j j |  | ƒ t  j t  j ƒ  t j j d d d ƒ d | ƒ |  _ |  j	 | ƒ d  S(   Nt	   resourcest   fontss   DejaVuSans.ttfi   (
   t   spyralt   Spritet   __init__t   Fontt   _get_spyral_patht   ost   patht   joint   _fontt   _render(   t   selft   scenet   textt   color(    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR      s    c         C   s   |  j  j | ƒ |  _ d S(   s~   
        Updates the sprite's image based on the new text.
        :param str text: The string that will be rendered.
        N(   R   t   rendert   image(   R   R   (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR   "   s    c         C   s   d S(   Nt    (    (   R   (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyt   <lambda>)   s    (   i    i    i    (   t   __name__t
   __module__t   __doc__R   R   t   propertyR   (    (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR       s   	t	   FPSSpritec           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s¤  
    A simple Sprite subclass for rapidly rendering the current frames-per-second
    and updates-per-second on the screen.

    :param scene: The parent View or Scene that this will live in.
    :type scene: :class:`View <spyral.View>` or :class:`Scene <spyral.Scene>`
    :param color: A three-tuple of RGB values ranging from 0-255. Defaults to
                  black (0, 0, 0).
    :type color: A three-tuple.

    c         C   s}   t  j j |  ƒ t  j t  j ƒ  t j j d d d ƒ d | ƒ |  _ |  j	 d d ƒ d |  _
 t  j j d |  j d | ƒd  S(	   NR   R   s   DejaVuSans.ttfi   i    i   s   director.updateR   (   R   R   R   R   R   R   R	   R
   R   R   t
   _update_int   eventt   registert   _update(   R   R   R   (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR   7   s    	c         C   s#   |  j  j d | | f ƒ |  _ d S(   s„   
        Updates the sprite's image based on the current fps/ups.
        :param int fps: The string that will be rendered.
        s   %d / %dN(   R   R   R   (   R   t   fpst   ups(    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR   A   s    c         C   sP   |  j  d 8_  |  j  d k rL d |  _  |  j j } |  j | j | j ƒ n  d S(   sT   
        Updates the clock with information about the FPS, every 5 seconds.
        i   i    i   N(   R   R   t   clockR   R   R   (   R   R    (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR   H   s
    	(   R   R   R   R   R   R   (    (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyR   +   s   	
	(   R   R   R   t   pygameR   R    R   (    (    (    s0   /usr/lib/python2.7/site-packages/spyral/debug.pyt   <module>   s
   #