commit python-glfw for openSUSE:Factory
Hello community, here is the log from the commit of package python-glfw for openSUSE:Factory checked in at 2019-05-22 11:16:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-glfw (Old) and /work/SRC/openSUSE:Factory/.python-glfw.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-glfw" Wed May 22 11:16:47 2019 rev:4 rq:704426 version:1.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-glfw/python-glfw.changes 2019-03-05 12:22:47.932887596 +0100 +++ /work/SRC/openSUSE:Factory/.python-glfw.new.5148/python-glfw.changes 2019-05-22 11:16:47.646498943 +0200 @@ -1,0 +2,7 @@ +Tue May 21 10:53:22 UTC 2019 - pgajdos@suse.com + +- version update to 1.8.0 + * Update for GLFW 3.3 + * Fixed typo set_get_window_frame_size + +------------------------------------------------------------------- Old: ---- glfw-1.7.1.tar.gz New: ---- glfw-1.8.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-glfw.spec ++++++ --- /var/tmp/diff_new_pack.AkGyT7/_old 2019-05-22 11:16:48.150498591 +0200 +++ /var/tmp/diff_new_pack.AkGyT7/_new 2019-05-22 11:16:48.150498591 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-glfw -Version: 1.7.1 +Version: 1.8.0 Release: 0 Summary: A ctypes-based wrapper for GLFW3 License: MIT @@ -59,9 +59,12 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +# no upstream tests + %files %{python_files} %license LICENSE.txt -%doc CHANGES.txt README.rst +%doc README.rst %{python_sitelib}/* %changelog ++++++ glfw-1.7.1.tar.gz -> glfw-1.8.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/CHANGES.txt new/glfw-1.8.0/CHANGES.txt --- old/glfw-1.7.1/CHANGES.txt 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/CHANGES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -v1.0, 23.03.2014 -- Initial release. -v1.2, 17.06.2016 -- Update for GLFW 3.2 -v1.3, 28.07.2016 -- Improved error and exception handling -v1.4, 22.02.2017 -- Improved library search paths -v1.5, 09.01.2018 -- Fixed a bug in set_window_icon and added support for PIL/pillow Image objects -v1.5.1, 24.01.2018 -- Improved packaging -v1.6, 30.03.2018 -- Added NORMALIZE_GAMMA_RAMPS, use namedtuples for structs and moved library loading to glfw.library -v1.7, 09.07.2018 -- Added glfw.GLFW for the naming convention used by the GLFW C API -v1.7.1, 02.02.2019 -- Fixed exception re-raising for Python 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/LICENSE.txt new/glfw-1.8.0/LICENSE.txt --- old/glfw-1.7.1/LICENSE.txt 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/LICENSE.txt 2019-05-11 10:38:32.000000000 +0200 @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2018 Florian Rhiem +Copyright (c) 2013-2019 Florian Rhiem Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/PKG-INFO new/glfw-1.8.0/PKG-INFO --- old/glfw-1.7.1/PKG-INFO 2019-02-02 07:13:02.000000000 +0100 +++ new/glfw-1.8.0/PKG-INFO 2019-05-11 10:39:04.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: glfw -Version: 1.7.1 +Version: 1.8.0 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem @@ -39,8 +39,20 @@ pip install glfw - For Windows users, the GLFW shared library is included in the Python wheels. - Linux and macOS users need to install the library themselves and should + Windows + ~~~~~~~ + + The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: + + - `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or + - `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. + + Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. + + Linux and macOS + ~~~~~~~~~~~~~~~ + + You will need to install the GLFW shared library yourself and should `compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/README.rst new/glfw-1.8.0/README.rst --- old/glfw-1.7.1/README.rst 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/README.rst 2019-05-11 10:38:32.000000000 +0200 @@ -31,8 +31,20 @@ pip install glfw -For Windows users, the GLFW shared library is included in the Python wheels. -Linux and macOS users need to install the library themselves and should +Windows +~~~~~~~ + +The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: + +- `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or +- `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. + +Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. + +Linux and macOS +~~~~~~~~~~~~~~~ + +You will need to install the GLFW shared library yourself and should `compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/glfw/GLFW.py new/glfw-1.8.0/glfw/GLFW.py --- old/glfw-1.7.1/glfw/GLFW.py 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/glfw/GLFW.py 2019-05-11 10:38:32.000000000 +0200 @@ -11,7 +11,13 @@ AUTO_ICONIFY as GLFW_AUTO_ICONIFY, AUX_BUFFERS as GLFW_AUX_BUFFERS, BLUE_BITS as GLFW_BLUE_BITS, + CENTER_CURSOR as GLFW_CENTER_CURSOR, CLIENT_API as GLFW_CLIENT_API, + COCOA_CHDIR_RESOURCES as GLFW_COCOA_CHDIR_RESOURCES, + COCOA_FRAME_NAME as GLFW_COCOA_FRAME_NAME, + COCOA_GRAPHICS_SWITCHING as GLFW_COCOA_GRAPHICS_SWITCHING, + COCOA_MENUBAR as GLFW_COCOA_MENUBAR, + COCOA_RETINA_FRAMEBUFFER as GLFW_COCOA_RETINA_FRAMEBUFFER, CONNECTED as GLFW_CONNECTED, CONTEXT_CREATION_API as GLFW_CONTEXT_CREATION_API, CONTEXT_NO_ERROR as GLFW_CONTEXT_NO_ERROR, @@ -32,11 +38,50 @@ DOUBLEBUFFER as GLFW_DOUBLEBUFFER, EGL_CONTEXT_API as GLFW_EGL_CONTEXT_API, ERROR_REPORTING as GLFW_ERROR_REPORTING, + FALSE as GLFW_FALSE, FLOATING as GLFW_FLOATING, FOCUSED as GLFW_FOCUSED, + FOCUS_ON_SHOW as GLFW_FOCUS_ON_SHOW, FORMAT_UNAVAILABLE as GLFW_FORMAT_UNAVAILABLE, + GAMEPAD_AXIS_LAST as GLFW_GAMEPAD_AXIS_LAST, + GAMEPAD_AXIS_LEFT_TRIGGER as GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, + GAMEPAD_AXIS_LEFT_X as GLFW_GAMEPAD_AXIS_LEFT_X, + GAMEPAD_AXIS_LEFT_Y as GLFW_GAMEPAD_AXIS_LEFT_Y, + GAMEPAD_AXIS_RIGHT_TRIGGER as GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, + GAMEPAD_AXIS_RIGHT_X as GLFW_GAMEPAD_AXIS_RIGHT_X, + GAMEPAD_AXIS_RIGHT_Y as GLFW_GAMEPAD_AXIS_RIGHT_Y, + GAMEPAD_BUTTON_A as GLFW_GAMEPAD_BUTTON_A, + GAMEPAD_BUTTON_B as GLFW_GAMEPAD_BUTTON_B, + GAMEPAD_BUTTON_BACK as GLFW_GAMEPAD_BUTTON_BACK, + GAMEPAD_BUTTON_CIRCLE as GLFW_GAMEPAD_BUTTON_CIRCLE, + GAMEPAD_BUTTON_CROSS as GLFW_GAMEPAD_BUTTON_CROSS, + GAMEPAD_BUTTON_DPAD_DOWN as GLFW_GAMEPAD_BUTTON_DPAD_DOWN, + GAMEPAD_BUTTON_DPAD_LEFT as GLFW_GAMEPAD_BUTTON_DPAD_LEFT, + GAMEPAD_BUTTON_DPAD_RIGHT as GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, + GAMEPAD_BUTTON_DPAD_UP as GLFW_GAMEPAD_BUTTON_DPAD_UP, + GAMEPAD_BUTTON_GUIDE as GLFW_GAMEPAD_BUTTON_GUIDE, + GAMEPAD_BUTTON_LAST as GLFW_GAMEPAD_BUTTON_LAST, + GAMEPAD_BUTTON_LEFT_BUMPER as GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, + GAMEPAD_BUTTON_LEFT_THUMB as GLFW_GAMEPAD_BUTTON_LEFT_THUMB, + GAMEPAD_BUTTON_RIGHT_BUMPER as GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, + GAMEPAD_BUTTON_RIGHT_THUMB as GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, + GAMEPAD_BUTTON_SQUARE as GLFW_GAMEPAD_BUTTON_SQUARE, + GAMEPAD_BUTTON_START as GLFW_GAMEPAD_BUTTON_START, + GAMEPAD_BUTTON_TRIANGLE as GLFW_GAMEPAD_BUTTON_TRIANGLE, + GAMEPAD_BUTTON_X as GLFW_GAMEPAD_BUTTON_X, + GAMEPAD_BUTTON_Y as GLFW_GAMEPAD_BUTTON_Y, GREEN_BITS as GLFW_GREEN_BITS, HAND_CURSOR as GLFW_HAND_CURSOR, + HAT_CENTERED as GLFW_HAT_CENTERED, + HAT_DOWN as GLFW_HAT_DOWN, + HAT_LEFT as GLFW_HAT_LEFT, + HAT_LEFT_DOWN as GLFW_HAT_LEFT_DOWN, + HAT_LEFT_UP as GLFW_HAT_LEFT_UP, + HAT_RIGHT as GLFW_HAT_RIGHT, + HAT_RIGHT_DOWN as GLFW_HAT_RIGHT_DOWN, + HAT_RIGHT_UP as GLFW_HAT_RIGHT_UP, + HAT_UP as GLFW_HAT_UP, + HOVERED as GLFW_HOVERED, HRESIZE_CURSOR as GLFW_HRESIZE_CURSOR, IBEAM_CURSOR as GLFW_IBEAM_CURSOR, ICONIFIED as GLFW_ICONIFIED, @@ -58,6 +103,7 @@ JOYSTICK_7 as GLFW_JOYSTICK_7, JOYSTICK_8 as GLFW_JOYSTICK_8, JOYSTICK_9 as GLFW_JOYSTICK_9, + JOYSTICK_HAT_BUTTONS as GLFW_JOYSTICK_HAT_BUTTONS, JOYSTICK_LAST as GLFW_JOYSTICK_LAST, KEY_0 as GLFW_KEY_0, KEY_1 as GLFW_KEY_1, @@ -181,10 +227,13 @@ KEY_X as GLFW_KEY_X, KEY_Y as GLFW_KEY_Y, KEY_Z as GLFW_KEY_Z, + LOCK_KEY_MODS as GLFW_LOCK_KEY_MODS, LOSE_CONTEXT_ON_RESET as GLFW_LOSE_CONTEXT_ON_RESET, MAXIMIZED as GLFW_MAXIMIZED, MOD_ALT as GLFW_MOD_ALT, + MOD_CAPS_LOCK as GLFW_MOD_CAPS_LOCK, MOD_CONTROL as GLFW_MOD_CONTROL, + MOD_NUM_LOCK as GLFW_MOD_NUM_LOCK, MOD_SHIFT as GLFW_MOD_SHIFT, MOD_SUPER as GLFW_MOD_SUPER, MOUSE_BUTTON_1 as GLFW_MOUSE_BUTTON_1, @@ -204,6 +253,7 @@ NOT_INITIALIZED as GLFW_NOT_INITIALIZED, NO_API as GLFW_NO_API, NO_CURRENT_CONTEXT as GLFW_NO_CURRENT_CONTEXT, + NO_ERROR as GLFW_NO_ERROR, NO_RESET_NOTIFICATION as GLFW_NO_RESET_NOTIFICATION, NO_ROBUSTNESS as GLFW_NO_ROBUSTNESS, NO_WINDOW_CONTEXT as GLFW_NO_WINDOW_CONTEXT, @@ -215,9 +265,11 @@ OPENGL_ES_API as GLFW_OPENGL_ES_API, OPENGL_FORWARD_COMPAT as GLFW_OPENGL_FORWARD_COMPAT, OPENGL_PROFILE as GLFW_OPENGL_PROFILE, + OSMESA_CONTEXT_API as GLFW_OSMESA_CONTEXT_API, OUT_OF_MEMORY as GLFW_OUT_OF_MEMORY, PLATFORM_ERROR as GLFW_PLATFORM_ERROR, PRESS as GLFW_PRESS, + RAW_MOUSE_MOTION as GLFW_RAW_MOUSE_MOTION, RED_BITS as GLFW_RED_BITS, REFRESH_RATE as GLFW_REFRESH_RATE, RELEASE as GLFW_RELEASE, @@ -226,17 +278,22 @@ REPEAT as GLFW_REPEAT, RESIZABLE as GLFW_RESIZABLE, SAMPLES as GLFW_SAMPLES, + SCALE_TO_MONITOR as GLFW_SCALE_TO_MONITOR, SRGB_CAPABLE as GLFW_SRGB_CAPABLE, STENCIL_BITS as GLFW_STENCIL_BITS, STEREO as GLFW_STEREO, STICKY_KEYS as GLFW_STICKY_KEYS, STICKY_MOUSE_BUTTONS as GLFW_STICKY_MOUSE_BUTTONS, + TRANSPARENT_FRAMEBUFFER as GLFW_TRANSPARENT_FRAMEBUFFER, + TRUE as GLFW_TRUE, VERSION_MAJOR as GLFW_VERSION_MAJOR, VERSION_MINOR as GLFW_VERSION_MINOR, VERSION_REVISION as GLFW_VERSION_REVISION, VERSION_UNAVAILABLE as GLFW_VERSION_UNAVAILABLE, VISIBLE as GLFW_VISIBLE, VRESIZE_CURSOR as GLFW_VRESIZE_CURSOR, + X11_CLASS_NAME as GLFW_X11_CLASS_NAME, + X11_INSTANCE_NAME as GLFW_X11_INSTANCE_NAME, create_cursor as glfwCreateCursor, create_standard_cursor as glfwCreateStandardCursor, create_window as glfwCreateWindow, @@ -249,18 +306,28 @@ get_clipboard_string as glfwGetClipboardString, get_current_context as glfwGetCurrentContext, get_cursor_pos as glfwGetCursorPos, + get_error as glfwGetError, get_framebuffer_size as glfwGetFramebufferSize, + get_gamepad_name as glfwGetGamepadName, + get_gamepad_state as glfwGetGamepadState, get_gamma_ramp as glfwGetGammaRamp, get_input_mode as glfwGetInputMode, get_instance_proc_address as glfwGetInstanceProcAddress, get_joystick_axes as glfwGetJoystickAxes, get_joystick_buttons as glfwGetJoystickButtons, + get_joystick_guid as glfwGetJoystickGUID, + get_joystick_hats as glfwGetJoystickHats, get_joystick_name as glfwGetJoystickName, + get_joystick_user_pointer as glfwGetJoystickUserPointer, get_key as glfwGetKey, get_key_name as glfwGetKeyName, + get_key_scancode as glfwGetKeyScancode, + get_monitor_content_scale as glfwGetMonitorContentScale, get_monitor_name as glfwGetMonitorName, get_monitor_physical_size as glfwGetMonitorPhysicalSize, get_monitor_pos as glfwGetMonitorPos, + get_monitor_user_pointer as glfwGetMonitorUserPointer, + get_monitor_workarea as glfwGetMonitorWorkarea, get_monitors as glfwGetMonitors, get_mouse_button as glfwGetMouseButton, get_physical_device_presentation_support as glfwGetPhysicalDevicePresentationSupport, @@ -275,18 +342,25 @@ get_video_mode as glfwGetVideoMode, get_video_modes as glfwGetVideoModes, get_window_attrib as glfwGetWindowAttrib, + get_window_content_scale as glfwGetWindowContentScale, + get_window_frame_size as glfwGetWindowFrameSize, get_window_monitor as glfwGetWindowMonitor, + get_window_opacity as glfwGetWindowOpacity, get_window_pos as glfwGetWindowPos, get_window_size as glfwGetWindowSize, get_window_user_pointer as glfwGetWindowUserPointer, hide_window as glfwHideWindow, iconify_window as glfwIconifyWindow, init as glfwInit, + init_hint as glfwInitHint, + joystick_is_gamepad as glfwJoystickIsGamepad, joystick_present as glfwJoystickPresent, make_context_current as glfwMakeContextCurrent, maximize_window as glfwMaximizeWindow, poll_events as glfwPollEvents, post_empty_event as glfwPostEmptyEvent, + raw_mouse_motion_supported as glfwRawMouseMotionSupported, + request_window_attention as glfwRequestWindowAttention, restore_window as glfwRestoreWindow, set_char_callback as glfwSetCharCallback, set_char_mods_callback as glfwSetCharModsCallback, @@ -300,20 +374,25 @@ set_framebuffer_size_callback as glfwSetFramebufferSizeCallback, set_gamma as glfwSetGamma, set_gamma_ramp as glfwSetGammaRamp, - set_get_window_frame_size as glfwSetGetWindowFrameSize, set_input_mode as glfwSetInputMode, set_joystick_callback as glfwSetJoystickCallback, + set_joystick_user_pointer as glfwSetJoystickUserPointer, set_key_callback as glfwSetKeyCallback, set_monitor_callback as glfwSetMonitorCallback, + set_monitor_user_pointer as glfwSetMonitorUserPointer, set_mouse_button_callback as glfwSetMouseButtonCallback, set_scroll_callback as glfwSetScrollCallback, set_time as glfwSetTime, set_window_aspect_ratio as glfwSetWindowAspectRatio, + set_window_attrib as glfwSetWindowAttrib, set_window_close_callback as glfwSetWindowCloseCallback, + set_window_content_scale_callback as glfwSetWindowContentScaleCallback, set_window_focus_callback as glfwSetWindowFocusCallback, set_window_icon as glfwSetWindowIcon, set_window_iconify_callback as glfwSetWindowIconifyCallback, + set_window_maximize_callback as glfwSetWindowMaximizeCallback, set_window_monitor as glfwSetWindowMonitor, + set_window_opacity as glfwSetWindowOpacity, set_window_pos as glfwSetWindowPos, set_window_pos_callback as glfwSetWindowPosCallback, set_window_refresh_callback as glfwSetWindowRefreshCallback, @@ -327,9 +406,11 @@ swap_buffers as glfwSwapBuffers, swap_interval as glfwSwapInterval, terminate as glfwTerminate, + update_gamepad_mappings as glfwUpdateGamepadMappings, vulkan_supported as glfwVulkanSupported, wait_events as glfwWaitEvents, wait_events_timeout as glfwWaitEventsTimeout, window_hint as glfwWindowHint, + window_hint_string as glfwWindowHintString, window_should_close as glfwWindowShouldClose, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/glfw/__init__.py new/glfw-1.8.0/glfw/__init__.py --- old/glfw-1.7.1/glfw/__init__.py 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/glfw/__init__.py 2019-05-11 10:38:32.000000000 +0200 @@ -7,9 +7,9 @@ from __future__ import unicode_literals __author__ = 'Florian Rhiem (florian.rhiem@gmail.com)' -__copyright__ = 'Copyright (c) 2013-2018 Florian Rhiem' +__copyright__ = 'Copyright (c) 2013-2019 Florian Rhiem' __license__ = 'MIT' -__version__ = '1.7.1' +__version__ = '1.8.0' # By default (ERROR_REPORTING = True), GLFW errors will be reported as Python # exceptions. Set ERROR_REPORTING to False or set a curstom error callback to @@ -245,12 +245,59 @@ return self.GLFWimage(self.width, self.height, pixels) +class _GLFWgamepadstate(ctypes.Structure): + """ + Wrapper for: + typedef struct GLFWgamepadstate GLFWgamepadstate; + """ + _fields_ = [("buttons", (ctypes.c_ubyte * 15)), + ("axes", (ctypes.c_float * 6))] + + GLFWgamepadstate = collections.namedtuple('GLFWgamepadstate', [ + 'buttons', 'axes' + ]) + + def __init__(self): + ctypes.Structure.__init__(self) + self.buttons = (ctypes.c_ubyte * 15)([0] * 15) + self.axes = (ctypes.c_float * 6)([0] * 6) + + def wrap(self, gamepad_state): + """ + Wraps a nested python sequence. + """ + buttons, axes = gamepad_state + for i in range(15): + self.buttons[i] = buttons[i] + for i in range(6): + self.axes[i] = axes[i] + + def unwrap(self): + """ + Returns a GLFWvidmode object. + """ + buttons = [int(button) for button in self.buttons] + axes = [float(axis) for axis in self.axes] + return self.GLFWgamepadstate(buttons, axes) + + VERSION_MAJOR = 3 -VERSION_MINOR = 2 -VERSION_REVISION = 1 +VERSION_MINOR = 3 +VERSION_REVISION = 0 +TRUE = 1 +FALSE = 0 RELEASE = 0 PRESS = 1 REPEAT = 2 +HAT_CENTERED = 0 +HAT_UP = 1 +HAT_DOWN = 2 +HAT_RIGHT = 4 +HAT_LEFT = 8 +HAT_RIGHT_UP = HAT_RIGHT | HAT_UP +HAT_RIGHT_DOWN = HAT_RIGHT | HAT_DOWN +HAT_LEFT_UP = HAT_LEFT | HAT_UP +HAT_LEFT_DOWN = HAT_LEFT | HAT_DOWN KEY_UNKNOWN = -1 KEY_SPACE = 32 KEY_APOSTROPHE = 39 @@ -377,6 +424,8 @@ MOD_CONTROL = 0x0002 MOD_ALT = 0x0004 MOD_SUPER = 0x0008 +MOD_CAPS_LOCK = 0x0010 +MOD_NUM_LOCK = 0x0020 MOUSE_BUTTON_1 = 0 MOUSE_BUTTON_2 = 1 MOUSE_BUTTON_3 = 2 @@ -406,6 +455,34 @@ JOYSTICK_15 = 14 JOYSTICK_16 = 15 JOYSTICK_LAST = JOYSTICK_16 +GAMEPAD_BUTTON_A = 0 +GAMEPAD_BUTTON_B = 1 +GAMEPAD_BUTTON_X = 2 +GAMEPAD_BUTTON_Y = 3 +GAMEPAD_BUTTON_LEFT_BUMPER = 4 +GAMEPAD_BUTTON_RIGHT_BUMPER = 5 +GAMEPAD_BUTTON_BACK = 6 +GAMEPAD_BUTTON_START = 7 +GAMEPAD_BUTTON_GUIDE = 8 +GAMEPAD_BUTTON_LEFT_THUMB = 9 +GAMEPAD_BUTTON_RIGHT_THUMB = 10 +GAMEPAD_BUTTON_DPAD_UP = 11 +GAMEPAD_BUTTON_DPAD_RIGHT = 12 +GAMEPAD_BUTTON_DPAD_DOWN = 13 +GAMEPAD_BUTTON_DPAD_LEFT = 14 +GAMEPAD_BUTTON_LAST = GAMEPAD_BUTTON_DPAD_LEFT +GAMEPAD_BUTTON_CROSS = GAMEPAD_BUTTON_A +GAMEPAD_BUTTON_CIRCLE = GAMEPAD_BUTTON_B +GAMEPAD_BUTTON_SQUARE = GAMEPAD_BUTTON_X +GAMEPAD_BUTTON_TRIANGLE = GAMEPAD_BUTTON_Y +GAMEPAD_AXIS_LEFT_X = 0 +GAMEPAD_AXIS_LEFT_Y = 1 +GAMEPAD_AXIS_RIGHT_X = 2 +GAMEPAD_AXIS_RIGHT_Y = 3 +GAMEPAD_AXIS_LEFT_TRIGGER = 4 +GAMEPAD_AXIS_RIGHT_TRIGGER = 5 +GAMEPAD_AXIS_LAST = GAMEPAD_AXIS_RIGHT_TRIGGER +NO_ERROR = 0 NOT_INITIALIZED = 0x00010001 NO_CURRENT_CONTEXT = 0x00010002 INVALID_ENUM = 0x00010003 @@ -424,6 +501,10 @@ AUTO_ICONIFY = 0x00020006 FLOATING = 0x00020007 MAXIMIZED = 0x00020008 +CENTER_CURSOR = 0x00020009 +TRANSPARENT_FRAMEBUFFER = 0x0002000A +HOVERED = 0x0002000B +FOCUS_ON_SHOW = 0x0002000C RED_BITS = 0x00021001 GREEN_BITS = 0x00021002 BLUE_BITS = 0x00021003 @@ -451,6 +532,12 @@ CONTEXT_RELEASE_BEHAVIOR = 0x00022009 CONTEXT_NO_ERROR = 0x0002200A CONTEXT_CREATION_API = 0x0002200B +SCALE_TO_MONITOR = 0x0002200C +COCOA_RETINA_FRAMEBUFFER = 0x00023001 +COCOA_FRAME_NAME = 0x00023002 +COCOA_GRAPHICS_SWITCHING = 0x00023003 +X11_CLASS_NAME = 0x00024001 +X11_INSTANCE_NAME = 0x00024002 NO_API = 0 OPENGL_API = 0x00030001 OPENGL_ES_API = 0x00030002 @@ -463,6 +550,8 @@ CURSOR = 0x00033001 STICKY_KEYS = 0x00033002 STICKY_MOUSE_BUTTONS = 0x00033003 +LOCK_KEY_MODS = 0x00033004 +RAW_MOUSE_MOTION = 0x00033005 CURSOR_NORMAL = 0x00034001 CURSOR_HIDDEN = 0x00034002 CURSOR_DISABLED = 0x00034003 @@ -471,6 +560,7 @@ RELEASE_BEHAVIOR_NONE = 0x00035002 NATIVE_CONTEXT_API = 0x00036001 EGL_CONTEXT_API = 0x00036002 +OSMESA_CONTEXT_API = 0x00036003 ARROW_CURSOR = 0x00036001 IBEAM_CURSOR = 0x00036002 CROSSHAIR_CURSOR = 0x00036003 @@ -479,6 +569,9 @@ VRESIZE_CURSOR = 0x00036006 CONNECTED = 0x00040001 DISCONNECTED = 0x00040002 +JOYSTICK_HAT_BUTTONS = 0x00050001 +COCOA_CHDIR_RESOURCES = 0x00051001 +COCOA_MENUBAR = 0x00051002 DONT_CARE = -1 _exc_info_from_callback = None @@ -549,10 +642,17 @@ _GLFWwindowiconifyfun = ctypes.CFUNCTYPE(None, ctypes.POINTER(_GLFWwindow), ctypes.c_int) +_GLFWwindowmaximizefun = ctypes.CFUNCTYPE(None, + ctypes.POINTER(_GLFWwindow), + ctypes.c_int) _GLFWframebuffersizefun = ctypes.CFUNCTYPE(None, ctypes.POINTER(_GLFWwindow), ctypes.c_int, ctypes.c_int) +_GLFWwindowcontentscalefun = ctypes.CFUNCTYPE(None, + ctypes.POINTER(_GLFWwindow), + ctypes.c_float, + ctypes.c_float) _GLFWmousebuttonfun = ctypes.CFUNCTYPE(None, ctypes.POINTER(_GLFWwindow), ctypes.c_int, @@ -625,6 +725,21 @@ del _window_user_data_repository[window_addr] _glfw.glfwTerminate() + +if hasattr(_glfw, 'glfwInitHint'): + _glfw.glfwInitHint.restype = None + _glfw.glfwInitHint.argtypes = [ctypes.c_int, + ctypes.c_int] + def init_hint(hint, value): + """ + Sets the specified init hint to the desired value. + + Wrapper for: + void glfwInitHint(int hint, int value); + """ + _glfw.glfwInitHint(hint, value) + + _glfw.glfwGetVersion.restype = None _glfw.glfwGetVersion.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), @@ -656,6 +771,22 @@ """ return _glfw.glfwGetVersionString() + +if hasattr(_glfw, 'glfwGetError'): + _glfw.glfwGetError.restype = ctypes.c_int + _glfw.glfwGetError.argtypes = [ctypes.POINTER(ctypes.c_char_p)] + def get_error(): + """ + Returns and clears the last error for the calling thread. + + Wrapper for: + int glfwGetError(const char** description); + """ + error_description = (ctypes.c_char_p * 1)() + error_code = _glfw.glfwGetError(error_description) + return error_code, error_description[0] + + @_callback_exception_decorator def _raise_glfw_errors_as_exceptions(error_code, description): """ @@ -737,6 +868,37 @@ _glfw.glfwGetMonitorPos(monitor, xpos, ypos) return xpos_value.value, ypos_value.value + +if hasattr(_glfw, 'glfwGetMonitorWorkarea'): + _glfw.glfwGetMonitorWorkarea.restype = None + _glfw.glfwGetMonitorWorkarea.argtypes = [ctypes.POINTER(_GLFWmonitor), + ctypes.POINTER(ctypes.c_int), + ctypes.POINTER(ctypes.c_int)] + + + def get_monitor_workarea(monitor): + """ + Retrives the work area of the monitor. + + Wrapper for: + void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); + """ + xpos_value = ctypes.c_int(0) + xpos = ctypes.pointer(xpos_value) + ypos_value = ctypes.c_int(0) + ypos = ctypes.pointer(ypos_value) + width_value = ctypes.c_int(0) + width = ctypes.pointer(width_value) + height_value = ctypes.c_int(0) + height = ctypes.pointer(height_value) + _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height) + return ( + xpos_value.value, + ypos_value.value, + width_value.value, + height_value.value + ) + _glfw.glfwGetMonitorPhysicalSize.restype = None _glfw.glfwGetMonitorPhysicalSize.argtypes = [ctypes.POINTER(_GLFWmonitor), ctypes.POINTER(ctypes.c_int), @@ -755,6 +917,27 @@ _glfw.glfwGetMonitorPhysicalSize(monitor, width, height) return width_value.value, height_value.value + +if hasattr(_glfw, 'glfwGetMonitorContentScale'): + _glfw.glfwGetMonitorContentScale.restype = None + _glfw.glfwGetMonitorContentScale.argtypes = [ctypes.POINTER(_GLFWmonitor), + ctypes.POINTER(ctypes.c_float), + ctypes.POINTER(ctypes.c_float)] + def get_monitor_content_scale(monitor): + """ + Retrieves the content scale for the specified monitor. + + Wrapper for: + void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); + """ + xscale_value = ctypes.c_int(0) + xscale = ctypes.pointer(xscale_value) + yscale_value = ctypes.c_int(0) + yscale = ctypes.pointer(yscale_value) + _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale) + return xscale_value.value, yscale_value.value + + _glfw.glfwGetMonitorName.restype = ctypes.c_char_p _glfw.glfwGetMonitorName.argtypes = [ctypes.POINTER(_GLFWmonitor)] def get_monitor_name(monitor): @@ -766,6 +949,56 @@ """ return _glfw.glfwGetMonitorName(monitor) + +if hasattr(_glfw, 'glfwSetMonitorUserPointer') and hasattr(_glfw, 'glfwGetMonitorUserPointer'): + _monitor_user_data_repository = {} + _glfw.glfwSetMonitorUserPointer.restype = None + _glfw.glfwSetMonitorUserPointer.argtypes = [ctypes.POINTER(_GLFWmonitor), + ctypes.c_void_p] + + + def set_monitor_user_pointer(monitor, pointer): + """ + Sets the user pointer of the specified monitor. You may pass a normal + python object into this function and it will be wrapped automatically. + The object will be kept in existence until the pointer is set to + something else. + + Wrapper for: + void glfwSetMonitorUserPointer(int jid, void* pointer); + """ + + data = (False, pointer) + if not isinstance(pointer, ctypes.c_void_p): + data = (True, pointer) + # Create a void pointer for the python object + pointer = ctypes.cast(ctypes.pointer(ctypes.py_object(pointer)), + ctypes.c_void_p) + + _monitor_user_data_repository[monitor] = data + _glfw.glfwSetWindowUserPointer(monitor, pointer) + + + _glfw.glfwGetMonitorUserPointer.restype = ctypes.c_void_p + _glfw.glfwGetMonitorUserPointer.argtypes = [ctypes.POINTER(_GLFWmonitor)] + + + def get_monitor_user_pointer(monitor): + """ + Returns the user pointer of the specified monitor. + + Wrapper for: + void* glfwGetMonitorUserPointer(int jid); + """ + + if monitor in _monitor_user_data_repository: + data = _monitor_user_data_repository[monitor] + is_wrapped_py_object = data[0] + if is_wrapped_py_object: + return data[1] + return _glfw.glfwGetMonitorUserPointer(monitor) + + _monitor_callback = None _glfw.glfwSetMonitorCallback.restype = _GLFWmonitorfun _glfw.glfwSetMonitorCallback.argtypes = [_GLFWmonitorfun] @@ -876,6 +1109,21 @@ """ _glfw.glfwWindowHint(hint, value) + +if hasattr(_glfw, 'glfwWindowHintString'): + _glfw.glfwWindowHintString.restype = None + _glfw.glfwWindowHintString.argtypes = [ctypes.c_int, + ctypes.c_char_p] + def window_hint_string(hint, value): + """ + Sets the specified window hint to the desired value. + + Wrapper for: + void glfwWindowHintString(int hint, const char* value); + """ + _glfw.glfwWindowHintString(hint, _to_char_p(value)) + + _glfw.glfwCreateWindow.restype = ctypes.POINTER(_GLFWwindow) _glfw.glfwCreateWindow.argtypes = [ctypes.c_int, ctypes.c_int, @@ -1025,6 +1273,54 @@ _glfw.glfwGetFramebufferSize(window, width, height) return width_value.value, height_value.value + +if hasattr(_glfw, 'glfwGetWindowContentScale'): + _glfw.glfwGetWindowContentScale.restype = None + _glfw.glfwGetWindowContentScale.argtypes = [ctypes.POINTER(_GLFWwindow), + ctypes.POINTER(ctypes.c_float), + ctypes.POINTER(ctypes.c_float)] + def get_window_content_scale(window): + """ + Retrieves the content scale for the specified window. + + Wrapper for: + void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); + """ + xscale_value = ctypes.c_int(0) + xscale = ctypes.pointer(xscale_value) + yscale_value = ctypes.c_int(0) + yscale = ctypes.pointer(yscale_value) + _glfw.glfwGetWindowContentScale(window, xscale, yscale) + return xscale_value.value, yscale_value.value + + +if hasattr(_glfw, 'glfwGetWindowOpacity'): + _glfw.glfwGetWindowOpacity.restype = ctypes.c_float + _glfw.glfwGetWindowOpacity.argtypes = [ctypes.POINTER(_GLFWwindow)] + def get_window_opacity(window): + """ + Returns the opacity of the whole window. + + Wrapper for: + float glfwGetWindowOpacity(GLFWwindow* window); + """ + return _glfw.glfwGetWindowOpacity(window) + + +if hasattr(_glfw, 'glfwSetWindowOpacity'): + _glfw.glfwSetWindowOpacity.restype = None + _glfw.glfwSetWindowOpacity.argtypes = [ctypes.POINTER(_GLFWwindow), + ctypes.c_float] + def set_window_opacity(window, opacity): + """ + Sets the opacity of the whole window. + + Wrapper for: + void glfwSetWindowOpacity(GLFWwindow* window, float opacity); + """ + _glfw.glfwSetWindowOpacity(window) + + _glfw.glfwIconifyWindow.restype = None _glfw.glfwIconifyWindow.argtypes = [ctypes.POINTER(_GLFWwindow)] def iconify_window(window): @@ -1069,6 +1365,20 @@ """ _glfw.glfwHideWindow(window) + +if hasattr(_glfw, 'glfwRequestWindowAttention'): + _glfw.glfwRequestWindowAttention.restype = None + _glfw.glfwRequestWindowAttention.argtypes = [ctypes.POINTER(_GLFWwindow)] + def request_window_attention(window): + """ + Requests user attention to the specified window. + + Wrapper for: + void glfwRequestWindowAttention(GLFWwindow* window); + """ + _glfw.glfwRequestWindowAttention(window) + + _glfw.glfwGetWindowMonitor.restype = ctypes.POINTER(_GLFWmonitor) _glfw.glfwGetWindowMonitor.argtypes = [ctypes.POINTER(_GLFWwindow)] def get_window_monitor(window): @@ -1092,6 +1402,22 @@ """ return _glfw.glfwGetWindowAttrib(window, attrib) + +if hasattr(_glfw, 'glfwSetWindowAttrib'): + _glfw.glfwSetWindowAttrib.restype = None + _glfw.glfwSetWindowAttrib.argtypes = [ctypes.POINTER(_GLFWwindow), + ctypes.c_int, + ctypes.c_int] + def set_window_attrib(window, attrib, value): + """ + Returns an attribute of the specified window. + + Wrapper for: + void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); + """ + _glfw.glfwSetWindowAttrib(window, attrib, value) + + _window_user_data_repository = {} _glfw.glfwSetWindowUserPointer.restype = None _glfw.glfwSetWindowUserPointer.argtypes = [ctypes.POINTER(_GLFWwindow), @@ -1299,6 +1625,39 @@ if previous_callback is not None and previous_callback[0] != 0: return previous_callback[0] + +if hasattr(_glfw, 'glfwSetWindowMaximizeCallback'): + _window_maximize_callback_repository = {} + _callback_repositories.append(_window_maximize_callback_repository) + _glfw.glfwSetWindowMaximizeCallback.restype = _GLFWwindowmaximizefun + _glfw.glfwSetWindowMaximizeCallback.argtypes = [ + ctypes.POINTER(_GLFWwindow), + _GLFWwindowmaximizefun + ] + def set_window_maximize_callback(window, cbfun): + """ + Sets the maximize callback for the specified window. + + Wrapper for: + GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun); + """ + window_addr = ctypes.cast(ctypes.pointer(window), + ctypes.POINTER(ctypes.c_long)).contents.value + if window_addr in _window_maximize_callback_repository: + previous_callback = _window_maximize_callback_repository[ + window_addr] + else: + previous_callback = None + if cbfun is None: + cbfun = 0 + c_cbfun = _GLFWwindowmaximizefun(cbfun) + _window_maximize_callback_repository[window_addr] = (cbfun, c_cbfun) + cbfun = c_cbfun + _glfw.glfwSetWindowMaximizeCallback(window, cbfun) + if previous_callback is not None and previous_callback[0] != 0: + return previous_callback[0] + + _framebuffer_size_callback_repository = {} _callback_repositories.append(_framebuffer_size_callback_repository) _glfw.glfwSetFramebufferSizeCallback.restype = _GLFWframebuffersizefun @@ -1326,6 +1685,40 @@ if previous_callback is not None and previous_callback[0] != 0: return previous_callback[0] + +if hasattr(_glfw, 'glfwSetWindowContentScaleCallback'): + _window_content_scale_callback_repository = {} + _callback_repositories.append(_window_content_scale_callback_repository) + _glfw.glfwSetWindowContentScaleCallback.restype = _GLFWwindowcontentscalefun + _glfw.glfwSetWindowContentScaleCallback.argtypes = [ + ctypes.POINTER(_GLFWwindow), + _GLFWwindowcontentscalefun] + + + def set_window_content_scale_callback(window, cbfun): + """ + Sets the window content scale callback for the specified window. + + Wrapper for: + GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun cbfun); + """ + window_addr = ctypes.cast(ctypes.pointer(window), + ctypes.POINTER(ctypes.c_long)).contents.value + if window_addr in _window_content_scale_callback_repository: + previous_callback = _window_content_scale_callback_repository[ + window_addr] + else: + previous_callback = None + if cbfun is None: + cbfun = 0 + c_cbfun = _GLFWwindowcontentscalefun(cbfun) + _window_content_scale_callback_repository[window_addr] = (cbfun, c_cbfun) + cbfun = c_cbfun + _glfw.glfwSetWindowContentScaleCallback(window, cbfun) + if previous_callback is not None and previous_callback[0] != 0: + return previous_callback[0] + + _glfw.glfwPollEvents.restype = None _glfw.glfwPollEvents.argtypes = [] def poll_events(): @@ -1377,6 +1770,20 @@ """ _glfw.glfwSetInputMode(window, mode, value) + +if hasattr(_glfw, 'glfwRawMouseMotionSupported'): + _glfw.glfwRawMouseMotionSupported.restype = ctypes.c_int + _glfw.glfwRawMouseMotionSupported.argtypes = [] + def raw_mouse_motion_supported(): + """ + Returns whether raw mouse motion is supported. + + Wrapper for: + int glfwRawMouseMotionSupported(void); + """ + return _glfw.glfwRawMouseMotionSupported() != 0 + + _glfw.glfwGetKey.restype = ctypes.c_int _glfw.glfwGetKey.argtypes = [ctypes.POINTER(_GLFWwindow), ctypes.c_int] @@ -1638,6 +2045,24 @@ result = _glfw.glfwGetJoystickButtons(joy, count) return result, count_value.value + +if hasattr(_glfw, 'glfwGetJoystickHats'): + _glfw.glfwGetJoystickHats.restype = ctypes.POINTER(ctypes.c_ubyte) + _glfw.glfwGetJoystickHats.argtypes = [ctypes.c_int, + ctypes.POINTER(ctypes.c_int)] + def get_joystick_hats(joystick_id): + """ + Returns the state of all hats of the specified joystick. + + Wrapper for: + const unsigned char* glfwGetJoystickButtons(int joy, int* count); + """ + count_value = ctypes.c_int(0) + count = ctypes.pointer(count_value) + result = _glfw.glfwGetJoystickHats(joystick_id, count) + return result, count_value.value + + _glfw.glfwGetJoystickName.restype = ctypes.c_char_p _glfw.glfwGetJoystickName.argtypes = [ctypes.c_int] def get_joystick_name(joy): @@ -1649,6 +2074,98 @@ """ return _glfw.glfwGetJoystickName(joy) + +if hasattr(_glfw, 'glfwGetJoystickGUID'): + _glfw.glfwGetJoystickGUID.restype = ctypes.c_char_p + _glfw.glfwGetJoystickGUID.argtypes = [ctypes.c_int] + def get_joystick_guid(joystick_id): + """ + Returns the SDL compatible GUID of the specified joystick. + + Wrapper for: + const char* glfwGetJoystickGUID(int jid); + """ + return _glfw.glfwGetJoystickGUID(joystick_id) + +if hasattr(_glfw, 'glfwSetJoystickUserPointer') and hasattr(_glfw, 'glfwGetJoystickUserPointer'): + _joystick_user_data_repository = {} + _glfw.glfwSetJoystickUserPointer.restype = None + _glfw.glfwSetJoystickUserPointer.argtypes = [ctypes.c_int, + ctypes.c_void_p] + + + def set_joystick_user_pointer(joystick_id, pointer): + """ + Sets the user pointer of the specified joystick. You may pass a normal + python object into this function and it will be wrapped automatically. + The object will be kept in existence until the pointer is set to + something else. + + Wrapper for: + void glfwSetJoystickUserPointer(int jid, void* pointer); + """ + + data = (False, pointer) + if not isinstance(pointer, ctypes.c_void_p): + data = (True, pointer) + # Create a void pointer for the python object + pointer = ctypes.cast(ctypes.pointer(ctypes.py_object(pointer)), + ctypes.c_void_p) + + _joystick_user_data_repository[joystick_id] = data + _glfw.glfwSetWindowUserPointer(joystick_id, pointer) + + + _glfw.glfwGetJoystickUserPointer.restype = ctypes.c_void_p + _glfw.glfwGetJoystickUserPointer.argtypes = [ctypes.c_int] + + + def get_joystick_user_pointer(joystick_id): + """ + Returns the user pointer of the specified joystick. + + Wrapper for: + void* glfwGetJoystickUserPointer(int jid); + """ + + if joystick_id in _joystick_user_data_repository: + data = _joystick_user_data_repository[joystick_id] + is_wrapped_py_object = data[0] + if is_wrapped_py_object: + return data[1] + return _glfw.glfwGetJoystickUserPointer(joystick_id) + + +if hasattr(_glfw, 'glfwJoystickIsGamepad'): + _glfw.glfwJoystickIsGamepad.restype = ctypes.c_int + _glfw.glfwJoystickIsGamepad.argtypes = [ctypes.c_int] + def joystick_is_gamepad(joystick_id): + """ + Returns whether the specified joystick has a gamepad mapping. + + Wrapper for: + int glfwJoystickIsGamepad(int jid); + """ + return _glfw.glfwJoystickIsGamepad(joystick_id) != 0 + + +if hasattr(_glfw, 'glfwGetGamepadState'): + _glfw.glfwGetGamepadState.restype = ctypes.c_int + _glfw.glfwGetGamepadState.argtypes = [ctypes.c_int, + ctypes.POINTER(_GLFWgamepadstate)] + def get_gamepad_state(joystick_id): + """ + Retrieves the state of the specified joystick remapped as a gamepad. + + Wrapper for: + int glfwGetGamepadState(int jid, GLFWgamepadstate* state); + """ + gamepad_state = _GLFWgamepadstate() + if _glfw.glfwGetGamepadState(joystick_id, ctypes.byref(gamepad_state)) == FALSE: + return None + return gamepad_state.unwrap() + + _glfw.glfwSetClipboardString.restype = None _glfw.glfwSetClipboardString.argtypes = [ctypes.POINTER(_GLFWwindow), ctypes.c_char_p] @@ -1899,6 +2416,36 @@ if previous_callback is not None and previous_callback[0] != 0: return previous_callback[0] + +if hasattr(_glfw, 'glfwUpdateGamepadMappings'): + _glfw.glfwUpdateGamepadMappings.restype = ctypes.c_int + _glfw.glfwUpdateGamepadMappings.argtypes = [ctypes.c_char_p] + def update_gamepad_mappings(string): + """ + Adds the specified SDL_GameControllerDB gamepad mappings. + + Wrapper for: + int glfwUpdateGamepadMappings(const char* string); + """ + return _glfw.glfwUpdateGamepadMappings(_to_char_p(string)) + + +if hasattr(_glfw, 'glfwGetGamepadName'): + _glfw.glfwGetGamepadName.restype = ctypes.c_char_p + _glfw.glfwGetGamepadName.argtypes = [ctypes.c_int] + def get_gamepad_name(joystick_id): + """ + Returns the human-readable gamepad name for the specified joystick. + + Wrapper for: + const char* glfwGetGamepadName(int jid); + """ + gamepad_name = _glfw.glfwGetGamepadName(joystick_id) + if gamepad_name: + return gamepad_name.decode('utf-8') + return None + + if hasattr(_glfw, 'glfwGetKeyName'): _glfw.glfwGetKeyName.restype = ctypes.c_char_p _glfw.glfwGetKeyName.argtypes = [ctypes.c_int, ctypes.c_int] @@ -1914,6 +2461,20 @@ return key_name.decode('utf-8') return None + +if hasattr(_glfw, 'glfwGetKeyScancode'): + _glfw.glfwGetKeyScancode.restype = ctypes.c_int + _glfw.glfwGetKeyScancode.argtypes = [ctypes.c_int] + def get_key_scancode(key): + """ + Returns the platform-specific scancode of the specified key. + + Wrapper for: + int glfwGetKeyScancode(int key); + """ + return _glfw.glfwGetKeyScancode(key) + + if hasattr(_glfw, 'glfwCreateCursor'): _glfw.glfwCreateCursor.restype = ctypes.POINTER(_GLFWcursor) _glfw.glfwCreateCursor.argtypes = [ctypes.POINTER(_GLFWimage), @@ -2072,7 +2633,7 @@ ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)] - def set_get_window_frame_size(window): + def get_window_frame_size(window): """ Retrieves the size of the frame of the window. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/glfw.egg-info/PKG-INFO new/glfw-1.8.0/glfw.egg-info/PKG-INFO --- old/glfw-1.7.1/glfw.egg-info/PKG-INFO 2019-02-02 07:13:02.000000000 +0100 +++ new/glfw-1.8.0/glfw.egg-info/PKG-INFO 2019-05-11 10:39:04.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: glfw -Version: 1.7.1 +Version: 1.8.0 Summary: A ctypes-based wrapper for GLFW3. Home-page: https://github.com/FlorianRhiem/pyGLFW Author: Florian Rhiem @@ -39,8 +39,20 @@ pip install glfw - For Windows users, the GLFW shared library is included in the Python wheels. - Linux and macOS users need to install the library themselves and should + Windows + ~~~~~~~ + + The GLFW shared library is included in the Python wheels for Windows, but the correct Microsoft Visual C++ Redistributable will be required: + + - `VC 2010 <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`_ for 32-bit Python, or + - `VC 2012 <https://www.microsoft.com/en-us/download/details.aspx?id=30679>`_ for 64-bit Python. + + Alternatively, you can download a shared library built for a runtime already installed on your system from `glfw.org <http://www.glfw.org/download.html>`_. + + Linux and macOS + ~~~~~~~~~~~~~~~ + + You will need to install the GLFW shared library yourself and should `compile GLFW from source <http://www.glfw.org/docs/latest/compile.html>`__ (use ``-DBUILD_SHARED_LIBS=ON``). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/glfw.egg-info/SOURCES.txt new/glfw-1.8.0/glfw.egg-info/SOURCES.txt --- old/glfw-1.7.1/glfw.egg-info/SOURCES.txt 2019-02-02 07:13:02.000000000 +0100 +++ new/glfw-1.8.0/glfw.egg-info/SOURCES.txt 2019-05-11 10:39:04.000000000 +0200 @@ -1,4 +1,3 @@ -CHANGES.txt LICENSE.txt MANIFEST.in README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/glfw-1.7.1/setup.py new/glfw-1.8.0/setup.py --- old/glfw-1.7.1/setup.py 2019-02-02 07:12:23.000000000 +0100 +++ new/glfw-1.8.0/setup.py 2019-05-11 10:38:32.000000000 +0200 @@ -8,7 +8,7 @@ setup( name='glfw', - version='1.7.1', + version='1.8.0', description='A ctypes-based wrapper for GLFW3.', long_description=long_description, url='https://github.com/FlorianRhiem/pyGLFW',
participants (1)
-
root