Pygametemplate

Latest version: v0.9.2

Safety actively analyzes 638437 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

0.7.0

* `pygametemplate.Game.__init__()` now optionally takes
`caption` and `icon` arguments.
* `caption` specifies the caption (window title) at the top of the game window.

* `icon` should be the name of a `.ico` file
which will be used as the game window's icon.
For example, if you have a `assets/images/tree.ico` file,
you would pass in `icon="tree"`.
These must be passed in as keyword arguments.

* There is now a new `pygametemplate.Image` class,
which helps with keeping RAM taken by images in check.
Instances of `Image` have the following methods:
* `Image.__init__(image_name)`: Takes the name of the image.
For example, if your image file is `assets/images/heart.png`,
pass in `"heart"`.

* `Image.load()`: Load the image's `pygame.Surface` object into RAM.
Minimal RAM will be used before this method is called.

* `Image.unload()`: Unload the image's `pygame.Surface` object from RAM.
This will clear up almost all usage of RAM by the `Image` instance.

* `Image.display(surface: pygame.Surface, coordinates, area=None, special_flags=0)`:
Display the image on the given `surface`. The arguments other than `surface`
are the same as the arguments passed to `pygame.Surface.blit()`.

0.6.1

* Remove some silly `try`/`except` blocks.
This means that fewer `pygametemplate.CaughtFatalException`s will be raised,
as the actual raised exceptions will be raised in their place.

* Add some missing docstrings and function annotations.

0.6.0

First pypi release.

* [**Backwards incompatible change**]<br>
Remove Python 2 support.

* [**Backwards incompatible change**]<br>
`Console.__init__()`'s `toggle_fps_hotkey` argument must now be passed in as a keyword.

* `pygametemplate.core.load_image()` now raises a `FileNotFoundError` instead
of an `IOError` when an image file with the given name can't be found.

0.5.0

**Warning**: This release is broken. Please use `0.6.0` instead.

* [**Backwards incompatible change**]<br>
Replace `core.load_image()`'s `fade_enabled` parameter with a `fix_alphas`
parameter. If you used to pass in `fade_enabled=True`, you should now pass in
`fix_alphas=False`.

* Add `pygametemplate.exceptions.PygameError` as an alias for `pygame.error`.

* Add new `pygametemplate.debug` module with a `DebugConsole` member.
This `DebugConsole` can be initialised in your game code, similar to
`pygametemplate.Console`. The difference here is that this `DebugConsole`
(which can be opened by pressing ` [default]) allows you to type in oneline
Python code which will be executed using `exec()` or, failing this,
evaluated using `eval()`. If this fails too, the original raised exception
will be shown.

0.4.1

* Add missing `pygame` import in the `pygametemplate.core` module which
was causing the `load_image()` and `load_font()` functions to throw an error.

* Add unit tests for the `pygametemplate.core` module.

* Make `pygametemplate.core.load_image()` raise `IOError` instead of `pygame.error`
when trying to load an image that can't be found, so that it actually passes unit tests.

* Add `TEST` environment variable functionality.
Set this to `"1"` to indicate that your game is being run by automated tests.
Currently, doing this enables the following behaviour:
* `core.log()` will reraise the last thrown exception,
instead of doing `raise CaughtFatalException`.
This makes it easier to test that your functions/methods raise
the errors you expect them to, as they will just raise these errors.

* `core.log()` will not open a popup window on fatal errors.
This is because interacting with this window from automated tests is very difficult.

0.4.0

* [**Backwards incompatible change**]<br>
Move the `path_to()`, `log()`, `load_image()` and `load_font()` methods of
the `Game` class to be functions of a new `pygametemplate.core` module.
`log()`, `load_image()` and `load_font()` are also accessible as direct
members of the `pygametemplate` module.

* [**Backwards incompatible change**]<br>
Remove `pygametemplate.helper.Helper` class and move its methods to
be functions as members of the `pygametemplate.helper` module.
`Game` instances no longer have a `helper` attribute, meaning that all
references to `game.helper.method()` will have to be replaced with
`pygametemplate.helper.method()`.

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.