Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
img2tile [2020/08/31 23:59] spotlessmind1975 [MULTIPLE IMAGES] |
img2tile [2020/09/01 08:44] spotlessmind1975 [PREPARING IMAGES] |
===== INTRODUCTION ===== | ===== INTRODUCTION ===== |
| |
This page does not want to replace the software user manual (for that there is the [[https://github.com/spotlessmind1975/img2tile/blob/master/README.md|README]]) but to provide some indications on its operation, as well as to explain some of the algorithms used. | This page does not want to replace ''[[https://github.com/spotlessmind1975/img2tile|img2tile]]'' user manual (for that there is the [[https://github.com/spotlessmind1975/img2tile/blob/master/README.md|README]]) but to provide some indications on its operation, as well as to explain some of the algorithms used. It give, also, an example using the [[:midres_library|midres library]] primitives. |
| |
{{ ::diagrammi-img2tile.png?nolink&600 |}} | {{ ::diagrammi-img2tile.png?nolink&600 |}} |
| |
| ===== PREPARING IMAGES ===== |
| |
| {{ ::img2tile-gimp.jpg?nolink&600 |}} |
| |
| Images can be prepared with any photo editing program, such as [[https://www.gimp.org/|GIMP]]. The images must be the size of a tile (8x8 pixels) or a multiple of a single tile (i.e. 32x24 pixel, 64x64 pixel, and so on). Although the program can read many graphic formats, the most accurate results are obtained by using two highly contrasted colors (black / white) and saving using the PNG format at RGB (24 bit) |
| |
===== SMALL TILES ===== | ===== SMALL TILES ===== |
img2tile -i airplane.png -o tiles.bin | img2tile -i airplane.png -o tiles.bin |
| |
| \adsense\ |
===== MULTIPLE IMAGES ===== | ===== MULTIPLE IMAGES ===== |
| |
| |
img2tile -i airplane.png -i bomb.png -g header_tiles.h -o tiles.bin | img2tile -i airplane.png -i bomb.png -g header_tiles.h -o tiles.bin |
| |
| ===== A SIMPLE PROGRAM ===== |
| |
| This simple program loads all tiles prepared with the last ''img2tile'' command, and it draws a yellow bomb at the center of the default screen: |
| |
| #include "midres.h" |
| #include "header_tiles.h" |
| |
| mr_tileset_load("tiles.bin", MR_TILESET_0, TILE_START, TILE_COUNT); |
| mr_tileset_visible(MR_TILESET_0); |
| mr_puttile(MR_SCREEN_DEFAULT, MR_SCREEN_WIDTH >> 1, MR_SCREEN_HEIGHT >> 1, TILE_BOMB, MR_COLOR_YELLOW); |
| |
| |