Improve sprite detection
Opened this issue · 1 comments
Improve detection of sprite dimensions in the editor.
-
Add support for inline (non-commented-out) sprite sizes:
PROGMEM const unsigned char sprite[] = { 5,5, 0x00, 0x00, 0x00, 0x00, 0x00 };
(check for decimal integers in first two bytes, check if the rest of the bytes checks out length-wise with the hint, and if yes, use as dimensions hint but discard first two bytes while creating the pixel bitmap)
-
Add support for sizing multi-frame sprites properly:
PROGMEM const unsigned char sprite[] = { // width, height 6, 8, // frame 0 0x38, 0x38, ... // frame 1 0x00, 0x00, ... };
(initially, just make sure these work, later add animation/frame-by-frame editing in sprite editor)
-
Add frame support and frame-by-frame editing for multiframe sprite data in the sprite editor
(see above) -
Add UI in the code editor to manually specify/adjust the detected dimensions of a sprite without altering its actual source code.
_(possibly store these hints int permanent storage and re-load them once files are reopened, key by environment - filename, declaration signature etc.) -
Add binary constant support (these formats also usually hint at sprite dimensions):
PROGMEM const unsigned char sprite[] = { 0b00011100, ... 0b00011100, };
-
Improve sprite dimension detection for unhinted images by trying to guess from usage
(search source code, and try to finddrawImage
commands/similar patterns that use the defined image and specify image dimensions) -
Further improve declaration parser
static PROGMEM const byte title_sprites[64 * 2 * 3] = { ... }
Accept
static
, also bothunsigned char
andbyte
, ignore length specifier between the brackets (or maybe use it for sprite hinting)The PROGMEM pragma could be all over the place, like after the variable name:
extern const unsigned short data[] PROGMEM = { ... };
Also there might be a space before the
[]
specifier:const unsigned short data [] ...
static PROGMEM const byte title_sprites[64 * 2 * 3] = { ... }
The above image sprite is 64 x ( 2_3_(8) ) = /*64x48*/
in dimensions. 64 could be used to guess the width, then the rest can be calculated from byte_count / 64 * 8
.