Skip to content

Commit f758e9d

Browse files
committed
first commit!
0 parents  commit f758e9d

30 files changed

+19813
-0
lines changed

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Intellij
2+
.idea/**/workspace.xml
3+
.idea/**/tasks.xml
4+
.idea/**/encodings.xml
5+
.idea/**/compiler.xml
6+
.idea/**/misc.xml
7+
.idea/**/modules.xml
8+
.idea/**/vcs.xml
9+
10+
## VSCode
11+
.vscode/
12+
13+
## File-based project format:
14+
*.iws
15+
*.iml
16+
.idea/
17+
18+
# Binaries for programs and plugins
19+
*.exe
20+
*.exe~
21+
*.dll
22+
*.so
23+
*.dylib
24+
*.dat
25+
*.DS_Store
26+
go.sum
27+
28+
# Test binary, built with `go test -c`
29+
*.test
30+
31+
# Output of the go coverage tool, specifically when used with LiteIDE
32+
*.out
33+
34+
# Goreleaser builds
35+
**/dist/**
36+
37+
icons/**

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [0.1.0] - 2020-08-28
8+
- 🎉 First release!

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Luca Sepe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
2+
# **Tiles**
3+
4+
> Commandline tool that makes building tilesets and rendering static tilemaps super easy!
5+
6+
**Features**
7+
8+
- create your own tilesets _"libraries"_ (ready to reuse)
9+
- inspect, list and extract tiles from tilesets
10+
- define a tilemap using one or more tileset
11+
- render a tilemap as PNG images
12+
- eventually add a watermark to the tilemap
13+
14+
![](./banner.png)
15+
16+
### Overview
17+
18+
Tilemaps are a very popular technique in 2D game development, consisting of building the game world or level map out of small, regular-shaped images called tiles.
19+
20+
The most efficient way to store the tile images is in an atlas or tileset
21+
22+
- all of the required tiles grouped together in a single image file
23+
24+
When it's time to draw a tile, only a small section of this bigger image is rendered on the grid.
25+
26+
#### Static square tilemaps
27+
28+
Square-based tilemaps are the most simple implementation for two perspectives:
29+
30+
- top-down (like many RPG's or strategy games)
31+
- side-view (like platformers such as Super Mario Bros)
32+
- architecture diagrams...why not!? 😏
33+
34+
# How to use **tiles**
35+
36+
## All available commands
37+
38+
```bash
39+
tiles --help
40+
```
41+
42+
## Generate a tileset
43+
44+
Let's say you have all your PNG images (square in size, 96x96 for example) in one folder and you want to create a new tileset:
45+
46+
```bash
47+
tiles compose /path/to/png/images/
48+
```
49+
50+
By default the generated tileset (it's a YAML) is printed on the terminal. If you want to save the result to a file you can redirect `>` the output:
51+
52+
```bash
53+
tiles compose /path/to/png/images/ > my_tileset.yml
54+
```
55+
56+
### Ready-To-Use tilesets
57+
58+
| Set | URL |
59+
|:-----------------------|:---------------------------------------------------------|
60+
| AWS Icons | [./examples/aws_tileset.yml](./examples/aws_tileset.yml) |
61+
| Arrows and Connectors | [./examples/links_tileset.yml](./examples/links_tileset.yml) |
62+
63+
64+
## Lists all tiles identifiers contained in the specified tilset
65+
66+
```bash
67+
tiles list /path/to/my_tileset.yml
68+
```
69+
70+
## Extracts the tile PNG with the specified identifier from the tileset
71+
72+
```bash
73+
tiles pull --id aws_waf ../examples/aws_tileset.yml
74+
```
75+
76+
By default the PNG data is dumped on the terminal. If you want to save the result to a file you can redirect `>` the output:
77+
78+
```bash
79+
tiles pull --id aws_waf ../examples/aws_tileset.yml > aws_waf.png
80+
```
81+
82+
## Rendering a static tilemap
83+
84+
The first step is to create the static tilemap using the following YAML syntax:
85+
86+
```yml
87+
# Nr. of Columns
88+
cols: 4
89+
# Nr. of Rows
90+
rows: 7
91+
# Tile size (Grid cell size)
92+
tile_size: 64
93+
# Canvas margin (optional)
94+
margin: 16
95+
# Canvas watermark (optional)
96+
watermark: Draft
97+
# Canvas background color (optional)
98+
bg_color: "#ffffff"
99+
# List of used tileset
100+
atlas_list:
101+
- ../examples/aws_tileset.yml
102+
- ../examples/links_tileset.yml
103+
# Tiles mapping (associate an index to each tile)
104+
mapping:
105+
1: aws_lambda
106+
2: aws_elastic_container_service
107+
3: aws_api_gateway
108+
4: aws_rds_mysql_instance
109+
5: aws_simple_storage_service_s3
110+
6: aws_elasticache_for_redis
111+
10: link_vertical
112+
11: link_vertical_arrow_up
113+
20: link_cross_arrow_left_up_down
114+
30: link_horizontal
115+
40: link_tee_right_arrow_up_down
116+
# Static map layout
117+
layout: >
118+
0,5,0,0
119+
4,20,30,2
120+
0,6,0,11
121+
0,0,0,10
122+
0,1,0,10
123+
0,40,30,3
124+
0,1,0,0,0
125+
```
126+
127+
👉 [examples/tilemap_demo_1.yml](./examples/tilemap_demo_1.yml).
128+
129+
Then execute the _'render'_ command:
130+
131+
```sh
132+
tiles render ./examples/tilemap_demo_1.yml > ./examples/tilemap_demo_1.png
133+
```
134+
135+
output:
136+
137+
![](./examples/tilemap_demo_1.png)
138+
139+
# Installation Steps
140+
141+
To build the binaries by yourself, assuming that you have Go installed, you need [GoReleaser](https://goreleaser.com/intro/).
142+
143+
Here the steps:
144+
145+
### Grab the source code
146+
147+
```bash
148+
git clone https://github.com/lucasepe/tiles.git
149+
```
150+
151+
### Change dir to the tool folder
152+
153+
```bash
154+
cd tiles/cli
155+
```
156+
157+
### Run GoReleaser
158+
159+
```bash
160+
goreleaser --rm-dist --snapshot --skip-publish
161+
```
162+
163+
you will found the binaries for:
164+
165+
- MacOS into the folder _dist/tiles_darwin_amd64/_
166+
- Linux into the folder _dist/tiles_linux_amd64/_
167+
- Windows into the folder _dist/tiles_windows_amd64/_
168+
169+
## Ready-To-Use Releases
170+
171+
If you don't want to compile the sourcecode yourself, [Here you can find the tool already compiled](https://github.com/lucasepe/tiles/releases/latest) for:
172+
173+
- MacOS
174+
- Linux
175+
- Windows
176+
177+
---
178+
179+
# CHANGE LOG
180+
181+
👉 [Record of all notable changes made to a project](./CHANGELOG.md)

banner.png

166 KB
Loading

0 commit comments

Comments
 (0)