code
stringlengths
17
6.64M
def _padboth(width, s, has_invisible=True): "Center string.\n\n >>> _padboth(6, 'яйца') == ' яйца '\n True\n\n " iwidth = (((width + len(s)) - len(_strip_invisible(s))) if has_invisible else width) fmt = ('{0:^%ds}' % iwidth) return fmt.format(s)
def _strip_invisible(s): 'Remove invisible ANSI color codes.' if isinstance(s, _text_type): return re.sub(_invisible_codes, '', s) else: return re.sub(_invisible_codes_bytes, '', s)
def _visible_width(s): 'Visible width of a printed string. ANSI color codes are removed.\n\n >>> _visible_width(\'\x1b[31mhello\x1b[0m\'), _visible_width("world")\n (5, 5)\n\n ' if (isinstance(s, _text_type) or isinstance(s, _binary_type)): return len(_strip_invisible(s)) else: re...
def _align_column(strings, alignment, minwidth=0, has_invisible=True): '[string] -> [padded_string]\n\n >>> list(map(str,_align_column(["12.345", "-1234.5", "1.23", "1234.5", "1e+234", "1.0e234"], "decimal")))\n [\' 12.345 \', \'-1234.5 \', \' 1.23 \', \' 1234.5 \', \' 1e+234 \', \' 1.0e...
def _more_generic(type1, type2): types = {_none_type: 0, int: 1, float: 2, _binary_type: 3, _text_type: 4} invtypes = {4: _text_type, 3: _binary_type, 2: float, 1: int, 0: _none_type} moregeneric = max(types.get(type1, 4), types.get(type2, 4)) return invtypes[moregeneric]
def _column_type(strings, has_invisible=True): 'The least generic type all column values are convertible to.\n\n >>> _column_type(["1", "2"]) is _int_type\n True\n >>> _column_type(["1", "2.3"]) is _float_type\n True\n >>> _column_type(["1", "2.3", "four"]) is _text_type\n True\n >>> _column_...
def _format(val, valtype, floatfmt, missingval=''): "Format a value accoding to its type.\n\n Unicode is supported:\n\n >>> hrow = ['буква', 'цифра'] ; tbl = [['аз', 2], ['буки', 4]] ; good_result = '\\u0431\\u0443\\u043a\\u0432\\u0430 \\u0446\\u0438\\u0444\\u0440\\u0430\\n------- ----...
def _align_header(header, alignment, width): if (alignment == 'left'): return _padright(width, header) elif (alignment == 'center'): return _padboth(width, header) elif (not alignment): return '{0}'.format(header) else: return _padleft(width, header)
def _normalize_tabular_data(tabular_data, headers): 'Transform a supported data type to a list of lists, and a list of headers.\n\n Supported tabular data types:\n\n * list-of-lists or another iterable of iterables\n\n * list of named tuples (usually used with headers="keys")\n\n * 2D NumPy arrays\n\n...
def tabulate(tabular_data, headers=[], tablefmt='simple', floatfmt='g', numalign='decimal', stralign='left', missingval=''): 'Format a fixed width table for pretty printing.\n\n >>> print(tabulate([[1, 2.34], [-56, "8.999"], ["2", "10001"]]))\n --- ---------\n 1 2.34\n -56 8.999\n 2 ...
def _build_simple_row(padded_cells, rowfmt): 'Format row according to DataRow format without padding.' (begin, sep, end) = rowfmt return ((begin + sep.join(padded_cells)) + end).rstrip()
def _build_row(padded_cells, colwidths, colaligns, rowfmt): 'Return a string which represents a row of data cells.' if (not rowfmt): return None if hasattr(rowfmt, '__call__'): return rowfmt(padded_cells, colwidths, colaligns) else: return _build_simple_row(padded_cells, rowfmt...
def _build_line(colwidths, colaligns, linefmt): 'Return a string which represents a horizontal line.' if (not linefmt): return None if hasattr(linefmt, '__call__'): return linefmt(colwidths, colaligns) else: (begin, fill, sep, end) = linefmt cells = [(fill * w) for w in...
def _pad_row(cells, padding): if cells: pad = (' ' * padding) padded_cells = [((pad + cell) + pad) for cell in cells] return padded_cells else: return cells
def _format_table(fmt, headers, rows, colwidths, colaligns): 'Produce a plain-text representation of the table.' lines = [] hidden = (fmt.with_header_hide if (headers and fmt.with_header_hide) else []) pad = fmt.padding headerrow = fmt.headerrow padded_widths = [(w + (2 * pad)) for w in colwid...
def flatten_tensors(tensors): if (len(tensors) > 0): return np.concatenate([np.reshape(x, [(- 1)]) for x in tensors]) else: return np.asarray([])
def unflatten_tensors(flattened, tensor_shapes): tensor_sizes = list(map(np.prod, tensor_shapes)) indices = np.cumsum(tensor_sizes)[:(- 1)] return [np.reshape(pair[0], pair[1]) for pair in zip(np.split(flattened, indices), tensor_shapes)]
def pad_tensor(x, max_len, mode='zero'): padding = np.zeros_like(x[0]) if (mode == 'last'): padding = x[(- 1)] return np.concatenate([x, np.tile(padding, (((max_len - len(x)),) + ((1,) * np.ndim(x[0]))))])
def pad_tensor_n(xs, max_len): ret = np.zeros(((len(xs), max_len) + xs[0].shape[1:]), dtype=xs[0].dtype) for (idx, x) in enumerate(xs): ret[idx][:len(x)] = x return ret
def pad_tensor_dict(tensor_dict, max_len, mode='zero'): keys = list(tensor_dict.keys()) ret = dict() for k in keys: if isinstance(tensor_dict[k], dict): ret[k] = pad_tensor_dict(tensor_dict[k], max_len, mode=mode) else: ret[k] = pad_tensor(tensor_dict[k], max_len, m...
def high_res_normalize(probs): return [(x / sum(map(float, probs))) for x in list(map(float, probs))]
def stack_tensor_list(tensor_list): return np.array(tensor_list)
def stack_tensor_dict_list(tensor_dict_list): '\n Stack a list of dictionaries of {tensors or dictionary of tensors}.\n :param tensor_dict_list: a list of dictionaries of {tensors or dictionary of tensors}.\n :return: a dictionary of {stacked tensors or dictionary of stacked tensors}\n ' keys = li...
def concat_tensor_list(tensor_list): return np.concatenate(tensor_list, axis=0)
def concat_tensor_dict_list(tensor_dict_list): keys = list(tensor_dict_list[0].keys()) ret = dict() for k in keys: example = tensor_dict_list[0][k] if isinstance(example, dict): v = concat_tensor_dict_list([x[k] for x in tensor_dict_list]) else: v = concat_t...
def split_tensor_dict_list(tensor_dict): keys = list(tensor_dict.keys()) ret = None for k in keys: vals = tensor_dict[k] if isinstance(vals, dict): vals = split_tensor_dict_list(vals) if (ret is None): ret = [{k: v} for v in vals] else: f...
def truncate_tensor_list(tensor_list, truncated_len): return tensor_list[:truncated_len]
def truncate_tensor_dict(tensor_dict, truncated_len): ret = dict() for (k, v) in tensor_dict.items(): if isinstance(v, dict): ret[k] = truncate_tensor_dict(v, truncated_len) else: ret[k] = truncate_tensor_list(v, truncated_len) return ret
class Colors(object): black = (0, 0, 0) white = (255, 255, 255) blue = (0, 0, 255) red = (255, 0, 0) green = (0, 255, 0)
class Viewer2D(object): def __init__(self, size=(640, 480), xlim=None, ylim=None): pygame.init() screen = pygame.display.set_mode(size) if (xlim is None): xlim = (0, size[0]) if (ylim is None): ylim = (0, size[1]) self._screen = screen self....
def _find_library_candidates(library_names, library_file_extensions, library_search_paths): '\n Finds and returns filenames which might be the library you are looking for.\n ' candidates = set() for library_name in library_names: for search_path in library_search_paths: glob_quer...
def _load_library(): '\n Finds, loads and returns the most recent version of the library.\n ' osp = os.path if sys.platform.startswith('darwin'): libfile = osp.abspath(osp.join(osp.dirname(__file__), '../../vendor/mujoco/libglfw.3.dylib')) elif sys.platform.startswith('linux'): l...
def _glfw_get_version(filename): '\n Queries and returns the library version tuple or None by using a\n subprocess.\n ' version_checker_source = "\n import sys\n import ctypes\n\n def get_version(library_handle):\n '''\n Queries and returns the library versi...
class _GLFWwindow(ctypes.Structure): '\n Wrapper for:\n typedef struct GLFWwindow GLFWwindow;\n ' _fields_ = [('dummy', ctypes.c_int)]
class _GLFWmonitor(ctypes.Structure): '\n Wrapper for:\n typedef struct GLFWmonitor GLFWmonitor;\n ' _fields_ = [('dummy', ctypes.c_int)]
class _GLFWvidmode(ctypes.Structure): '\n Wrapper for:\n typedef struct GLFWvidmode GLFWvidmode;\n ' _fields_ = [('width', ctypes.c_int), ('height', ctypes.c_int), ('red_bits', ctypes.c_int), ('green_bits', ctypes.c_int), ('blue_bits', ctypes.c_int), ('refresh_rate', ctypes.c_uint)] def __in...
class _GLFWgammaramp(ctypes.Structure): '\n Wrapper for:\n typedef struct GLFWgammaramp GLFWgammaramp;\n ' _fields_ = [('red', ctypes.POINTER(ctypes.c_ushort)), ('green', ctypes.POINTER(ctypes.c_ushort)), ('blue', ctypes.POINTER(ctypes.c_ushort)), ('size', ctypes.c_uint)] def __init__(self):...
def init(): '\n Initializes the GLFW library.\n\n Wrapper for:\n int glfwInit(void);\n ' cwd = _getcwd() res = _glfw.glfwInit() os.chdir(cwd) return res
def terminate(): '\n Terminates the GLFW library.\n\n Wrapper for:\n void glfwTerminate(void);\n ' _glfw.glfwTerminate()
def get_version(): '\n Retrieves the version of the GLFW library.\n\n Wrapper for:\n void glfwGetVersion(int* major, int* minor, int* rev);\n ' major_value = ctypes.c_int(0) major = ctypes.pointer(major_value) minor_value = ctypes.c_int(0) minor = ctypes.pointer(minor_value) re...
def get_version_string(): '\n Returns a string describing the compile-time configuration.\n\n Wrapper for:\n const char* glfwGetVersionString(void);\n ' return _glfw.glfwGetVersionString()
def set_error_callback(cbfun): '\n Sets the error callback.\n\n Wrapper for:\n GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);\n ' global _error_callback previous_callback = _error_callback if (cbfun is None): cbfun = 0 c_cbfun = _GLFWerrorfun(cbfun) _error_callb...
def get_monitors(): '\n Returns the currently connected monitors.\n\n Wrapper for:\n GLFWmonitor** glfwGetMonitors(int* count);\n ' count_value = ctypes.c_int(0) count = ctypes.pointer(count_value) result = _glfw.glfwGetMonitors(count) monitors = [result[i] for i in range(count_val...
def get_primary_monitor(): '\n Returns the primary monitor.\n\n Wrapper for:\n GLFWmonitor* glfwGetPrimaryMonitor(void);\n ' return _glfw.glfwGetPrimaryMonitor()
def get_monitor_pos(monitor): "\n Returns the position of the monitor's viewport on the virtual screen.\n\n Wrapper for:\n void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);\n " xpos_value = ctypes.c_int(0) xpos = ctypes.pointer(xpos_value) ypos_value = ctypes.c_int(0)...
def get_monitor_physical_size(monitor): '\n Returns the physical size of the monitor.\n\n Wrapper for:\n void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);\n ' width_value = ctypes.c_int(0) width = ctypes.pointer(width_value) height_value = ctypes.c_int(0) ...
def get_monitor_name(monitor): '\n Returns the name of the specified monitor.\n\n Wrapper for:\n const char* glfwGetMonitorName(GLFWmonitor* monitor);\n ' return _glfw.glfwGetMonitorName(monitor)
def set_monitor_callback(cbfun): '\n Sets the monitor configuration callback.\n\n Wrapper for:\n GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);\n ' global _monitor_callback previous_callback = _monitor_callback if (cbfun is None): cbfun = 0 c_cbfun = _GLFWmoni...
def get_video_modes(monitor): '\n Returns the available video modes for the specified monitor.\n\n Wrapper for:\n const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);\n ' count_value = ctypes.c_int(0) count = ctypes.pointer(count_value) result = _glfw.glfwGetVideoMod...
def get_video_mode(monitor): '\n Returns the current mode of the specified monitor.\n\n Wrapper for:\n const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);\n ' videomode = _glfw.glfwGetVideoMode(monitor).contents return videomode.unwrap()
def set_gamma(monitor, gamma): '\n Generates a gamma ramp and sets it for the specified monitor.\n\n Wrapper for:\n void glfwSetGamma(GLFWmonitor* monitor, float gamma);\n ' _glfw.glfwSetGamma(monitor, gamma)
def get_gamma_ramp(monitor): '\n Retrieves the current gamma ramp for the specified monitor.\n\n Wrapper for:\n const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);\n ' gammaramp = _glfw.glfwGetGammaRamp(monitor).contents return gammaramp.unwrap()
def set_gamma_ramp(monitor, ramp): '\n Sets the current gamma ramp for the specified monitor.\n\n Wrapper for:\n void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);\n ' gammaramp = _GLFWgammaramp() gammaramp.wrap(ramp) _glfw.glfwSetGammaRamp(monitor, ctypes.pointer(...
def default_window_hints(): '\n Resets all window hints to their default values.\n\n Wrapper for:\n void glfwDefaultWindowHints(void);\n ' _glfw.glfwDefaultWindowHints()
def window_hint(target, hint): '\n Sets the specified window hint to the desired value.\n\n Wrapper for:\n void glfwWindowHint(int target, int hint);\n ' _glfw.glfwWindowHint(target, hint)
def create_window(width, height, title, monitor, share): '\n Creates a window and its associated context.\n\n Wrapper for:\n GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);\n\n ' return _glfw.glfwCreateWindow(width, height, _to_c...
def destroy_window(window): '\n Destroys the specified window and its context.\n\n Wrapper for:\n void glfwDestroyWindow(GLFWwindow* window);\n ' _glfw.glfwDestroyWindow(window) window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_ulong)).contents.value for callbac...
def window_should_close(window): '\n Checks the close flag of the specified window.\n\n Wrapper for:\n int glfwWindowShouldClose(GLFWwindow* window);\n ' return _glfw.glfwWindowShouldClose(window)
def set_window_should_close(window, value): '\n Sets the close flag of the specified window.\n\n Wrapper for:\n void glfwSetWindowShouldClose(GLFWwindow* window, int value);\n ' _glfw.glfwSetWindowShouldClose(window, value)
def set_window_title(window, title): '\n Sets the title of the specified window.\n\n Wrapper for:\n void glfwSetWindowTitle(GLFWwindow* window, const char* title);\n ' _glfw.glfwSetWindowTitle(window, _to_char_p(title))
def get_window_pos(window): '\n Retrieves the position of the client area of the specified window.\n\n Wrapper for:\n void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);\n ' xpos_value = ctypes.c_int(0) xpos = ctypes.pointer(xpos_value) ypos_value = ctypes.c_int(0) ypo...
def set_window_pos(window, xpos, ypos): '\n Sets the position of the client area of the specified window.\n\n Wrapper for:\n void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);\n ' _glfw.glfwSetWindowPos(window, xpos, ypos)
def get_window_size(window): '\n Retrieves the size of the client area of the specified window.\n\n Wrapper for:\n void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);\n ' width_value = ctypes.c_int(0) width = ctypes.pointer(width_value) height_value = ctypes.c_int(0) ...
def set_window_size(window, width, height): '\n Sets the size of the client area of the specified window.\n\n Wrapper for:\n void glfwSetWindowSize(GLFWwindow* window, int width, int height);\n ' _glfw.glfwSetWindowSize(window, width, height)
def get_framebuffer_size(window): '\n Retrieves the size of the framebuffer of the specified window.\n\n Wrapper for:\n void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);\n ' width_value = ctypes.c_int(0) width = ctypes.pointer(width_value) height_value = ctypes....
def iconify_window(window): '\n Iconifies the specified window.\n\n Wrapper for:\n void glfwIconifyWindow(GLFWwindow* window);\n ' _glfw.glfwIconifyWindow(window)
def restore_window(window): '\n Restores the specified window.\n\n Wrapper for:\n void glfwRestoreWindow(GLFWwindow* window);\n ' _glfw.glfwRestoreWindow(window)
def show_window(window): '\n Makes the specified window visible.\n\n Wrapper for:\n void glfwShowWindow(GLFWwindow* window);\n ' _glfw.glfwShowWindow(window)
def hide_window(window): '\n Hides the specified window.\n\n Wrapper for:\n void glfwHideWindow(GLFWwindow* window);\n ' _glfw.glfwHideWindow(window)
def get_window_monitor(window): '\n Returns the monitor that the window uses for full screen mode.\n\n Wrapper for:\n GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);\n ' return _glfw.glfwGetWindowMonitor(window)
def get_window_attrib(window, attrib): '\n Returns an attribute of the specified window.\n\n Wrapper for:\n int glfwGetWindowAttrib(GLFWwindow* window, int attrib);\n ' return _glfw.glfwGetWindowAttrib(window, attrib)
def set_window_user_pointer(window, pointer): '\n Sets the user pointer of the specified window.\n\n Wrapper for:\n void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);\n ' _glfw.glfwSetWindowUserPointer(window, pointer)
def get_window_user_pointer(window): '\n Returns the user pointer of the specified window.\n\n Wrapper for:\n void* glfwGetWindowUserPointer(GLFWwindow* window);\n ' return _glfw.glfwGetWindowUserPointer(window)
def set_window_pos_callback(window, cbfun): '\n Sets the position callback for the specified window.\n\n Wrapper for:\n GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).co...
def set_window_size_callback(window, cbfun): '\n Sets the size callback for the specified window.\n\n Wrapper for:\n GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).co...
def set_window_close_callback(window, cbfun): '\n Sets the close callback for the specified window.\n\n Wrapper for:\n GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long...
def set_window_refresh_callback(window, cbfun): '\n Sets the refresh callback for the specified window.\n\n Wrapper for:\n GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(cty...
def set_window_focus_callback(window, cbfun): '\n Sets the focus callback for the specified window.\n\n Wrapper for:\n GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long...
def set_window_iconify_callback(window, cbfun): '\n Sets the iconify callback for the specified window.\n\n Wrapper for:\n GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(cty...
def set_framebuffer_size_callback(window, cbfun): '\n Sets the framebuffer resize callback for the specified window.\n\n Wrapper for:\n GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window),...
def poll_events(): '\n Processes all pending events.\n\n Wrapper for:\n void glfwPollEvents(void);\n ' _glfw.glfwPollEvents()
def wait_events(): '\n Waits until events are pending and processes them.\n\n Wrapper for:\n void glfwWaitEvents(void);\n ' _glfw.glfwWaitEvents()
def get_input_mode(window, mode): '\n Returns the value of an input option for the specified window.\n\n Wrapper for:\n int glfwGetInputMode(GLFWwindow* window, int mode);\n ' return _glfw.glfwGetInputMode(window, mode)
def set_input_mode(window, mode, value): '\n Sets an input option for the specified window.\n @param[in] window The window whose input mode to set.\n @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or\n `GLFW_STICKY_MOUSE_BUTTONS`.\n @param[in] value The new value of the specified input mo...
def get_key(window, key): '\n Returns the last reported state of a keyboard key for the specified\n window.\n\n Wrapper for:\n int glfwGetKey(GLFWwindow* window, int key);\n ' return _glfw.glfwGetKey(window, key)
def get_mouse_button(window, button): '\n Returns the last reported state of a mouse button for the specified\n window.\n\n Wrapper for:\n int glfwGetMouseButton(GLFWwindow* window, int button);\n ' return _glfw.glfwGetMouseButton(window, button)
def get_cursor_pos(window): '\n Retrieves the last reported cursor position, relative to the client\n area of the window.\n\n Wrapper for:\n void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);\n ' xpos_value = ctypes.c_double(0.0) xpos = ctypes.pointer(xpos_value) ...
def set_cursor_pos(window, xpos, ypos): '\n Sets the position of the cursor, relative to the client area of the window.\n\n Wrapper for:\n void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);\n ' _glfw.glfwSetCursorPos(window, xpos, ypos)
def set_key_callback(window, cbfun): '\n Sets the key callback.\n\n Wrapper for:\n GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.value if (window_addr in _key_callback_repos...
def set_char_callback(window, cbfun): '\n Sets the Unicode character callback.\n\n Wrapper for:\n GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.value if (window_addr in _...
def set_mouse_button_callback(window, cbfun): '\n Sets the mouse button callback.\n\n Wrapper for:\n GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.value ...
def set_cursor_pos_callback(window, cbfun): '\n Sets the cursor position callback.\n\n Wrapper for:\n GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.value i...
def set_cursor_enter_callback(window, cbfun): '\n Sets the cursor enter/exit callback.\n\n Wrapper for:\n GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.v...
def set_scroll_callback(window, cbfun): '\n Sets the scroll callback.\n\n Wrapper for:\n GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);\n ' window_addr = ctypes.cast(ctypes.pointer(window), ctypes.POINTER(ctypes.c_long)).contents.value if (window_addr in _scr...
def joystick_present(joy): '\n Returns whether the specified joystick is present.\n\n Wrapper for:\n int glfwJoystickPresent(int joy);\n ' return _glfw.glfwJoystickPresent(joy)
def get_joystick_axes(joy): '\n Returns the values of all axes of the specified joystick.\n\n Wrapper for:\n const float* glfwGetJoystickAxes(int joy, int* count);\n ' count_value = ctypes.c_int(0) count = ctypes.pointer(count_value) result = _glfw.glfwGetJoystickAxes(joy, count) r...
def get_joystick_buttons(joy): '\n Returns the state of all buttons of the specified joystick.\n\n Wrapper for:\n const unsigned char* glfwGetJoystickButtons(int joy, int* count);\n ' count_value = ctypes.c_int(0) count = ctypes.pointer(count_value) result = _glfw.glfwGetJoystickButton...
def get_joystick_name(joy): '\n Returns the name of the specified joystick.\n\n Wrapper for:\n const char* glfwGetJoystickName(int joy);\n ' return _glfw.glfwGetJoystickName(joy)
def set_clipboard_string(window, string): '\n Sets the clipboard to the specified string.\n\n Wrapper for:\n void glfwSetClipboardString(GLFWwindow* window, const char* string);\n ' _glfw.glfwSetClipboardString(window, _to_char_p(string))
def get_clipboard_string(window): '\n Retrieves the contents of the clipboard as a string.\n\n Wrapper for:\n const char* glfwGetClipboardString(GLFWwindow* window);\n ' return _glfw.glfwGetClipboardString(window)