Package: pyraylib
pyraylibA python binding for the greatClibraryraylib.
The library provides object-oriented wrappers around raylib's struct interfaces.Getting StartedPrerequisitespyraylibuses typeannotationsin its source, so a Python version that supports it is required.Some Python versions may not haveenumand/ortypingsmodules as part of the standard library, wich are required. These are installed automatically by pip.InstallingThe easiest way to installpyraylibis by the pip install command:Depending on you system and python version(s) installed, the command might be:pipinstallpyrayliborpython-mpipinstallpyraylibor (with Python3.7 launcher with multiple versions installed)py-3.x-32-mpipinstallpyraylibNote that the minimum Python version tested is 3.4. Please, let me know if you're able to run it in Python33.pyraylibcomes with 32bit binaries for Windows, Mac and Linux, but you're not required to use these. If you have a customraylibdll,dyliborsobinary, make sure to set a PATH indicating the directory it is located:importos# set the path before raylib is imported.os.environ["RAYLIB_PATH"]="path/to/the/binary"importpyraylib# let the fun begin.You can set"__file__"as value to"RAYLIB_PATH"andpyraylibwill search for the binary in the package dir:# bynary file is wherever the package is located.os.environ["RAYLIB_PATH"]="__file__""__main__"can also be set to look for the binary in the project's directory where the starting script is located:# binary file is in the same dir as this py file.os.environ["RAYLIB_BIN_PATH"]="__main__"# ...if__name__=="__main__":# run the game# ...Make sure the bin file name for the respective platform israylib.dll,libraylib.3.7.0.dyliborlibraylib.so.Using pyraylibUsing pyraylib is as simple as this:importpyraylibfrompyraylib.colorsimport(LIGHTGRAY,RAYWHITE)# InitializationSCREEN_WIDTH,SCREEN_HEIGHT=800,450window=pyraylib.Window((SCREEN_WIDTH,SCREEN_HEIGHT),'pyraylib [core] example - basic window')# Set our game to run at 60 frames-per-secondwindow.set_fps(60)# Main game loopwhilewindow.is_open():# Detect window close button or ESC key# Update# TODO: Update your variables here# Drawwindow.begin_drawing()window.clear_background(RAYWHITE)pyraylib.draw_text('Congrats! You created your first window!',190,200,20,LIGHTGRAY)window.end_drawing()# Close window and OpenGL contextwindow.close()Theexamples/directory contains more examples.Testspyraylibdoes not have test code, but you can run the examples in theexamples directory.raylibvspyraylibBelow are the differences in usage betweenraylibandpyraylib. Note, though that these differences are being worked to makepyraylibas pythonic as possible, so changes may occur without notification.Constant valuesAll C#defines got translated to Python 'constants'. Enums got translated to
Pythonenums.StructuresIn general, all structures inherit fromctypes.Structureclass. At the moment, constructors
(except for vectors) require the exact argument types, soints can't be passed
wherefloats are expected (although the argument can be omitted).All structures have__str__()implemented, so they have a very basic textual representation:ContributingContributions of any kind welcome!AuthorsRamon Santamaria-raylib's author-raysan5Hussein Sarea-python binding code-pyraylibLicensepyraylib(andraylib) is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software.