Skip to content

Commit 6182296

Browse files
committed
Update README with installation and usage info
1 parent 8344765 commit 6182296

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

README.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,68 @@
1-
![pyrexpaint-logo](https://user-images.githubusercontent.com/9204112/150735182-551ebe2d-882e-4c46-ab44-1dcbc7cb9751.PNG)
1+
![pyrexpaint-logo](https://user-images.githubusercontent.com/9204112/150735182-551ebe2d-882e-4c46-ab44-1dcbc7cb9751.PNG)
2+
3+
4+
# Details
5+
`pyrexpaint` is a small API for loading .xp files into python programs. So small, there is a single function provided called `load`.
6+
7+
An .xp file is the custom binary format used by the ASCII art editor [REXPaint](https://www.gridsagegames.com/rexpaint/index.html).
8+
9+
10+
# Installation
11+
12+
13+
```
14+
pip install pyrexpaint
15+
```
16+
17+
or install from source:
18+
19+
```
20+
git clone https://github.com/mattlink/pyrexpaint
21+
```
22+
```
23+
pip install ./pyrexpaint
24+
```
25+
26+
# Usage
27+
28+
Say you have an .xp file `hello.xp` in the same directory as your program, it can be loaded using:
29+
```
30+
import pyrexpaint
31+
image_layers = pyrexpaint.load("hello.xp")
32+
```
33+
34+
The data structure returned by `load` is as follows:
35+
```
36+
37+
@dataclass
38+
class Tile:
39+
ascii_code: str
40+
fg_r: str
41+
fg_g: str
42+
fg_b: str
43+
bg_r: str
44+
bg_g: str
45+
bg_b: str
46+
47+
48+
@dataclass
49+
class ImageLayer:
50+
width: int
51+
height: int
52+
tiles: List[Tile]
53+
54+
55+
def load(file_name: str) -> List[ImageLayer]:
56+
...
57+
```
58+
59+
60+
## Run the Ncurses Example:
61+
62+
```
63+
cd ./pyrexpaint/examples
64+
```
65+
```
66+
python hello-ncurses.py
67+
```
68+

0 commit comments

Comments
 (0)