
    kjK                        d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZmZmZmZ d dlZd dlmZ d dlmZmZ d dlmZ d d	lmZ d d
lmZmZmZmZ d dlmZ d dl m!Z!m"Z" eegef         Z# e j$        e%          Z&deegef         deegef         fdZ' G d d          Z( G d d          Z) G d d          Z* G d d          Z+dededdfdZ,dS )    N)ArgumentParser	Namespace)wraps)Path)AnyCallableOptionalUnion)	resources)BaseKeysKeyModifiers)AttributeNames)
IconLoader)DataDescriptionProgramDescriptionSceneDescriptionTextureDescription)Scene)	BaseTimerTimerfuncreturnc                 h     t                     dt          dt          dt          f fd            }|S )z9Decorator ensuring assigned callbacks are valid callablesargskwargsr   c                      t          | d                   s(t          d                    | d                              | i |S )N   z{} is not a callable)callable
ValueErrorformat)r   r   r   s     ^/home/agentuser/manim-venv/lib/python3.11/site-packages/moderngl_window/context/base/window.pywrapperz!require_callable.<locals>.wrapper    sN    Q   	E3::47CCDDDtT$V$$$    )r   r   )r   r"   s   ` r!   require_callabler$      sO     4[[%s %c %c % % % % % [%
 Nr#   c                       e Zd ZdZdZdZdZdS )MouseButtonszMaps what button id to a namer         N)__name__
__module____qualname____doc__leftrightmiddle r#   r!   r&   r&   )   s#        ''DEFFFr#   r&   c                   R    e Zd ZdZdZdZdZedefd            Z	de
fdZde
fdZdS )MouseButtonStatesz5Namespace for storing the current mouse button statesFr   c                 ,    | j         p| j        p| j        S )z&bool: if any mouse buttons are pressed)r-   r.   r/   selfs    r!   anyzMouseButtonStates.any8   s     y5DJ5$+5r#   c                      t          |           S N)strr4   s    r!   __repr__zMouseButtonStates.__repr__=   s    4yyr#   c                 N    d                     | j        | j        | j                  S )Nz-<MouseButtonStates left={} right={} middle={})r    r-   r.   r/   r4   s    r!   __str__zMouseButtonStates.__str__@   s'    >EEItz4;
 
 	
r#   N)r)   r*   r+   r,   r-   r.   r/   propertyboolr6   r9   r:   r<   r0   r#   r!   r2   r2   1   s        ??DEF6T 6 6 6 X6#    
 
 
 
 
 
 
r#   r2   c                   F   e Zd ZdZdZeZeZ	 	 	 	 	 	 	 	 	 	 	 	 dd
e	de
eef         de
eef         dededededee         dededee	         deeg eej                 f                  deddfdZddZedej        fd            Zedee	         fd            Zedefd            Zedej        fd            Zede	fd            Zej        de	ddfd             Zedefd!            Zej        deddfd"            Zedefd#            Zej        deddfd$            Zede
eef         fd%            Zedefd&            Z edefd'            Z!ede
eef         fd(            Z"e"j        de
eef         ddfd)            Z"edefd*            Z#edefd+            Z$ede
eef         fd,            Z%ede
eef         fd-            Z&e&j        de
eef         ddfd.            Z&edefd/            Z'ede
eeeef         fd0            Z(ede
eef         fd1            Z)edefd2            Z*edefd3            Z+edefd4            Z,edefd5            Z-e-j        deddfd6            Z-edefd7            Z.e.j        deddfd8            Z.edefd9            Z/e/j        deddfd:            Z/dd;Z0dd<Z1edefd=            Z2e2j        deddfd>            Z2eded?         fd@            Z3e3j        ddB            Z3edefdC            Z4e4j        deddfdD            Z4edefdE            Z5edee         fdF            Z6e6j        deddfdG            Z6edefdH            Z7edefdI            Z8e8j        deddfdJ            Z8edefdK            Z9e9j        deddfdL            Z9edeeegdf         fdM            Z:e:j        e;dNeeegdf         ddfdO                        Z:edeeegdf         fdP            Z<e<j        e;dNeeegdf         ddfdQ                        Z<edeg df         fdR            Z=e=j        e;dNeg df         ddfdS                        Z=edeeee>e?e	e@f                  gdf         fdT            ZAeAj        e;dNeeee>e?e	e@f                  gdf         ddfdU                        ZAedeegdf         fdV            ZBeBj        e;dNeegdf         ddfdW                        ZBedee?e	ef         eeCgdf         fdX            ZDeDj        e;dNee?e	ef         eeCgdf         ddfdY                        ZDedeeeeegdf         fdZ            ZEeEj        e;dNeeeeegdf         ddfd[                        ZEedeeeeegdf         fd\            ZFeFj        e;dNeeeeegdf         ddfd]                        ZFedeeeegdf         fd^            ZGeGj        e;dNeeeegdf         ddfd_                        ZGedeeeegdf         fd`            ZHeHj        e;dNeeeegdf         ddfda                        ZHedee	gdf         fdb            ZIeIj        e;dNee	gdf         ddfdc                        ZIedeeegdf         fdd            ZJeJj        e;dNeeegdf         ddfde                        ZJedeCfdf            ZKedeLfdg            ZMdhedieddfdjZN	 ddkedledmednede
eef         f
doZOdpe	defdqZPedefdr            ZQeQj        deddfds            ZQddtZRdduZS	 	 	 	 	 	 ddxedyedzed{ed|ed}ee
eeeef                  ddfd~ZTddededdfdZUddZVdededdfdZWde	ddfdZXde@ddfdZYdeddfdZZdeddfdZ[ddZ\ddZ]edefd            Z^ddZ_dedede
eef         fdZ`ede?eeeeegdf         df         fd            Zaeaj        e;dNeddfd                        ZadS )
BaseWindowz?
    Helper base class for a generic window implementation
    baseModernGLr(   r(   i   i  TFNr   title
gl_versionsize	resizablevisible
fullscreenvsyncaspect_ratiosamplescursorbackendcontext_creation_funcr   r   c                    || _         || _        t          |d                   t          |d                   c| _        | _        || _        || _        |\  | _        | _        || _	        || _
        || _        |	| _        |
| _        || _        d| _        || _        | j        j        | _        | j        j        | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _        t,          | _         t,          | _!        t,          | _"        t,          | _#        |  d| _$        d| _%        d| _&        d| _'        d| _(        i | _)        tU                      | _+        tY                      | _-        d| _.        d| _/        | j	        rd| _        | j        'ta          d1                    | j2                            dS )al  Initialize a window instance.

        Keyword Args:
            title:
                The window title
            gl_version:
                Major and minor version of the opengl context to create
            size:
                indow size x, y
            resizable:
                Should the window be resizable?
            visible:
                Should the window be visible when created?
            fullscreen:
                Open window in fullscreen mode
            vsync:
                Enable/disable vsync
            aspect_ratio:
                The desired fixed aspect ratio. Can be set to ``None`` to make
                aspect ratio be based on the actual window size.
            samples:
                Number of MSAA samples for the default framebuffer
            cursor:
                Enable/disable displaying the cursor inside the window
            backend:
                The context backend to use. For example ``egl`` for EGL
            context_creation_func:
                A callable returning a ModernGL context. This can be used to
                create a custom context.
        r   r   F)r   r   r   r   )r   r   Nz&Window class {} missing keys attribute)3_title_gl_versionint_width_height
_resizable_visible_buffer_width_buffer_height_fullscreen_vsync_fixed_aspect_ratio_samples_cursor_backend	_headless_context_creation_funckeysESCAPE	_exit_keyF11_fs_key
dummy_func_render_func_resize_func_close_func_iconify_func_key_event_func_mouse_position_event_func_mouse_press_event_func_mouse_release_event_func_mouse_drag_event_func_mouse_scroll_event_func_unicode_char_entered_func_files_dropped_event_func_on_generic_event_func	_viewport	_position_frames_close_config_key_pressed_mapr   
_modifiersr2   _mouse_buttons
_mouse_pos_mouse_exclusivityr   r    	__class__)r5   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r   s                 r!   __init__zBaseWindow.__init__R   s   ^ %$'QLL#d1g,,!T\#26/D/%#/ &;#)y} =G8B/95?U_PZ'HR$JT&LV#HR%AK' 	& 1;# 	#4@HL=?&../11"'  	$#DO9ELLT^\\]]] r#   c                     d}| j         r|                                  }|t          j        | j                  }|| _        | j        j        }|dk    rt                              d|           dS dS )z
        Create or assign a ModernGL context. If no context is supplied a context will be
        created using the window's ``gl_version``.

        Keyword Args:
            ctx: An optional custom ModernGL context
        N)requireGL_NO_ERRORz8Consumed the following error during context creation: %s)rb   modernglcreate_contextgl_version_code_ctxerrorloggerinfo)r5   ctxerrs      r!   init_mgl_contextzBaseWindow.init_mgl_context   s     +/& 	0--//C;)$2FGGGC	io-KKRTWXXXXX  r#   c                     | j         S )z5moderngl.Context: The ModernGL context for the window)r   r4   s    r!   r   zBaseWindow.ctx   s     yr#   c                     | j         S )z
        Name of the context backend.

        This is ``None`` unless a backend is explicitly specified
        during context creation. The main use case for this is to
        enable EGL in headless mode.
        )r`   r4   s    r!   rO   zBaseWindow.backend   s     }r#   c                     | j         S )zbool: Is the window headless?)ra   r4   s    r!   headlesszBaseWindow.headless        ~r#   c                     | j         j        S )z-moderngl.Framebuffer: The default framebuffer)r   screenr4   s    r!   fbozBaseWindow.fbo   s     yr#   c                     | j         S )zlstr: Window title.

        This property can also be set::

            window.title = "New Title"
        rR   r4   s    r!   rE   zBaseWindow.title   s     {r#   valuec                     || _         d S r8   r   r5   r   s     r!   rE   zBaseWindow.title       r#   c                     | j         S )a  Get or set the fullscreen toggle key for the window.

        Pressing this key will toggle fullscreen for the window.

        By default this is set to ``F11``, but this can be overridden or disabled::

            # Default fullscreen key
            window.fullscreen_key = window.keys.F11

            # Set some other random fullscreen key
            window.fullscreen_key = window.keys.F

            # Disable the fullscreen key
            window.fullscreen_key = None
        rg   r4   s    r!   fullscreen_keyzBaseWindow.fullscreen_key   s    " |r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.fullscreen_key      r#   c                     | j         S )a  Get or set the exit/close key for the window.

        Pressing this key will close the window.

        By default the ``ESCAPE`` is set, but this can be overridden or disabled::

            # Default exit key
            window.exit_key = window.keys.ESCAPE

            # Set some other random exit key
            window.exit_key = window.keys.Q

            # Disable the exit key
            window.exit_key = None
        re   r4   s    r!   exit_keyzBaseWindow.exit_key  s    " ~r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.exit_key  s    r#   c                     | j         S )z7tuple[int, int]: (major, minor) required OpenGL version)rS   r4   s    r!   rF   zBaseWindow.gl_version"       r#   c                     | j         S )zint: The current window width)rU   r4   s    r!   widthzBaseWindow.width'       {r#   c                     | j         S )zint: The current window height)rV   r4   s    r!   heightzBaseWindow.height,       |r#   c                     | j         | j        fS )ztuple[int, int]: current window size.

        This property also support assignment::

            # Resize the window to 1000 x 1000
            window.size = 1000, 1000
        )rU   rV   r4   s    r!   rG   zBaseWindow.size1  s     {DL((r#   c                 p    t          |d                   t          |d                   c| _        | _        d S Nr   r   )rT   rU   rV   r   s     r!   rG   zBaseWindow.size<  s*    $'aMM3uQx==!T\\\r#   c                     | j         S )z$int: the current window buffer width)rY   r4   s    r!   buffer_widthzBaseWindow.buffer_width@       !!r#   c                     | j         S )z%int: the current window buffer height)rZ   r4   s    r!   buffer_heightzBaseWindow.buffer_heightE  s     ""r#   c                     | j         | j        fS )z:tuple[int, int]: tuple with the current window buffer size)rY   rZ   r4   s    r!   buffer_sizezBaseWindow.buffer_sizeJ  s     !4#666r#   c                     | j         S )ztuple[int, int]: The current window position.

        This property can also be set to move the window::

            # Move window to 100, 100
            window.position = 100, 100
        )rw   r4   s    r!   positionzBaseWindow.positionO  s     ~r#   c                 d    t          |d                   t          |d                   f| _        d S r   )rT   rw   r   s     r!   r   zBaseWindow.positionZ  s&    U1XE!H5r#   c                 8    | j         d         | j        d         z  S )z(float: The framebuffer/window size ratior   )r   rG   r4   s    r!   pixel_ratiozBaseWindow.pixel_ratio^  s     "TYq\11r#   c                     | j         S )z2tuple[int, int, int, int]: current window viewportrv   r4   s    r!   viewportzBaseWindow.viewportc  r   r#   c                 6    | j         d         | j         d         fS )zltuple[int,int]: Size of the viewport.

        Equivalent to ``self.viewport[2], self.viewport[3]``
        r'   r(   r   r4   s    r!   viewport_sizezBaseWindow.viewport_sizeh  s     ~a $."333r#   c                     | j         d         S )zUint: The width of the viewport.

        Equivalent to ``self.viewport[2]``.
        r'   r   r4   s    r!   viewport_widthzBaseWindow.viewport_widthp       }Qr#   c                     | j         d         S )zUint: The height of the viewport

        Equivalent to ``self.viewport[3]``.
        r(   r   r4   s    r!   viewport_heightzBaseWindow.viewport_heightx  r   r#   c                     | j         S )zint: Number of frames rendered)rx   r4   s    r!   frameszBaseWindow.frames  r   r#   c                     | j         S )zbool: Window is resizablerW   r4   s    r!   rH   zBaseWindow.resizable       r#   c                     || _         d S r8   r   r   s     r!   rH   zBaseWindow.resizable  s    r#   c                     | j         S )zbool: Window is visiblerX   r4   s    r!   rI   zBaseWindow.visible       }r#   c                     || _         d S r8   r   r   s     r!   rI   zBaseWindow.visible  s    r#   c                     | j          S )zbool: Window is hiddenr   r4   s    r!   hiddenzBaseWindow.hidden  s     =  r#   c                     | | _         d S r8   r   r   s     r!   r   zBaseWindow.hidden  s    !	r#   c                     d| _         dS )zHide the windowFNrI   r4   s    r!   hidezBaseWindow.hide  r   r#   c                     d| _         dS )zShow the windowTNr   r4   s    r!   showzBaseWindow.show  s    r#   c                     | j         S )z"bool: Window is in fullscreen mode)r[   r4   s    r!   rJ   zBaseWindow.fullscreen  r   r#   c                 >    |                      |           || _        d S r8   )_set_fullscreenr[   r   s     r!   rJ   zBaseWindow.fullscreen  s$    U### r#   WindowConfigc                 <    | j         |                                  S dS )zGet or det the current WindowConfig instance

        Assigning a WindowConfig instance will automatically
        set up the necessary event callback methods::

            window.config = window_config_instance
        N)rz   r4   s    r!   configzBaseWindow.config  s     <#<<>>!tr#   r   c                 `    |                                  t          j        |          | _        d S r8   )assign_event_callbacksweakrefrefrz   )r5   r   s     r!   r   zBaseWindow.config  s)    %%'''{6**r#   c                     | j         S )z$bool: vertical sync enabled/disabled)r\   r4   s    r!   rK   zBaseWindow.vsync  r   r#   c                 >    |                      |           || _        d S r8   )
_set_vsyncr\   r   s     r!   rK   zBaseWindow.vsync  s    r#   c                 <    | j         r| j         S | j        | j        z  S )a  float: The current aspect ratio of the window.
        If a fixed aspect ratio was passed to the window
        initializer this value will always be returned.
        Otherwise ``width / height`` will be returned.

        This property is read only.
        )r]   r   r   r4   s    r!   rL   zBaseWindow.aspect_ratio  s'     # 	,++zDK''r#   c                     | j         S )a  float: The fixed aspect ratio for the window.

        Can be set to ``None`` to disable fixed aspect ratio
        making the aspect ratio adjust to the actual window size

        This will affects how the viewport is calculated and
        the reported value from the ``aspect_ratio`` property::

            # Enabled fixed aspect ratio
            window.fixed_aspect_ratio = 16 / 9

            # Disable fixed aspect ratio
            window.fixed_aspect_ratio = None
        r]   r4   s    r!   fixed_aspect_ratiozBaseWindow.fixed_aspect_ratio  s      ''r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.fixed_aspect_ratio  s    #(   r#   c                     | j         S )z9float: Number of Multisample anti-aliasing (MSAA) samples)r^   r4   s    r!   rM   zBaseWindow.samples  r   r#   c                     | j         S )zbool: Should the mouse cursor be visible inside the window?

        This property can also be assigned to::

            # Disable cursor
            window.cursor = False
        r_   r4   s    r!   rN   zBaseWindow.cursor  s     |r#   c                     || _         d S r8   r   r   s     r!   rN   zBaseWindow.cursor  r   r#   c                     | j         S )u  bool: If mouse exclusivity is enabled.

        When you enable mouse-exclusive mode, the mouse cursor is no longer
        available. It is not merely hidden – no amount of mouse movement
        will make it leave your application. This is for example useful
        when you don't want the mouse leaving the screen when rotating
        a 3d scene.

        This property can also be set::

            window.mouse_exclusivity = True
        r   r4   s    r!   mouse_exclusivityzBaseWindow.mouse_exclusivity  s     &&r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.mouse_exclusivity  s    "'r#   c                     | j         S )zdcallable: The render callable

        This property can also be used to assign a callable.
        ri   r4   s    r!   render_funczBaseWindow.render_func  s       r#   r   c                     || _         d S r8   r   r5   r   s     r!   r   zBaseWindow.render_func#       !r#   c                     | j         S )z(callable: Get or set the resize callablerj   r4   s    r!   resize_funczBaseWindow.resize_func(  s       r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.resize_func-  r   r#   c                     | j         S )z'callable: Get or set the close callablerk   r4   s    r!   
close_funczBaseWindow.close_func2  r   r#   c                     || _         d S r8   r   r   s     r!   r   zBaseWindow.close_func7  s      r#   c                     | j         S )z/callable: Get or set the files_dropped callablert   r4   s    r!   files_dropped_event_funcz#BaseWindow.files_dropped_event_func<       --r#   c                     || _         d S r8   r  r   s     r!   r  z#BaseWindow.files_dropped_event_funcA  s    
 *.&&&r#   c                     | j         S )z3callable: Get or set ehe iconify/show/hide callablerl   r4   s    r!   iconify_funczBaseWindow.iconify_funcH  r   r#   c                     || _         d S r8   r  r   s     r!   r	  zBaseWindow.iconify_funcM  s     "r#   c                     | j         S )z+callable: Get or set the key_event callablerm   r4   s    r!   key_event_funczBaseWindow.key_event_funcR  s     ##r#   c                     || _         d S r8   r  r   s     r!   r  zBaseWindow.key_event_funcW  s      $r#   c                     | j         S )z0callable: Get or set the mouse_position callablern   r4   s    r!   mouse_position_event_funcz$BaseWindow.mouse_position_event_func\       ..r#   c                     || _         d S r8   r  r   s     r!   r  z$BaseWindow.mouse_position_event_funca       +/'''r#   c                     | j         S )z,callable: Get or set the mouse_drag callablerq   r4   s    r!   mouse_drag_event_funcz BaseWindow.mouse_drag_event_funcf  s     **r#   c                     || _         d S r8   r  r   s     r!   r  z BaseWindow.mouse_drag_event_funck       '+###r#   c                     | j         S )z-callable: Get or set the mouse_press callablero   r4   s    r!   mouse_press_event_funcz!BaseWindow.mouse_press_event_funcp  s     ++r#   c                     || _         d S r8   r  r   s     r!   r  z!BaseWindow.mouse_press_event_funcu  s     (,$$$r#   c                     | j         S )z/callable: Get or set the mouse_release callablerp   r4   s    r!   mouse_release_event_funcz#BaseWindow.mouse_release_event_funcz  r  r#   c                     || _         d S r8   r  r   s     r!   r   z#BaseWindow.mouse_release_event_func  s     *.&&&r#   c                     | j         S )z6callable: Get or set the unicode_char_entered callablers   r4   s    r!   unicode_char_entered_funcz$BaseWindow.unicode_char_entered_func  r  r#   c                     || _         d S r8   r#  r   s     r!   r$  z$BaseWindow.unicode_char_entered_func  r  r#   c                     | j         S )z3callable: Get or set the mouse_scroll_event calablerr   r4   s    r!   mouse_scroll_event_funcz"BaseWindow.mouse_scroll_event_func  s     ,,r#   c                     || _         d S r8   r'  r   s     r!   r(  z"BaseWindow.mouse_scroll_event_func  s     )-%%%r#   c                     | j         S )z-(KeyModifiers) The current keyboard modifiers)r|   r4   s    r!   	modifierszBaseWindow.modifiers  r   r#   c                     | j         S )zMouseButtonStates: Mouse button state structure.

        The current mouse button states.

        .. code::

            window.mouse_buttons.left
            window.mouse_buttons.right
            window.mouse_buttons.middle
        )r}   r4   s    r!   mouse_stateszBaseWindow.mouse_states  s     ""r#   buttonpressedc                     || j         j        k    r|| j        _        dS || j         j        k    r|| j        _        dS || j         j        k    r|| j        _        dS t          d                    |                    )zUpdates the internal mouse button state object.

        Args:
            button (int): The button number [1, 2 or 3]
            pressed (bool): Pressed (True) or released (False)
        z$Incompatible mouse button number: {}N)mouser-   r}   r.   r/   r   r    )r5   r.  r/  s      r!   !_handle_mouse_button_state_changez,BaseWindow._handle_mouse_button_state_change  s     TZ_$$'.D$$$tz'''(/D%%%tz((()0D&&&CJJ6RRSSSr#   xy	x_flipped	y_flippedc                 Z    |s|s||fS |r|s|| j         |z
  fS | j        |z
  | j         |z
  fS )a	  
        Convert window coordinates to top-left coordinate space.
        The default origin is the top left corner of the window.

        - If you are converting from bottom origin coordinates use x_flipped=True
        - If you are converting from right origin coordinates use y_flipped=True

        Args:
            x_flipped (bool) - if the input x origin is flipped
            y_flipped (bool) - if the input y origin is flipped
        Returns:
            tuple (x, y) of converted window coordinates

        )r   r   )r5   r3  r4  r5  r6  s        r!   convert_window_coordinatesz%BaseWindow.convert_window_coordinates  sS    "  	5 	5q6M 	5y 	5t{Q''JNDK!O44r#   keyc                 :    | j                             |          du S )z!Returns: The press state of a keyT)r{   get)r5   r9  s     r!   is_key_pressedzBaseWindow.is_key_pressed  s    $((--55r#   c                     | j         S )z#bool: Is the window about to close?ry   r4   s    r!   
is_closingzBaseWindow.is_closing  r   r#   c                     || _         d S r8   r>  r   s     r!   r?  zBaseWindow.is_closing  r   r#   c                 <    d| _         |                                  dS )zSignal for the window to closeTN)r?  r   r4   s    r!   closezBaseWindow.close  s    r#   c                 B    | j         j                                         dS )zBind the window's framebufferN)r   r   user4   s    r!   rD  zBaseWindow.use  s    	r#                 ?redgreenbluealphadepthr   c                 n    |                                   | j                            ||||||           dS )aD  
        Binds and clears the default framebuffer

        Args:
            red (float): color component
            green (float): color component
            blue (float): color component
            alpha (float): alpha component
            depth (float): depth value
            viewport (tuple): The viewport
        )rG  rH  rI  rJ  rK  r   N)rD  r   clear)r5   rG  rH  rI  rJ  rK  r   s          r!   rM  zBaseWindow.clear  sF    ( 	


	5t5PX 	 	
 	
 	
 	
 	
r#   time
frame_timec                 2    |                      ||           dS )z
        Renders a frame by calling the configured render callback

        Keyword Args:
            time (float): Current time in seconds
            frame_time (float): Delta time from last frame in seconds
        N)r   r5   rN  rO  s      r!   renderzBaseWindow.render  s      	z*****r#   c                     t                      )zJ
        Library specific buffer swap method. Must be overridden.
        NotImplementedErrorr4   s    r!   swap_bufferszBaseWindow.swap_buffers       "###r#   r   r   c                 R    | j         t          ur|                      ||           dS dS )zz
        Should be called every time window is resized
        so the example can adapt to the new size if needed
        N)rj   rh   r5   r   r   s      r!   resizezBaseWindow.resize  s6    
 J..eV,,,,, /.r#   	icon_pathc                     t          t          |                    }|                                }|                     |           dS )zu
        Sets the window icon to the given path

        Args:
            icon_path (str): path to the icon
        )pathN)r   r   	find_icon	_set_icon)r5   r[  loaderresolved_paths       r!   set_iconzBaseWindow.set_icon  sF     .I>>>??((**}%%%%%r#   c                 P    t          d                    | j                            )z@
        A library specific destroy method is required.
        z=Setting an icon is currently not supported by Window-type: {}rU  r    name)r5   r[  s     r!   r_  zBaseWindow._set_icon%  s+     "KRRSWS\]]
 
 	
r#   c                 P    t          d                    | j                            )?
        A library specific destroy method is required
        zAToggling fullscreen is currently not supported by Window-type: {}rd  r   s     r!   r   zBaseWindow._set_fullscreen-  s+     "OVVW[W`aa
 
 	
r#   c                 P    t          d                    | j                            )Nz<Toggling vsync is currently not supported by Window-type: {}rd  r   s     r!   r   zBaseWindow._set_vsync5  s)    !JQQRVR[\\
 
 	
r#   c                     t                      )rg  rT  r4   s    r!   destroyzBaseWindow.destroy:  rW  r#   c                 d   | j         rt          | j        | j         z            }t          || j         z            }|| j        k    r| j        }t          || j         z            }| j        |z
  }| j        |z
  }|dz  |dz  ||f| _        ndd| j        | j        f| _        | j        | j        _        dS )a  
        Calculates the and sets the viewport based on window configuration.

        The viewport will based on the configured fixed aspect ratio if set.
        If no fixed aspect ratio is set the viewport will be scaled
        to the entire window size regardless of size.

        Will add black borders and center the viewport if the window
        do not match the configured viewport (fixed only)
        r'   r   N)r]   rT   rZ   rY   rv   r   r   )r5   expected_widthexpected_heightblank_space_xblank_space_ys        r!   set_default_viewportzBaseWindow.set_default_viewport@  s     # 	M !4t7O!OPPN!.43K"KLLO 222!%!3"%nt7O&O"P"P .?M //AM ""	DNN  D$68KLDN Nr#   c                 D    | j         d         dz  | j         d         dz  z   S )zxint: Generates the version code integer for the selected OpenGL version.

        gl_version (4, 1) returns 410
        r   d   r   
   )rF   r4   s    r!   r   zBaseWindow.gl_version_codea  s'     q!C'$/!*<r*AAAr#   c                    t                               d           t                               dt          j                   t                               d| j        j        d                    t                               d| j        j        d                    t                               d| j        j        d                    t                               d	t
          j                   t                               d
t
          j                   t                               d| j        j                   | j        j	        }|dk    rt           
                    d|           dS dS )zPrints moderngl context info.zContext Version:zModernGL: %sz
vendor: %s	GL_VENDORzrenderer: %sGL_RENDERERzversion: %s
GL_VERSIONz
python: %szplatform: %szcode: %sr   z/glerror consumed after getting context info: %sN)r   r   r   __version__r   sysversionplatformversion_coder   warning)r5   r   s     r!   print_context_infozBaseWindow.print_context_infoi  s   &'''NH$8999L$)."=>>>NDIN=$ABBBM49>,#?@@@L#+...NCL111J	 6777 io-NNLcRRRRR  r#   xposyposc                 \    || j         d         z
  || j         d         z
  }}||f| _         ||fS )zCalculates the mouse position delta for events not support this.

        Args:
            xpos (int): current mouse x
            ypos (int): current mouse y
        Returns:
            tuple[int, int]: The x, y delta values
        r   r   )r~   )r5   r  r  dxdys        r!   _calc_mouse_deltazBaseWindow._calc_mouse_deltay  s9     **D4?13E,EB*2vr#   c                     | j         S )zt
        callable: Get or set the on_generic_event callable
        used to funnel all non-processed events
        r  r4   s    r!   on_generic_event_funcz BaseWindow.on_generic_event_func  s     ..r#   c                     || _         d S r8   )ru   r   s     r!   r  z BaseWindow.on_generic_event_func  r  r#   )rB   rC   rD   TTFTNr   TNNr   N)r   r   r   N)FF)rE  rE  rE  rE  rF  N)rE  rE  )br)   r*   r+   r,   re  r   rc   r&   r1  r9   tuplerT   r>   r	   floatr   r   Contextr   r   r   r=   r   rO   r   Framebufferr   rE   setterr   r   rF   r   r   rG   r   r   r   r   r   r   r   r   r   r   rH   rI   r   r   r   rJ   r   rK   rL   r   rM   rN   r   r   r$   r   r   listr
   r   r  r	  r   r  r  r  r  r   r$  r(  r+  r2   r-  r2  r8  r<  r?  rB  rD  rM  rR  rV  rZ  rb  r_  r   r   rj  rp  r   r~  r  r  r0   r#   r!   r@   r@   F   s        
 DDE  &, + (,!%TXe^ e^e^ #s(Oe^ CHo	e^
 e^ e^ e^ e^ uoe^ e^ e^ #e^  (Xh>N5O1O(PQe^ e^ 
e^ e^ e^ e^NY Y Y Y& X%    X #    X $    X  X)       X  s    X \3 4    \     X$ C D     #    X$ _c d    _  E#s(O       X  s    X     X )eCHo ) ) ) X) 
[A%S/ Ad A A A [A "c " " " X" #s # # # X# 7U38_ 7 7 7 X7 %S/    X _6eCHo 6$ 6 6 6 _6 2U 2 2 2 X2 %S#s 23    X 4uS#X 4 4 4 X4         X          X      X 4    X  t               X ^T d    ^ ! ! ! ! X! ]"D "T " " " ]"        D       X  ! ! ! ! ! ! 0    X ]+ + + ]+ t    X \4 D    \ (e ( ( ( X( (HUO ( ( ( X(" ) )$ ) ) ) )     X     X ]D T    ] '4 ' ' ' X' (t ( ( ( ( ( !Xuend&:; ! ! ! X! !%)= > !4 ! ! !  ! !XsCj$&67 ! ! ! X! !#sT)9 : !t ! ! !  !  HRX.       X   xD1  d          .(Cd5dCS>T3UW[3[*\ . . . X. $.c3U39-=(>?EF.	. . .  %$.
 "hvt|4 " " " X" "4&$,!7 "D " " "  " $%S/3)Mt)S T $ $ $ X$ $8U38_c<,PRV,V#W $\` $ $ $  $ /8S#sC4H$4N+O / / / X/ %/hS#s7KT7Q.R /W[ / / /  &%/ +xc30Dd0J'K + + + X+ !+(Cc33G3M*N +SW + + +  "!+ ,#sC$1F(G , , , X, ",8S#sOT4I+J ,t , , ,  #", .(Cc?D3H*I . . . X. $.XsCot6K-L .QU . . .  %$. /8SE4K+@ / / / X/ %/hud{.C / / / /  &%/ -5%.$2F)G - - - X- #-HeU^T5I,J -t - - -  $#- <    X #/ # # # X#T Td Tt T T T T" JO5 555)-5BF5	sCx5 5 5 506# 6$ 6 6 6 6 D    X         
    8<
 

 
 	

 
 
 5c3!345
 

 
 
 
2+ +5 +E +D + + + +$ $ $ $-C - - - - - -	&# 	&$ 	& 	& 	& 	&
4 
D 
 
 
 

T 
d 
 
 
 

 
 
 
 
 

$ $ $ $+ + + +B B B B B XBS S S S c  sCx     /	xc3,d23T9	:/ / / X/ !+( +t + + +  "!+ + +r#   r@   c                   J   e Zd ZU dZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 dZ	 dZ	 dZ	 d	Z	 d
Z	 dZ	 ej        Z	 d
Zee         ed<   	 	 	 	 dYdeej                 dee         dee         dedd
f
dZdZdZede d          dd
fd            Z!ede d          de"dd
fd            Z#edeej                 fd            Z$de%de%dd
fdZ&de'de'dd
fdZ(dZdZ)d e'd!e'd"e*e+         dd
fd#Z,d$e-dd
fd%Z.d&ed'ed(e/dd
fd)Z0d e'd!e'd*e'd+e'dd
f
d,Z1d e'd!e'd*e'd+e'dd
f
d-Z2d e'd!e'd.e'dd
fd/Z3d e'd!e'd.e'dd
fd0Z4d1e%d2e%dd
fd3Z5d4e+dd
fd5Z6	 	 	 	 	 	 d[d7e+d8e-d9e-d:e-d;e-d<ee7e'e'f                  d=e%dedej8        fd>Z9	 	 	 	 	 d\d7e+d?e'd8e-d;e-d<ee7e'e'f                  d=e%dedej:        fd@Z;	 	 	 	 	 	 	 	 	 	 	 	 d]dBe+dCe+dDe+dEe+dFe+dGe+d8e-d9e-d:e-d;e-d<ee7e'e'f                  d=e%dedej<        fdHZ=	 	 	 	 	 	 	 	 d^d7ee+         dIee+         dJee+         dKee+         dLee+         dMee+         dNee>e+ef                  dOee*e+                  dej?        fdPZ@	 d_d7e+dNee>e+ef                  dedejA        fdQZBd7e+dede+fdRZCd7e+dede>e+ef         fdSZDd7e+dedeEfdTZFdeGd
fd7e+dUe-dVe eG         dWee+         dedeHfdXZId
S )`r   a  
    Creating a ``WindowConfig`` instance is the simplest interface
    this library provides to open and window, handle inputs and provide simple
    shortcut method for loading basic resources. It's appropriate
    for projects with basic needs.

    Example:

    .. code:: python

        import moderngl_window

        class MyConfig(moderngl_window.WindowConfig):
            gl_version = (3, 3)
            window_size = (1920, 1080)
            aspect_ratio = 16 / 9
            title = "My Config"
            resizable = False
            samples = 8

            def __init__(self, **kwargs):
                super().__init__(**kwargs)
                # Do other initialization here

            def on_render(self, time: float, frametime: float):
                # Render stuff here with ModernGL

            def on_resize(self, width: int, height: int):
                print("Window was resized. buffer size is {} x {}".format(width, height))

            def on_mouse_position_event(self, x, y, dx, dy):
                print("Mouse position:", x, y)

            def on_mouse_press_event(self, x, y, button):
                print("Mouse button {} pressed at {}, {}".format(button, x, y))

            def on_mouse_release_event(self, x: int, y: int, button: int):
                print("Mouse button {} released at {}, {}".format(button, x, y))

            def on_key_event(self, key, action, modifiers):
                print(key, action, modifiers)
    rD   TFrC   Examplegqq?)rE  rE  rE  rE  r   N   argvr   wndtimerr   r   c                    | j         r8t          j        t          | j                                                              |t          |t          j                  s"t          d	                    |                    |t          |t                    s"t          d	                    |                    || _        || _        |pt                      | _        |                                  dS )zInitialize the window config

        Keyword Args:
            ctx (moderngl.Context): The moderngl context
            wnd: The window instance
            timer: The timer instance
        Nz0WindowConfig requires a moderngl context. ctx={}z&WindowConfig requires a window. wnd={})resource_dirr   register_dirr   resolve
isinstancer   r  r   r    r@   r   r  r   r  r   )r5   r   r  r  r   s        r!   r   zWindowConfig.__init__T  s      	F"4(9#:#:#B#B#D#DEEE;jh.>??;OVVWZ[[\\\;jj99;ELLSQQRRR % 0
##%%%%%r#   c                    t          | dt                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _	        t          | dt                    | j        _
        t          | d	t                    | j        _        t          | d
t                    | j        _        t          | dt                    | j        _        t          | dt                    | j        _        dS )z
        Look for methods in the class instance and assign them to callbacks.
        This method is call by ``__init__``.
        	on_render	on_resizeon_close
on_iconifyon_key_eventon_mouse_position_eventon_mouse_press_eventon_mouse_release_eventon_mouse_drag_eventon_mouse_scroll_eventon_unicode_char_enteredon_files_dropped_eventN)getattrrh   r  r   r   r   r	  r  r  r  r   r  r(  r$  r  r4   s    r!   r   z#WindowConfig.assign_event_callbacksq  s   
  't[*EE&t[*EE%dJ
CC 'lJ G G")$
"K"K-4T;TV`-a-a**1$8NPZ*[*[',3D:RT^,_,_))07Lj)Y)Y&+249PR\+]+](-4T;TV`-a-a*,3D:RT^,_,_)))r#   clsc                 8    ddl }|                    |            dS )zShortcut for running a ``WindowConfig``.

        This executes the following code::

            import moderngl_window
            moderngl_window.run_window_config(cls)
        r   N)moderngl_windowrun_window_config)r  r  s     r!   runzWindowConfig.run  s*     	))#.....r#   parserc                     dS )zAdd arguments to default argument parser.
        Add arguments using ``add_argument(..)``.

        Args:
            parser (ArgumentParser): The default argument parser.
        Nr0   )r  r  s     r!   add_argumentszWindowConfig.add_arguments  s	     	r#   c                     dS )z
        Can be implemented to control the creation of the moderngl context.

        The window calls this method first during context creation.
        If not context is returned the window will create its own.
        Nr0   )r  s    r!   r   zWindowConfig.init_mgl_context  s	     tr#   rN  rO  c                      t          d          )zRenders the assigned effect

        Args:
            time (float): Current time in seconds
            frame_time (float): Delta time from last frame in seconds
        z&WindowConfig.on_render not implementedrT  rQ  s      r!   r  zWindowConfig.on_render  s     ""JKKKr#   r   r   c                     dS )a  
        Called every time the window is resized
        in case the we need to do internal adjustments.

        Args:
            width (int): width in buffer size (not window size)
            height (int): height in buffer size (not window size)
        Nr0   rY  s      r!   r  zWindowConfig.on_resize        r#   c                     dS )z(Called when the window is about to closeNr0   r4   s    r!   r  zWindowConfig.on_close  r  r#   r3  r4  pathsc                     dS )a  
        Called when files dropped onto the window

        Args:
            x (int): X location in window where file was dropped
            y (int): Y location in window where file was dropped
            paths (list): List of file paths dropped
        Nr0   )r5   r3  r4  r  s       r!   r  z#WindowConfig.on_files_dropped_event  r  r#   	iconifiedc                     dS )z
        Called when the window is minimized/iconified
        or restored from this state

        Args:
            iconified (bool): If ``True`` the window is iconified/minimized. Otherwise restored.
        Nr0   )r5   r  s     r!   r  zWindowConfig.on_iconify  r  r#   r9  actionr+  c                     dS )a  
        Called for every key press and release.
        Depending on the library used, key events may
        trigger repeating events during the pressed duration
        based on the configured key repeat on the users
        operating system.

        Args:
            key: The key that was press. Compare with self.wnd.keys.
            action: self.wnd.keys.ACTION_PRESS or ACTION_RELEASE
            modifiers: Modifier state for shift, ctrl and alt
        Nr0   )r5   r9  r  r+  s       r!   r  zWindowConfig.on_key_event  r  r#   r  r  c                     dS )a  Reports the current mouse cursor position in the window

        Args:
            x (int): X position of the mouse cursor
            y (int): Y position of the mouse cursor
            dx (int): X delta position
            dy (int): Y delta position
        Nr0   r5   r3  r4  r  r  s        r!   r  z$WindowConfig.on_mouse_position_event  r  r#   c                     dS )a  Called when the mouse is moved while a button is pressed.

        Args:
            x (int): X position of the mouse cursor
            y (int): Y position of the mouse cursor
            dx (int): X delta position
            dy (int): Y delta position
        Nr0   r  s        r!   r  z WindowConfig.on_mouse_drag_event  r  r#   r.  c                     dS )zCalled when a mouse button in pressed

        Args:
            x (int): X position the press occurred
            y (int): Y position the press occurred
            button (int): 1 = Left button, 2 = right button
        Nr0   r5   r3  r4  r.  s       r!   r  z!WindowConfig.on_mouse_press_event  r  r#   c                     dS )zCalled when a mouse button in released

        Args:
            x (int): X position the release occurred
            y (int): Y position the release occurred
            button (int): 1 = Left button, 2 = right button
        Nr0   r  s       r!   r  z#WindowConfig.on_mouse_release_event  r  r#   x_offsety_offsetc                     dS )a  Called when the mouse wheel is scrolled.

        Some input devices also support horizontal scrolling,
        but vertical scrolling is fairly universal.

        Args:
            x_offset (int): X scroll offset
            y_offset (int): Y scroll offset
        Nr0   )r5   r  r  s      r!   r  z"WindowConfig.on_mouse_scroll_event  r  r#   charc                     dS )zwCalled when the user entered a unicode character.

        Args:
            char (str): The character entered
        Nr0   )r5   r  s     r!   r  z$WindowConfig.on_unicode_char_entered  r  r#   rF  r]  flipflip_xflip_ymipmapmipmap_levels
anisotropyc                 d    t           j                            t          d|||||||d|          S )aK  Loads a 2D texture.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Args:
            path (str): Path to the texture relative to search directories
        Keyword Args:
            flip (boolean): (Use ```flip_y``) Flip the image vertically (top to bottom)
            flip_x (boolean): Flip the image horizontally (left to right)
            flip_y (boolean): Flip the image vertically (top to bottom)
            mipmap (bool): Generate mipmaps. Will generate max possible levels unless
                           `mipmap_levels` is defined.
            mipmap_levels (tuple): (base, max_level) controlling mipmap generation.
                                   When defined the `mipmap` parameter is automatically `True`
            anisotropy (float): Number of samples for anisotropic filtering
            **kwargs: Additional parameters to TextureDescription
        Returns:
            moderngl.Texture: Texture instance
        )r]  r  r  r  r  r  r  r0   r   texturesloadr   )	r5   r]  r  r  r  r  r  r  r   s	            r!   load_texture_2dzWindowConfig.load_texture_2d  sV    @ !&& 	+%	 	 	 	
 
 	
r#   layersc                 |    |i }d|vrd|d<   t           j                            t          d||||||d|          S )a  Loads a texture array.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Args:
            path (str): Path to the texture relative to search directories
        Keyword Args:
            layers (int): How many layers to split the texture into vertically
            flip (boolean): Flip the image horizontally
            mipmap (bool): Generate mipmaps. Will generate max possible levels unless
                           `mipmap_levels` is defined.
            mipmap_levels (tuple): (base, max_level) controlling mipmap generation.
                                   When defined the `mipmap` parameter is automatically `True`
            anisotropy (float): Number of samples for anisotropic filtering

            **kwargs: Additional parameters to TextureDescription
        Returns:
            moderngl.TextureArray: The texture instance
        Nkindarray)r]  r  r  r  r  r  r0   r  )r5   r]  r  r  r  r  r  r   s           r!   load_texture_arrayzWindowConfig.load_texture_array@  sp    > >F$F6N!&& +%   

 

 
	
r#    pos_xpos_ypos_zneg_xneg_yneg_zc                 p    t           j                            t          d|||||||||	|
||dd|          S )a  Loads a texture cube.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Keyword Args:
            pos_x (str): Path to texture representing positive x face
            pos_y (str): Path to texture representing positive y face
            pos_z (str): Path to texture representing positive z face
            neg_x (str): Path to texture representing negative x face
            neg_y (str): Path to texture representing negative y face
            neg_z (str): Path to texture representing negative z face
            flip (boolean): (Use ``flip_y``)Flip the image vertically (top to bottom)
            flip_x (boolean): Flip the image horizontally (left to right)
            flip_y (boolean): Flip the image vertically (top to bottom)
            mipmap (bool): Generate mipmaps. Will generate max possible levels unless
                           `mipmap_levels` is defined.
            mipmap_levels (tuple): (base, max_level) controlling mipmap generation.
                                   When defined the `mipmap` parameter is automatically `True`
            anisotropy (float): Number of samples for anisotropic filtering
            **kwargs: Additional parameters to TextureDescription
        Returns:
            moderngl.TextureCube: Texture instance
        cube)r  r  r  r  r  r  r  r  r  r  r  r  r  r0   r  )r5   r  r  r  r  r  r  r  r  r  r  r  r  r   s                 r!   load_texture_cubezWindowConfig.load_texture_cubeq  sh    R !&& +%   
 
 	
r#   vertex_shadergeometry_shaderfragment_shadertess_control_shadertess_evaluation_shaderdefinesvaryingsc	                 j    t           j                            t          ||||||||                    S )a  Loads a shader program.

        Note that `path` should only be used if all shaders are defined
        in the same glsl file separated by defines.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Keyword Args:
            path (str): Path to a single glsl file
            vertex_shader (str): Path to vertex shader
            geometry_shader (str): Path to geometry shader
            fragment_shader (str): Path to fragment shader
            tess_control_shader (str): Path to tessellation control shader
            tess_evaluation_shader (str): Path to tessellation eval shader
            defines (dict): ``#define`` values to replace in the shader source.
                            Example: ``{'VALUE1': 10, 'VALUE2': '3.1415'}``.
            varyings (list[str]): Out attribute names for transform shaders
        Returns:
            moderngl.Program: The program instance
        )r]  r  r  r  r  r  r  r  r   programsr  r   )	r5   r]  r  r  r  r  r  r  r  s	            r!   load_programzWindowConfig.load_program  sJ    B !&&+ / /$7'=!	 	 	
 
 	
r#   c                 Z    t           j                            t          d||d|          S )aG  Loads a compute shader.

        Args:
            path (str): Path to a single glsl file
            defines (dict): ``#define`` values to replace in the shader source.
                            Example: ``{'VALUE1': 10, 'VALUE2': '3.1415'}``.
        Returns:
            moderngl.ComputeShader: The compute shader
        )compute_shaderr  r0   r  )r5   r]  r  r   s       r!   load_compute_shaderz WindowConfig.load_compute_shader  s7     !&&NdGNNvNN
 
 	
r#   c                 r    |i }d|vrd|d<   t           j                            t          dd|i|          S )a  Load a text file.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Args:
            path (str): Path to the file relative to search directories
            **kwargs: Additional parameters to DataDescription
        Returns:
            str: Contents of the text file
        Nr  textr]  r0   r   datar  r   r5   r]  r   s      r!   	load_textzWindowConfig.load_text  sK     >F#F6N~""?#G#G#G#G#GHHHr#   c                 r    |i }d|vrd|d<   t           j                            t          dd|i|          S )a  Load a json file

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Args:
            path (str): Path to the file relative to search directories
            **kwargs: Additional parameters to DataDescription
        Returns:
            dict: Contents of the json file
        Nr  jsonr]  r0   r  r  s      r!   	load_jsonzWindowConfig.load_json   sL     F#F6N~""?#G#G#G#G#GHHHr#   c                 x    |i }d|vrd|d<   t           j                            t          |d                    S )a  Load a file in binary mode.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Args:
            path (str): Path to the file relative to search directories
            **kwargs: Additional parameters to DataDescription
        Returns:
            bytes: The byte data of the file
        Nr  binary)r]  r  r  r  s      r!   load_binaryzWindowConfig.load_binary  sF     F%F6N~""?8#L#L#LMMMr#   cache
attr_namesr  c           
      ^    t           j                            t          d||||d|          S )a_  Loads a scene.

        If the path is relative the resource system is used expecting one or more
        resource directories to be registered first. Absolute paths will attempt
        to load the file directly.

        Keyword Args:
            path (str): Path to the file relative to search directories
            cache (str): Use the loader caching system if present
            attr_names (AttributeNames): Attrib name config
            kind (str): Override loader kind
            **kwargs: Additional parameters to SceneDescription
        Returns:
            Scene: The scene instance
        )r]  r  r  r  r0   )r   scenesr  r   )r5   r]  r  r  r  r   s         r!   
load_scenezWindowConfig.load_scene*  sL    . $$ %	 
  
 
 	
r#   )NNNr  )TFTFNrF  )r   TFNrF  )r  r  r  r  r  r  FFFFNrF  )NNNNNNNNr8   )Jr)   r*   r+   r,   window_sizerK   rJ   rH   rI   rF   rE   rL   clear_colorrN   rM   r  hidden_window_framerate_limitloggingINFO	log_levelr  r	   r   __annotations__r   r  r@   r   r   r   r   classmethodtyper  r   r  r   r  r  rT   r  r  r  r9   r  r>   r  r   r  r  r  r  r  r  r  r  Texturer  TextureArrayr  TextureCuber  dictProgramr  ComputeShaderr  r  r  bytesr  r   r   r  r0   r#   r!   r   r     s        ) )V K E J I G J E L
 'K F G L
 %'! I !%D(9
$$$ +/$(%)	& &h&'& j!& 	"	&
 & 
& & & &:` ` ` `$ 
/n% 
/$ 
/ 
/ 
/ [
/ 4/  D    [ (*:!;    [Le L L4 L L L Ls C D    7 7 7 7  DI $    D T     S \ d      # 3 4    S S c s t    c c 3 4      S T    	e 	u 	 	 	 	 	C D     37+
 +
+
 +
 	+

 +
 +
  c3h0+
 +
 +
 
	+
 +
 +
 +
` 37/
 /
/
 /
 	/

 /
  c3h0/
 /
 /
 
	/
 /
 /
 /
f 37:
 :
:
 :
 	:

 :
 :
 :
 :
 :
 :
 :
  c3h0:
 :
 :
 
	:
 :
 :
 :
| #'+)-)--104,0(,,
 ,
sm,
  },
 "#	,

 "#,
 &c],
 !),
 $sCx.),
 49%,
 
	,
 ,
 ,
 ,
^ >B
 

"*4S>":
MP
		
 
 
 
 Ic IS IS I I I I*Ic IS IT#s(^ I I I I*N Ns Nu N N N N0 +9"
 

 
 (	

 sm
 
 

 
 
 
 
 
r#   r   r   r   c                      dS )z0Dummy function used as the default for callbacksNr0   )r   r   s     r!   rh   rh   L  s    Dr#   )-r  ry  r   argparser   r   	functoolsr   pathlibr   typingr   r   r	   r
   r   r  r   moderngl_window.context.baser   r   #moderngl_window.geometry.attributesr   $moderngl_window.loaders.texture.iconr   moderngl_window.metar   r   r   r   moderngl_window.scener   moderngl_window.timersr   r   FuncAny	getLoggerr)   r   r$   r&   r2   r@   r   rh   r0   r#   r!   <module>r     s~    



  . . . . . . . .             1 1 1 1 1 1 1 1 1 1 1 1  % % % % % % ? ? ? ? ? ? ? ? > > > > > > ; ; ; ; ; ;            ( ' ' ' ' ' 3 3 3 3 3 3 3 3
C5#:
		8	$	$	8SE3J/ 	HcUCZ4H 	 	 	 	       
 
 
 
 
 
 
 
*M+ M+ M+ M+ M+ M+ M+ M+`s

 s

 s

 s

 s

 s

 s

 s

l	c 	S 	T 	 	 	 	 	 	r#   