Pytermgame

Latest version: v1.2

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

Scan your dependencies

1.2

Composite UI
An easy-to-use yet robust api for creating UI using pytermgame. The whole UI system is built **on top** of the current sprite system, meaning games that do not use `ptg.ui` will not suffer from unnecessary coupling with the UI side of things.

A **container** modifies its child's dimensions and adds extra surfaces. It must have zero or one child.

A **collection** defines how its children are arranged. It must have one or more children.

Pre-built UI components include `Padding`, `Border`, `Column` and more!

Event system overhaul
There are now two types of event emitters:
* intervals - emit events periodically based on game ticks (managed by game)
* timers - emit events periodically based on seconds (managed by the event system)

Aside from tick-based game loops, event-based game loops are also supported now. See `Game.event_loop()` and variants.

Advanced styling
* children now inherits parent styles for unspecified style fields (useful for composite UI)
* sprite costumes: switch between surface-style presets easily
* cursor styles

---

Small things:
* `screen` renamed to `viewport` to avoid confusion
* strings as keys
* Function keys F1-F12
* primitive sprite re-ordering using `Scene.move_sprite_to_below()`
* refined collision detection in some edge cases (especially with hidden sprites)
* `pytermgame.sprites.BouncingBall` for easy testing

Technical things:
* new optional class attribute `style`
* `Parent` ABC introduced for composite UI
* Phantom surfaces for composite UI elements with no surfaces
* core render logic moved to surface
* get_keys implementations now raises an execption when there is invalid input / failed read
* removed transitions, `pytermgame.additional` and `pytermgame.layout`
* formalized the `Sprite.process(event)` method to the `EventProcessor` protocol
* removed frozen sprite groups - use tuples instead
* removed spritelist - scene is no longer a group
* `Color` generalized to `Colors` - no longer enum of ending digit of 8-bit color code
* Optimizations available:
* terminal size caching (default: cache every tick)
* cache collidables flattening - significantly increases speed for collision-heavy games but may cause delayed destruction of sprites

1.1.2

New things:
* scene scrolling
* cursor control
* both decimal and fractional coordinate systems
* external profiler
* basic sprite styling system
* new pre-made sprites: `Gauge`, `Border` and `TextInput`
* better support dynamic surface generation

Small things:
* fine-tuned `KinematicSprite.bounce()`
* fixed hidden sprite collision
* fixed SpriteList not added to `Sprite._groups`

Technical things:
* refactored `Sprite._oldsurf`, `Sprite._oldcoords` and `Sprite._dirty` into `RenderedState`
* separated debug checks into `ptg._dev`
* removed transition
* made `Scene` inherit from `SpriteList` instead of `Group`

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.