Pygametemplate

Latest version: v0.9.2

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

Scan your dependencies

Page 1 of 3

0.9.2

* Fix bug which caused the game to crash when a single view used up
more than `game.max_allowed_ram`.

* Fix default `max_allowed_ram` to be 1GB as it was supposed to be.
It was incorrectly set to 1B in previous versions.

0.9.1

**Warning**: This version has a bug in it meaning its functionality is
limited. Please use version 0.9.2 instead.

* Fix fatal bug (bad reference) in `Game.set_view()` that caused a crash 100% of the time.

0.9.0

**Warning**: This version has a fatal bug in it meaning its functionality is
severly limited. Please use version 0.9.2 instead.

* Rename `Game.quit()` to `Game.on_quit()` and make it optional to implement.
If you want to add custom functionality, you can now define the `on_quit()`
method on your `Game` subclass.

* Add new `Game.quit()` method which signals the game to exit.
**Be sure not to override this method: there is a high chance you already
have, as this was required in previous versions.**

* Add new `Game.get_memory_use() -> int` method which returns the current
memory usage of the game (RSS) in bytes.
Note that this adds a new pip requirement, the `psutil` module.

* `Game.__init__()` now takes an optional `max_allowed_ram` keyword argument,
which defaults to `1**30` bytes (1GB). Previous views are now cached by the
game and are reused if they're still loaded into RAM. Old views are only
unloaded from RAM if the current RAM usage of the game goes over the maximum
allowed amount.

* `Image.load()` no longer reloads the image if the image is already loaded
when it's called. This means that even if `Image.load()` is called twice
sequentially, the image is only loaded once, saving CPU cycles.

0.8.2

* Change `Game.set_view()` to take `view_name: str` instead of
`View: pygametemplate.View`, as taking a `View` class meant that
other `View` classes needed to import each other, which was causing
circular imports, and thus erroring code. This was considered to be a bug as
views could not switch between each other before. `View` classes are now expected
to be members of the `lib.views` module in your project. You can change this
by setting the `VIEW_MODULE` attribute of your `Game` subclass.
Alternatively, you can override the `Game.get_view_class(view_name: str)`
method of your `Game` subclass to have your own custom
view name -> View class conversion functionality.

0.8.1

* Fix a bug where using `pygame` functions in your `StartingView`
(passed to `Game.__init__()`) would throw an error saying
`pygame not initialised` or something similar.

0.8.0

* Rename the `pygametemplate.game`, `pygametemplate.view`, and `pygametemplate.image`
modules to `_game`, `_view` and `_image` respectively.
These modules shouldn't be imported from anyway, as their members
are available as direct members of `pygametemplate`.

* `pygametemplate.load_image()` now expects the name of the image file
**including** the file extension, not excluding it, as was the case before.
The same goes for `pygametemplate.Image.__init__()`,
and for the `icon` argument of `pygametemplate.Game`.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.