Skip to main content

A 2-D game engine for Python

Project description

# laylib package for pygame

This package is made to fast prototype your multimedia applications like games on pygame.
Write clean and pragmatic design. It lets you focus on the game engine itself, so you dont have
to take care about several details like setting up the window, loading and cheking data (images,
sound, font, fx, music, resources names...).
All you need to do is to put your resources into a specific data folder and use them
in your game class 'MyEngine()'.

You don't need to reinvent the wheel, some repetitive parts of code (main loop, getting the delta time,
closing the window, drawing text...) are already described and ready to use in the
default engine.

1)- Environment class:
This is the first class to call on your main file, to set the
pygame environement.
By default the pygame display,the mixer and the font are initialized.

2)- load_complete(self, instance, dataFolder=None, fileLevels=None):
This is the second method to call on your main file
to load your resources if any.(see load_complete for parameters
description).

# Note that this is important to respect the following scheme
for all types of game:
1- Set the environement
2- load all resources only once.
3- main loop function called by an instance of your game engine.
4- at the end of the game destroy resources and quit the environement.
Your main file should always look like the following example:

Usage example:

```python
>>> from laylib import Environment
>>> from engine import Engine
>>>
>>> def main():
>>> demo = Environment(800, 600, False, 'My game')
>>> demo.load_complete(Engine(), 'data', 'resources.res')
>>> demo.gInstance.main_loop()
>>> demo.destroy()

>>> if __name__ == "__main__":
>>> main()
```

### INSTALLATION

First, install the dependencies:
- Python3 (3.1 or later) <http://www.python.org>
- Pygame 1.9.1 or later <http://pygame.org/download.shtml>

Then install laylib:

```os
pip install laylib
```
Or alternatively, you can just copy the "laylib" folder into the same
directory as the Python program that uses it.

### USAGE

For usage see examples provided with laylib.
For more details, all other parts of documentation are described in the source file.

### TODO

- [ ] add unittest module.
- [ ] more automation for resources management
- [ ] improve util.py module
- [x] add more examples for demo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laylib-1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laylib-1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file laylib-1.0.tar.gz.

File metadata

  • Download URL: laylib-1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for laylib-1.0.tar.gz
Algorithm Hash digest
SHA256 2639221de223646b2ac320a421c4c1f67f6f9db09ad3d6c2e49b5932b6eaecd4
MD5 8f69bd042fc0d9d1b1b8201683d32b7f
BLAKE2b-256 3a2fac063585406bafeb074fc0cafbb5493105fcb31aba84f31e5ea585973908

See more details on using hashes here.

File details

Details for the file laylib-1.0-py3-none-any.whl.

File metadata

  • Download URL: laylib-1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for laylib-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 539e2658e7f019778c9ee6bb1be6da0d62d6566900d2e91512c329b17f1d909b
MD5 2ead037433e60ddf18ed0ea45ef66a9a
BLAKE2b-256 589cdbd5df5638d6422c95c6c7a964975e6b8aaf346d6f529bda0b3844e64fd9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page