{ "info": { "author": "Jorge A. Gomes", "author_email": "jorgegomes83@hotmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Games/Entertainment" ], "description": "# raylib-py\n\nA python binding for the great _C_ library **[raylib](https://github.com/raisan5/raylib)**.\n\n## Getting Started\n\n### Prerequisites\n\n_raylib-py_ uses type [annotations](https://www.python.org/dev/peps/pep-3107/#id30) in its source, so a Python version that supports it is required.\n\nSome Python versions may not have [enum](https://pypi.org/project/enum/) and/or [typings](https://pypi.org/project/typing/) modules as part of the standard library, wich are required. These are installed automatically by pip.\n\n### Installing\n\nThe easiest way to install _raylib-py_ is by the pip install command:\n\nDepending on you system and python version(s) installed, the command might be:\n\n```\npip install raylib-py\n```\n\nor\n\n```\npython -m pip install raylip-py\n```\n\nor (with Python3.7 launcher with multiple versions installed)\n\n```\npy-3.x-32 -m pip install raylib-py\n```\n\n> Note that the minimum Python version tested is 3.4. Please, let me know if you're able to run it in Python33.\n\n_raylib-py_ comes with 32bit binaries for Windows, Mac and Linux, but you're not required to use these. If you have a custom _raylib_ _**dll**_, _**dylib**_ or _**so**_ binary, make sure to set a PATH indicating the directory it is located:\n\n```python\nimport os\n\n# set the path before raylib is imported.\nos.environ[RAYLIB_LIB_PATH] = \"path/to/the/binary\"\n\nimport raylibpy\n\n# let the fun begin.\n```\n\nYou can set `\"__file__\"` as value to `RAYLIB_LIB_PATH` and _raylib-py_ will search for the binary in the package dir:\n\n```python\n# bynary file is wherever the package is located.\nos.environ[RAYLIB_LIB_PATH] = \"__file__\"\n```\n\n`\"__main__\"` can also be set to look for the binary in the project's directory where the starting script is located:\n\n```python\n# binary file is in the same dir as this py file.\nos.environ[RAYLIB_LIB_PATH] = \"__main__\"\n\n# ...\n\nif __name__ == \"__main__\":\n # run the game\n # ...\n```\n\n> Make sure the bin file name for the respective platform is `libraylib_shared.dll`, `libraylib.2.0.0.dylib` or `libraylib.so.2.0.0`.\n\n## Tests\n\n_raylib-py_ does not have test code, but you can run the examples in the [examples directory](https://github.com/overdev/raylib-py/tree/master/examples).\n\n\n\n## _raylib_ vs _raylib-py_\n\nBelow are the differences in usage between _raylib_ and _raylib-py_. Note, though that these differences are being worked to make _raylib-py_ as pythonic as possible, so changes may occur without notification.\n\n### Constant values\n\nAll C `#define`s got translated to Python 'constants'. Enums got translated to\nPython [enums](https://docs.python.org/3/library/enum.html).\n\n### Structures\n\nIn general, all structures inherit from `ctypes.Structure` class. At the moment, constructors\n(except for vectors) require the exact argument types, so `int`s can't be passed\nwhere `float`s are expected (although the argument can be omitted).\n\nAll structures have `__str__()` implemented, so they have a very basic textual representation:\n```python\n# Define the camera to look into our 3d world\n>>> camera = Camera()\n>>> camera.position = Vector3(5., 4., 5.)\n>>> camera.target = Vector3(0., 2., 0.)\n>>> camera.up = Vector3(0., 1., 0.)\n>>> camera.fovy = 45.0\n>>> camera.type = CAMERA_PERSPECTIVE\n>>> camera\n\"(CAMERA3D: position: (5.0, 4.0, 5.0), target: (0.0, 2.0, 0.0), up: (0.0, 1.0, 0.0), fovy: 45.0\u00b0, type: PERSPECTIVE)\"\n```\nNot all information is exposed, though. Mesh objects, for example, exposes only the\nvertex and triangle count attributes.\n\n\n#### Vectors\n\nVector2, Vector3 and Vector4 support basic aritmetic operations: addiction, subtraction,\nmultiplication (incluiding scalar multiplication), division and modulo. Augmented\nassignment is also supported; the right hand side operand can be any sequence of same\nnumber of components:\n\n```python\nvec_a = Vector3(3., 5., 7.)\nvec_b = Vector3(4., 2., 0.)\nvec_a * vec_b # outputs (12.0, 10.0, 0.0)\nvec_a + (8, 100, -1) # outputs (11.0, 105.0, 6.0)\nvec_a %= 2 # augmented assignment (modulo)\nvec_a # outputs (1.0, 1.0, 0.0)\n```\n\nVectors also support GLSL vector swizzling. Also, `x`, `y`, `z` and `w` coordinates maps to\nnormalized color values (`r`, `g`, `b` and `a`; only for `Vector3` and `Vector4`) and\ntexture coordinates (`u` and `v`):\n\n```python\n# Reading (__getattr__)\nvec3 = Vector3(123.0, 467.0, 789.0)\nvec2 = vec3.uv # x and y respectively as u and v\nvec3 = vec3.bgr # x, y and z respectively as r, g and b ( rgb is not available in Vector 2)\nvec4 = vec2.rrrg # for attribute reading, is ok to repeat components\n\n# Writing (__setattr__)\nvec3 = Vector3(123.0, 467.0, 789.0)\nvec4.yxwz = 10, 0, -1, vec3.z # sequences of ints and/or floats are accepted as value\nvec2.vu = vec3.xy # x and y respectively as u and v\nvec3.bgr = 12, vec4.x # x, y and z respectively as r, g and b ( rgb is not available in Vector 2)\n\n# the following raises an exception:\nvec3.rrr = vec4.yxw # for attribute writing, is _not_ ok to repeat components\nvec2.br = vec4.uv # r, g and b is not available in Vector2\nvec4.brxy = (0., 0., vec2.x, vec3.z) # can't mix component name groups (rgba, xywz and uv)\n```\n\nConstructors and swizzled attributes now accept any combination of numbers,\nvectors and sequences, as long as the total number of arguments are preserved:\n```python\n# all these results in the same Vector4\na = Vector4(3, 4, 5, 6)\nb = Vector4(a.xy, 5, 6)\nc = Vector4(b.x, b.yz, 6)\nd = Vector4(3, c.y, c.zw)\ne = Vector4(d.xy, (5, 6))\nf = Vector4(e.xyz, 6)\ng = Vector4(3, f.yzw)\nh = Vector4(g)\n```\n\nSetting attributes also works:\n\n```python\na = Vector4(Vector2(10, 0), 100, 20)\nb = Vector4.zero()\nb.rgba = 0.0, vec4.rg, 1.0\na.xyzw = (10, b.uv), 1.0\n```\n\nThis became available by dropping a previous feature wich allowed for a very basic\nswizzling emulation. A feature more similar to GLSL vectors is implemented on\ntop of Python container emulation magic functions:\n\n```python\nvec = Vector4(0., 1., 2., 3.)\n\n# __len__()\nprint(len(vec)) # outputs 4\n\n# __iter__()\nfor comp in vec:\n print(comp) # iterates on Vector4 components\n\n# __getitem__()\nx = vec[0] # key as int\ny = vec['y'] # key as str\nzw = vec[2:] # key as slice; returns a List[float]\n\n# __setitem__()\nvec[0] = 10\nvec['y'] = 20\n# vec[2:] = zw # <--- not supported; will raise TypeError\n```\n\n## Additional (feature) draw function: `draw_texture_npatch`\n\nThe custom DLL installed by _raylib-py_ includes an not yet official drawing function and\ncorresponding `NPatchInfo` helper structure:\n\n```python\n# draws an 3-patch (vertical, or horizontal) or 9-patch textured that stretches and\n# shrinks nicely.\n# Seq means any sequence type\ndef draw_texture_npatch(texture: Texture2D, npatch_info: NPatchInfo,\n dest_rec: Union[Rectangle, Seq], origin: Union[Vector2, Seq],\n rotation: float, tint: Union[Color, Seq]) -> None:\n```\n\nAt the moment (after _raylib_ v2.0.0), only the x86 custom DLL contains this function\nand, to enabled it, an specific `os.environ` key must be set:\n\n```python\n# set this before importing raylibpy (the value does not matter as long is a str type)\nos.environ['ENABLE_V2_0_0_FEATURE_DRAWTEXTURENPATCH'] = '1'\n```\n\n## Building _raylib_ from source\n\n_raylib_ wiki pages contains information on how to build it on [Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows), [Mac](https://github.com/raysan5/raylib/wiki/Working-on-macOS), [Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux) and other platforms.\n\n## Contributing\n\nPlease, let me know if you find any strange or unexpected behavior while using _raylib-py_. If you want to [request features](https://github.com/raysan5/raylib/pulls) or [report bugs](https://github.com/raysan5/raylib/issues) related to the library (in contrast to this binding), please refer to the [author's project repo](https://github.com/raysan5/raylib).\n\n## Authors\n\n* **Ramon Santamaria** - *raylib's author* - [raysan5](https://github.com/raysan5)\n* **Jorge A. Gomes** - *python binding code* - [overdev](https://github.com/overdev)\n\nSee also the list of [contributors](https://github.com/raysan5/raylib/graphs/contributors) who participated in this project.\n\n## License\n\n_raylib-py_ (and _raylib_) is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software.\n\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/overdev/raylib-py", "keywords": "raylib easy-to-use OpenGL OGL 3D 2D game development", "license": "", "maintainer": "", "maintainer_email": "", "name": "raylib-py", "package_url": "https://pypi.org/project/raylib-py/", "platform": "", "project_url": "https://pypi.org/project/raylib-py/", "project_urls": { "Bug Reports": "https://github.com/overdev/raylibpy/issues", "Homepage": "https://github.com/overdev/raylib-py", "Source": "https://github.com/overdev/raylibpy/" }, "release_url": "https://pypi.org/project/raylib-py/0.1.1/", "requires_dist": null, "requires_python": ">=3.3, <4", "summary": "A Python binding for the great C library raylib", "version": "0.1.1" }, "last_serial": 4432716, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ee68188afacebbab16df56f34a29864d", "sha256": "cdef23c9a9ffb6e850c0d94823ca164680507941ffca4ef8adf048cde656362f" }, "downloads": -1, "filename": "raylib_py-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee68188afacebbab16df56f34a29864d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 2151033, "upload_time": "2018-09-01T03:24:37", "url": "https://files.pythonhosted.org/packages/1e/18/020e8c8d8614d934a6d2819fa9ffc4e612219f5cd56f8af033d654821d1d/raylib_py-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ee309206357e615382f4936f92658fb", "sha256": "af5559111da463aea25f89f3cd765e0fb57f9d29129579e3122600a37d7c3db7" }, "downloads": -1, "filename": "raylib-py-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3ee309206357e615382f4936f92658fb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3, <4", "size": 473851, "upload_time": "2018-09-01T03:24:41", "url": "https://files.pythonhosted.org/packages/71/30/69bf0e4c1712ada6399d10af446d496a04f4fe5b578fa68a2e6764fa3c0a/raylib-py-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1d7fa9a0284f4ac240b4d40f0c20b663", "sha256": "afbc317ea038ef474f9073df9a39e0e5b639d3d3b86c347f68557b99f2ff8edb" }, "downloads": -1, "filename": "raylib_py-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1d7fa9a0284f4ac240b4d40f0c20b663", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 2151787, "upload_time": "2018-10-30T18:57:26", "url": "https://files.pythonhosted.org/packages/2b/82/72074890195301d5fe8c3e768ebd9da06892eae1eab768b3a473e806ead6/raylib_py-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1c4cc2b7e7d0f01d9a4caf062881bc8", "sha256": "3fee60ee91df79a738c8962f8f3840e4344a38fb0d7cbefb827e8e3a365c0c9b" }, "downloads": -1, "filename": "raylib-py-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c1c4cc2b7e7d0f01d9a4caf062881bc8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3, <4", "size": 474817, "upload_time": "2018-10-30T18:57:30", "url": "https://files.pythonhosted.org/packages/83/d4/c7ead6eeae1cb1daf109e4719707b8a1a683438f75486367f6199be50b6d/raylib-py-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1d7fa9a0284f4ac240b4d40f0c20b663", "sha256": "afbc317ea038ef474f9073df9a39e0e5b639d3d3b86c347f68557b99f2ff8edb" }, "downloads": -1, "filename": "raylib_py-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1d7fa9a0284f4ac240b4d40f0c20b663", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 2151787, "upload_time": "2018-10-30T18:57:26", "url": "https://files.pythonhosted.org/packages/2b/82/72074890195301d5fe8c3e768ebd9da06892eae1eab768b3a473e806ead6/raylib_py-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1c4cc2b7e7d0f01d9a4caf062881bc8", "sha256": "3fee60ee91df79a738c8962f8f3840e4344a38fb0d7cbefb827e8e3a365c0c9b" }, "downloads": -1, "filename": "raylib-py-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c1c4cc2b7e7d0f01d9a4caf062881bc8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3, <4", "size": 474817, "upload_time": "2018-10-30T18:57:30", "url": "https://files.pythonhosted.org/packages/83/d4/c7ead6eeae1cb1daf109e4719707b8a1a683438f75486367f6199be50b6d/raylib-py-0.1.1.tar.gz" } ] }