raylib-python-ctypes
A python wrapper for the greatest graphic library raylib.
Prerequisites
raypyc uses type annotations in its source, so a Python version that supports it is required.
Installing
the fastest way to use raypyc is by using the pip install command:
pip install raypyc
or
python -m pip install raypyc
Using raypyc
using raypyc is really simple, take a look at an example:
"""
raylib [core] example - Basic Window
"""
from raypyc import *
# ------------------------------------------------------------------------------------
# Program main entry point
# ------------------------------------------------------------------------------------
def main():
# Initialization
# ------------------------------------------------------------------------------------
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 450
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, b"raylib [core] example - basic window")
# TODO: Load resources / Initialize variables at this point
set_target_fps(60) # Set our game to run at 60 frames-per-second
# ------------------------------------------------------------------------------------
# Main game loop
while not window_should_close(): # Detect window close button or ESC key
# Update
# ----------------------------------------------------------------------------------
# TODO: Update variables / Implement example logic at this point
# ----------------------------------------------------------------------------------
# Draw
# ----------------------------------------------------------------------------------
begin_drawing()
clear_background(RAYWHITE)
draw_text(b"Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
end_drawing()
# ----------------------------------------------------------------------------------
# De-Initialization
# ----------------------------------------------------------------------------------
# TODO: Unload all loaded resources at this point
close_window() # Close window and OpenGL context
# ----------------------------------------------------------------------------------
# Execute the main function
if __name__ == '__main__':
main()
raylib vs raypyc
Below are the differences in usage between raylib and raypyc.
Enums
All C typeof enums got translated to Python 'constants'. Enums got translated to
Python enums.
Structures
In general, all structures inherit from ctypes.Structure class. At the moment, all the structures have a setters &
getter
Contributing
firstly, Contributions of any kind welcome!.
secondly, here are some of the things that contributing on will help this wrapper the most:
- porting examples from c to python(if you can, please follow along with the conventions when porting). ( C examples, Python examples)
- fixing(refactoring) my fileGeneration, so it will look neater...
- making the wrapper able to port to more operating systems
- wrapping more c raylib header to this library[^2]
[^2] NOTE: at least for now, all the non-functions wrapper stuff need be implemented in the filesGeneration.py file, and all the functions wrapper stuff need be implemented in the raypyc/__ init__.py
thanks
thanks to raysun5, pyraylib and pyray for their good work, I took all the inspiration (and some code ;) ) from them, so thanks you guys very much. also a big thanks for the people that helped to test and reviewing the library :)!!!
also a special thanks to Peter0x44, Its-Kenta, sol-vin, pmp-p and stucotso.
Metadata
Release files for raypyc 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| raypyc-0.1.8.tar.gz | 2.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| raypyc-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.9 MB
Release files / raypyc-0.1.8.tar.gz
| Download URL | raypyc-0.1.8.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd98d02ac0260277602247c89d3ddd028f919b6d67872801dda9398c312827d3
|
|
BLAKE2b-256 checksum How to use checksums |
bb7c69b3e9a1f13e2eb314b894b69f60adad55fb1a98a841822c9315e6ef86ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / raypyc-0.1.8-py3-none-any.whl
| Download URL | raypyc-0.1.8-py3-none-any.whl |
|---|---|
| Size | 2.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9e85ae5de20aef39a7193177f24e4d63722d0f1378e510c0fde2e5fee721f2e
|
|
BLAKE2b-256 checksum How to use checksums |
d0325aad9540b11c9f9cf7b30015ee16f98d486974609c8c71f62f1d4c4e0c14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|