
    ^jS                       d dl mZ d dlZd dlmZmZmZmZmZ d dlm	Z	m
Z
mZ d dlZd dlmZmZ d dlmZ ddgZej        d	         Zej        j        ZeZerd d
lmZ  ee          Z ee          Z	 ej        Z e ee                    e_        ege_        dZn# e$ r dZY nw xY wg dZ ddZ! G d d          Z"	 	 d d!dZ#e#Z$dS )"    )annotationsN)	CFUNCTYPEPOINTERc_char_pc_intcast)AnyCallableSequence)decorate_functionmissing_function)asbyteslink_GLlink_WGLdebug_trace)_TraceLibraryTF)namerequiressuggestionsftypefuncr   r
   returnc                &      G  fdd          }|S )Nc                      e Zd ZeZ ZdS )$makeWGLFunction.<locals>.WGLFunctionN)__name__
__module____qualname__class_slots	__slots____call__)r   s   L/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/gl/lib_wgl.pyWGLFunctionr   $   s        	    r#    )r   r#   s   ` r"   makeWGLFunctionr&   #   s=              r$   c                  "    e Zd ZeZddZddZdS )WGLFunctionProxyr   strr   ctypes.WINFUNCTYPEr   
str | Noner   list[str] | Noner   Nonec                ^    t           sJ || _        || _        || _        || _        d | _        d S )N)_have_get_proc_addressr   r   r   r   r   )selfr   r   r   r   s        r"   __init__zWGLFunctionProxy.__init__.   s6    %%%%	
 &			r$   argsr	   kwargsr
   c                   ddl m} |sd| j         d}t          |          t	          t          | j                            }t          |t          t                              r5t          || j	                  | _
        t          | j
        | j                   n%t          | j        | j        | j                  | _
        t          | j
                  | _         | j
        |i |S )Nr   )current_contextzCall to function "z" before GL context created)	pyglet.glr5   r   	ExceptionwglGetProcAddressr   r   r   r   r   r   r   r   r   r   r&   	__class__)r0   r2   r3   r5   msgaddresss         r"   r!   zWGLFunctionProxy.__call__7   s    ------ 	!MtyMMMCC.. #GDI$6$677(( 	<Wdj11DIdi3333(	4=$*:< <DI )33ty$)&)))r$   N)
r   r)   r   r*   r   r+   r   r,   r   r-   )r2   r	   r3   r	   r   r
   )r   r   r   r   r    r1   r!   r%   r$   r"   r(   r(   +   sA        I   * * * * * *r$   r(   r   r)   restyper	   argtypesr   r+   r   Sequence[str] | NoneCallable[..., Any]c                   	 t          t          |           }||_        ||_        t	          ||            |S # t
          $ r 	 |ft          |          z   }t          j        | }t          rdddl
m} |                                r6t          |           }	|	r$t          |	|          }t	          ||            |cY S nt          | |||          cY S n#  Y nxY wt!          | ||          cY S w xY w)Nr   )gl_info)getattrgl_libr<   r=   r   AttributeErrortuplectypesWINFUNCTYPEr/   r6   rA   have_contextr8   r   r(   r   )
r   r<   r=   r   r   r   fargsr   rA   r;   s
             r"   r   r   I   s-   =vt$$ $%%% = = =	Jx0E&.E% 
P------'')) P/55G $#GU33)$555#$ ,D%;OOOOO	Dh<<<<<)=s:   47 
C*A4C6C*9CC*C*CC*)C*)r   r
   r   r
   )NN)r   r)   r<   r	   r=   r	   r   r+   r   r>   r   r?   )%
__future__r   rF   r   r   r   r   r   typingr	   r
   r   pygletpyglet.gl.libr   r   pyglet.utilr   __all__options_debug_tracewindllopengl32rC   wgl_lib
pyglet.libr   r8   r<   r=   r/   rD   r   r&   r(   r   r   r%   r$   r"   <module>rV      s   " " " " " "  < < < < < < < < < < < < < < * * * * * * * * * *  = = = = = = = =      j
!~m,		
 %((((((]6""FmG$$G#1 )	''%.. 9 9"*! # # #"# CBB   * * * * * * * *< LP04= = = = => s   3*B B('B(