defragster
Senior Member+
...
Declaring it as uint16_t will let it hold any value 0-65535. Any place that uses those stored values will need the same change.
Yes, you are learning! - the practical upshot of the underlined note is exactly as you show below! The Compiler will make note of any you miss, but that is what is needed. The stored data is still as it was - but the 'pointers / indexes / identifiers' whatever you want to call them need to be able to run from 0 toward 300 and it takes at least 16 bits to do that.
Note: You show two changed functions - I don't see 'before and after' so I'm not sure which once were changed. if it were me I'd make the initial change "const uint16_t tilemap[] " and then compile one time and scan the error/warning list in the compile output - it will tell you which ones need to be changed.
ok before I start running in circles trying to correct every thing, I would like to ask for a clarification......
if I change
Code:const byte tilemap[] = {
to
Code:const uint16_t tilemap[] = {
I will then need to go into my library and find the tilemap functions and change the uint8_t to uint16_t like so.....
Code:void drawTilemap(int x, int y, const uint16_t *tilemap, const uint8_t **spritesheet, const uint16_t * palette); void drawTilemap(int x, int y, const uint16_t *tilemap, const uint8_t **spritesheet, uint16_t dx, uint16_t dy, uint16_t dw, uint16_t dh, const uint16_t * palette);