Metadata-Version: 2.4
Name: ascreen
Version: 0.1.5
Summary: A lightweight Python ASCII screen and keyboard library
Author: Nurasyl
License-Expression: MIT
Keywords: ascii,game,terminal,keyboard,tkinter
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Games/Entertainment
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: keyboard
Dynamic: license-file

Ascreen

Ascreen is a lightweight Python library for creating ASCII-style games with keyboard controls and a Tkinter-based screen.

Features

- ASCII game screen
- Custom text sprites
- Keyboard input
- Simple object positioning
- Easy-to-use API

Installation

Install the keyboard dependency:

py -m pip install keyboard

Place "ascreen.py" in your project folder.

Quick Start

import ascreen as n
import time

screen = n.create(50, 25)

screen.sprite("""
.@@@@..
@@@@@@@
.0...0.
""", "face")

x, y = 0, 0

while screen.running:
    if n.pressed("w") and y > 0:
        y -= 1
    if n.pressed("s") and y < 22:
        y += 1
    if n.pressed("a") and x > 0:
        x -= 1
    if n.pressed("d") and x < 42:
        x += 1

    screen.clear()
    screen("face", x, y)
    screen.draw()

    time.sleep(0.05)

screen.close()

Keyboard Functions

Function| Description
"n.pressed(key)"| Check whether a key is pressed
"n.press(key)"| Press a key programmatically
"n.release(key)"| Release a key
"n.hotkey(keys, callback)"| Run a callback when a hotkey is pressed
"n.wait(key)"| Wait for a key press

Screen Functions

Function| Description
"n.create(width, height)"| Create a screen
"screen.sprite(art, name)"| Register a sprite
"screen(x, y, char)"| Draw a character
"screen("name", x, y)"| Draw a registered sprite
"screen.draw()"| Render the screen
"screen.clear()"| Clear the current frame
"screen.close()"| Close the screen

Sprite Format

.@@@.
@...@
.@@@.

- "." represents a transparent character.
- Other characters are drawn on the screen.
- Sprites are positioned using their top-left coordinates.
- Objects drawn later can overwrite earlier objects.

Requirements

- Python 3.9+
- Tkinter
- "keyboard"

Project Structure

my_game/
├── main.py
└── ascreen.py

License

MIT License — see the "LICENSE" file.

Author: Nurasyl
