a simple python library used to draw text-based 2d grid game map and informations
Project description
About Rotom
rotom is a simple tui library used to draw tilemap and some informations on terminal.
Fast Usage
from rotem import *
tilemap = Tilemap() # default size is (5, 5)
print(tilemap)
this will output
· · · · ·
· · · · ·
· · · · ·
· · · · ·
· · · · ·
and you can set character for each point
tilemap = Tilemap()
tilemap.set_char(0, 0, '@')
print(tilemap)
and you will get something like below:
@ · · · ·
· · · · ·
· · · · ·
· · · · ·
· · · · ·
you can set color, background color, bold and underline to style the char like this:
tilemap = Tilemap(10, 10)
tilemap.set_char(0, 0, '@', color="#942c4b", bold=True, underline=True)
print(tilemap)
you will get something like this (the result in markdown file should be the same because this only work in terminal):
@ · · · ·
· · · · ·
· · · · ·
· · · · ·
· · · · ·
and you can add a border for it
tilemap = Tilemap(5, 5)
print(add_border(tilemap()))
you will get something like this:
┌───────────┐
│ · · · · · │
│ · · · · · │
│ · · · · · │
│ · · · · · │
│ · · · · · │
└───────────┘
except the game map, rotom provide tool to render informations.
tilemap = Tilemap(8, 8)
tilemap.set_char(5, 5, '@')
infos = InfoBoard()
infos.set_info("title", "content")
result = horizontal_combine(tilemap(), infos(), sep=' ')
print(result)
this will output:
· · · · · · · · +--------------------------------+
· · · · · · · · | title: content |
· · · · · · · · +--------------------------------+
· · · · · · · ·
· · · · · · · ·
· · · · · @ · ·
· · · · · · · ·
· · · · · · · ·
I use horizontal_combine to combine two string, but also can be combined as vertical.
result = vertical_combine(tilemap(), infos(), sep='/')
print(result)
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · · · ·
· · · · · @ · ·
· · · · · · · ·
· · · · · · · ·
//////////////////////////////////
+--------------------------------+
| title: content |
+--------------------------------+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rotem-0.1.1.tar.gz.
File metadata
- Download URL: rotem-0.1.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4df2d2a107e2d6650070a9b54d8cd63dc7cc6c226f8ca76da1c72d7bcd13141e
|
|
| MD5 |
eb748102664cbd39e445c2834d5a7b23
|
|
| BLAKE2b-256 |
925da07b1e5fe9b9dd05ad5e845c1d10d36f1521769cef2d463f8d0ef4b77b9d
|
File details
Details for the file rotem-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rotem-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cab67e83edf9bdd271255f300edc5a226fef6aac43ed844f34afd85423971c2
|
|
| MD5 |
3554f6839a87bc19d7cf4f5d0294ea32
|
|
| BLAKE2b-256 |
87f95b72f8f341933df4ceb64bc83948049015ed065da8428deb7f0ad1f04314
|