Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/o-murphy/bcrg

Simple lua-based engine to generate dynamic ballistics reticles
https://github.com/o-murphy/bcrg

ballistics framebuf lua luascript python python3 reticles

Last synced: 3 days ago
JSON representation

Simple lua-based engine to generate dynamic ballistics reticles

Awesome Lists containing this project

README

        

# BCRG - Ballistic reticle generator
### Simple tool to generate dynamic ballistics reticles by .lua templates

## Installation
```bash
pip install bcrg
```

## Usage

### As CLI tool
```bash
python -m bcrg
usage: bcr [-h] [-o OUTPUT] [-W ] [-H ] [-cx ] [-cy ] [-z [ ...]] [-Z] file

positional arguments:
file Reticle template file in .lua format

options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output directory path, defaults to ./
-W , --width
Canvas width (px)
-H , --height
Canvas height (px)
-cx , --click-x
Horizontal click size (cm/100m)
-cy , --click-y
Vertical click size (cm/100m)
-z [ ...], --zoom [ ...]
Zoom value (int)
-Z, --zip Store as .zip

```

### As Imported module
```python
from bcrg import LuaReticleLoader
loader = LuaReticleLoader('my_reticle_template.lua')

# Create 1bit-depth .bmp bytearray
byte_stream = loader.make_bmp(640, 480, 2.27, 2.27, 4, None)
with open("myreticle.bmp", 'b') as f:
f.write(byte_stream)
```

[//]: # (# Create direct bytearray from lua framebuffer )

[//]: # (byte_stream = loader.make_buf(640, 480, 2.27, 2.27, 4, None))

### References
* A reticle template have to implement `make_reticle` function, that gets required arguments and have to return `self:to_bmp` or `self:to_bmp_1bit`
* Examples in ./templates dir