mirror of https://git.sr.ht/~kikoodx/sle
Feature: middle click in editor to pick a tile
Updated the README in consequence.
This commit is contained in:
parent
c5a202a6f6
commit
023ff12cb9
8
README
8
README
|
@ -3,7 +3,8 @@ SLE
|
|||
A simple project oriented single screen tilebased level editor.
|
||||
|
||||
SLE read and write KBLE level files.
|
||||
=> https://git.sr.ht/~kikoodx/kble
|
||||
KBLE format specifications:
|
||||
=> https://git.sr.ht/~kikoodx/kble/tree/dev/item/kbleformat.md
|
||||
|
||||
COMPILATION
|
||||
===========
|
||||
|
@ -34,6 +35,7 @@ Main window - Editing Area
|
|||
--------------------------
|
||||
Left click: draw with selected tile
|
||||
Right click: erase (tile 0)
|
||||
Middle click: pick a tile
|
||||
|
||||
Secondary window - Tile Picker
|
||||
------------------------------
|
||||
|
@ -50,8 +52,8 @@ FLAGS
|
|||
Mandatory flags
|
||||
---------------
|
||||
All these options take a path to a file as argument.
|
||||
-tileset Tileset image
|
||||
-level KBLE file
|
||||
-tileset : tileset image
|
||||
-level : KBLE file
|
||||
|
||||
Optional flags
|
||||
--------------
|
||||
|
|
|
@ -18,10 +18,13 @@ void level_draw(struct Level level, struct Options options,
|
|||
/* if tile index is out of bound, skip */
|
||||
if (tile_index >= level.width * level.height)
|
||||
continue;
|
||||
const Tile tile = level.data[tile_index] - options.tile_first;
|
||||
const Tile tile =
|
||||
level.data[tile_index] - options.tile_first;
|
||||
/* if tile is not in tileset, skip */
|
||||
if (tile < 0 || (!tile && !options.tile_first) || tile >= options.tileset_width *
|
||||
options.tileset_height)
|
||||
if (tile < 0 ||
|
||||
(!tile && !options.tile_first) ||
|
||||
tile >= options.tileset_width *
|
||||
options.tileset_height)
|
||||
continue;
|
||||
|
||||
const Rectangle tile_rect = {
|
||||
|
|
|
@ -108,17 +108,17 @@ static void update_mouse(int *mouse_x, int *mouse_y, struct Level level,
|
|||
level.height - 1);
|
||||
|
||||
/* set tile */
|
||||
if (left_click) {
|
||||
if (left_click)
|
||||
level.data[*mouse_x + *mouse_y * level.width] =
|
||||
shared_data->selected_tile;
|
||||
}
|
||||
/* remove tile */
|
||||
if (right_click) {
|
||||
if (right_click)
|
||||
level.data[*mouse_x + *mouse_y * level.width] = 0;
|
||||
}
|
||||
/* get info about tile */
|
||||
/* set tile to pointed cell (pick tile) */
|
||||
if (middle_click) {
|
||||
INFO_VAR("%d",
|
||||
level.data[*mouse_x + *mouse_y * level.width]);
|
||||
shared_data->selected_tile =
|
||||
level.data[*mouse_x + *mouse_y * level.width];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue