a
    ij                     @   s   d Z ddlZddlZddlmZmZ ddlZejdk r<dZn$ejdkrLdZnejdkr\d	Znd
Zdd Z	e	 Z
G dd dejZdS )z"Windows-specific platform features    N)ctypesloaderbaseplatformi  Zvc7i  Zvc14i  Zvc10Zvc9c                   C   s   t  d dS )Nr   bits)platformarchitecturestrip r   r   S/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/OpenGL/platform/win32.py_size   s    r
   c                       s  e Zd ZdZdZejdd Zejdd Zejdd Z	ejd	d
 Z
eejZeejZejjZejdd Zejdd Zedededededededededd	Zdd Zejdd Zejddddddddf	 fd d!	Z  ZS )"Win32Platformz&Win32-specific platform implementationTc              
   C   sR   zt jtjdtjdW S  tyL } ztdg|jR  W Y d }~n
d }~0 0 d S )NZopengl32modezUnable to load OpenGL library)r   loadLibraryctypeswindllRTLD_GLOBALOSErrorImportErrorargs)selferrr   r   r	   GL   s    
zWin32Platform.GLc                 C   s0   zt jtjdtjdW S  ty*   Y d S 0 d S )NZglu32r   )r   r   r   r   r   r   r   r   r   r	   GLU    s    
zWin32Platform.GLUc              	   C   sP   dt tf dt tf fD ]2}ztjtj|tjdW   S  tyH   Y q0 qd S )Nzfreeglut%s.%sz	glut%s.%sr   )sizevcr   r   r   r   r   WindowsError)r   possibler   r   r	   GLUT(   s    
zWin32Platform.GLUTc              	   C   sZ   dt tf dt tf fD ]<}z ttj|}tj|_|W   S  tyN   Y q0  qVqd S )Nzgle%s.%szopengle%s.%s)	r   r   r   r   r   Zcdll	CFUNCTYPEFunctionTyper   )r   ZlibNameGLEr   r   r	   r!   4   s    
zWin32Platform.GLEc                 C   s   | j S N)OpenGLr   r   r   r	   WGLE   s    zWin32Platform.WGLc                 C   s   | j j}tj|_|S r"   )r#   wglGetProcAddressr   c_void_prestype)r   r%   r   r   r	   getExtensionProcedureH   s    z#Win32Platform.getExtensionProcedurer                           )	ZGLUT_STROKE_ROMANZGLUT_STROKE_MONO_ROMANZGLUT_BITMAP_9_BY_15ZGLUT_BITMAP_8_BY_13ZGLUT_BITMAP_TIMES_ROMAN_10ZGLUT_BITMAP_TIMES_ROMAN_24ZGLUT_BITMAP_HELVETICA_10ZGLUT_BITMAP_HELVETICA_12ZGLUT_BITMAP_HELVETICA_18c                 C   s
   | j | S )a  Platform specific function to retrieve a GLUT font pointer

        GLUTAPI void *glutBitmap9By15;
        #define GLUT_BITMAP_9_BY_15		(&glutBitmap9By15)

        Key here is that we want the addressof the pointer in the DLL,
        not the pointer in the DLL.  That is, our pointer is to the
        pointer defined in the DLL, we don't want the *value* stored in
        that pointer.
        )GLUT_FONT_CONSTANTS)r   Zconstantr   r   r	   getGLUTFontPointer[   s    z Win32Platform.getGLUTFontPointerc                 C   s   | j j}tj|_|S r"   )r   wglGetCurrentContextr   r&   r'   )r   r3   r   r   r	   GetCurrentContexth   s    zWin32Platform.GetCurrentContextr   NFc                    s   z&t t| j|||||||||	|d
W S  ty   z,t t| j|| j|||||||	|d
W  Y S  ty   t t| j|||||||||	d|d Y  Y S 0 Y n0 dS )zKOverride construct function to do win32-specific hacks to find entry points)error_checkerT)force_extensionr5   N)superr   constructFunctionAttributeErrorGDI32)r   ZfunctionNameZdllZ
resultTypeZargTypesdocZargNames	extension
deprecatedmoduler6   r5   	__class__r   r	   r8   n   s@    
	
	
zWin32Platform.constructFunction)__name__
__module____qualname____doc__ZGLUT_GUARD_CALLBACKSr   Zlazy_propertyr   r   r   r!   staticmethodr   ZWINFUNCTYPEZDEFAULT_FUNCTION_TYPEr   ZGLUT_CALLBACK_TYPEr   Zgdi32r:   r$   r(   r&   r1   r2   r4   Zc_intr8   __classcell__r   r   r?   r	   r      sL   








r   )rD   r   r   ZOpenGL.platformr   r   sys
hexversionr   r
   r   ZBasePlatformr   r   r   r   r	   <module>   s   


