Skip to content

pyrexpaint is a python package for loading REXPaint .xp files

License

Notifications You must be signed in to change notification settings

mattlink/pyrexpaint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyrexpaint-logo

Details

pyrexpaint is a small API for loading .xp files into python programs. So small, there is a single function provided called load.

An .xp file is the custom binary format used by the ASCII art editor REXPaint.

Installation

pip install pyrexpaint

or install from source:

git clone https://github.com/mattlink/pyrexpaint
pip install ./pyrexpaint

Usage

Say you have an .xp file hello.xp in the same directory as your program, it can be loaded using:

import pyrexpaint
image_layers = pyrexpaint.load("hello.xp")

The data structure returned by load is as follows:


@dataclass
class Tile:
    ascii_code: str
    fg_r: str
    fg_g: str
    fg_b: str
    bg_r: str
    bg_g: str
    bg_b: str


@dataclass
class ImageLayer:
    width: int
    height: int
    tiles: List[Tile]


def load(file_name: str) -> List[ImageLayer]:
    ...

Run the Ncurses Example:

cd ./pyrexpaint/examples
python hello-ncurses.py

About

pyrexpaint is a python package for loading REXPaint .xp files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages