Understanding the language, error messages, etc.
by Duhjoker » Sun May 28, 2017 2:40 am
I'm a slow typer and I had to debug but heres what I get......
- Code: Select all
void drawTilemap2(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint16_t color);
and
- Code: Select all
void Grafx_esp::drawTilemap2(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint16_t color) {
for (unsigned int y = 0; y <15;y++){
for (unsigned int x = 0; y <20;x++){
int tile = pgm_read_byte(data + (x + y* ));
drawBitmap1(x * 16, y * 16, tile, color);
}
}
}
- Code: Select all
Arduino: 1.8.1 (Windows 10), TD: 1.36, Board: "ESP32 Dev Module, 80MHz, 921600, None"
WARNING: library SPI claims to run on [esp32] architecture(s) and may be incompatible with your current board which runs on [Esp32] architecture(s).
In file included from C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/WString.h:29:0,
from C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/Arduino.h:149,
from C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.h:66,
from C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:50:
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp: In member function 'void Grafx_esp::drawTilemap2(int, int, const uint8_t*, const uint8_t**, uint16_t)':
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1191:27: error: 'data' was not declared in this scope
int tile = pgm_read_byte(data + (x + y* ));
^
C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/pgmspace.h:41:57: note: in definition of macro 'pgm_read_byte'
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1191:42: error: expected primary-expression before ')' token
int tile = pgm_read_byte(data + (x + y* ));
^
C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/pgmspace.h:41:57: note: in definition of macro 'pgm_read_byte'
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1192:41: error: no matching function for call to 'Grafx_esp::drawBitmap1(unsigned int, unsigned int, int&, uint16_t&)'
drawBitmap1(x * 16, y * 16, tile, color);
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1046:6: note: candidate: void Grafx_esp::drawBitmap1(int16_t, int16_t, const uint8_t*, int16_t, int16_t, uint16_t)
void Grafx_esp::drawBitmap1(int16_t x, int16_t y,
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1046:6: note: candidate expects 6 arguments, 4 provided
exit status 1
Error compiling for board ESP32 Dev Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
When you say pass no arguments do you mean leave the () empty?
Last edited by
Duhjoker on Sun May 28, 2017 2:42 am, edited 1 time in total.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by awesome101 » Sun May 28, 2017 2:42 am
data should be tilemap_black
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:42 am
Change data to tilemap_black!!
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:45 am
Copy and paste this into whichever file the drawTilemap function is in:
void Grafx_esp::drawTilemap() {
for(unsigned int y = 0; y < 15; y++) {
for(unsigned int x = 0; x < 20; x++) {
int tile = pgm_read_byte(tilemap_black + (x + y * 20));
drawBitmap(x * 16, y * 16, tile);
}
}
Then in your test sketch call the function like this: drawBitmap();
With nothing between the parenthesis
Last edited by
awesome101 on Sun May 28, 2017 2:48 am, edited 1 time in total.
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:47 am
And comment all the other drawTilemap functions for now
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:49 am
Did it work??
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:53 am
Wait that's wrong do this
void Grafx_esp::drawTilemap(const uint8_t **spritesheet)
for(unsigned int y = 0; y < 15; y++) {
for(unsigned int x = 0; x < 20; x++) {
int tile = pgm_read_byte(tilemap_black + (x + y * 20));
drawBitmap(x * 16, y * 16, spritesheet[tile], 16, 16, BLACK);
}
}
Last edited by
awesome101 on Sun May 28, 2017 2:56 am, edited 1 time in total.
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by Duhjoker » Sun May 28, 2017 2:56 am
ok I changed data to the name of the tilemap I want to draw but its giving bitmap errors because it needs w and h. I tried adding but I get errors.
also giving me pgm_read_byte errors that I have to fix as well so I'm trying to figure out why its giving those errors
- Code: Select all
void Grafx_esp::drawTilemap2(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint16_t color) {
for (unsigned int y = 0; y <15;y++){
for (unsigned int x = 0; y <20;x++){
int tile = pgm_read_byte(tilemap2 + (x + y* 20 ));
drawBitmap1(x * 16, y * 16, tile, color);
}
}
}
- Code: Select all
Arduino: 1.8.1 (Windows 10), TD: 1.36, Board: "ESP32 Dev Module, 80MHz, 921600, None"
WARNING: library SPI claims to run on [esp32] architecture(s) and may be incompatible with your current board which runs on [Esp32] architecture(s).
In file included from C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/WString.h:29:0,
from C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/Arduino.h:149,
from C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.h:66,
from C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:50:
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp: In member function 'void Grafx_esp::drawTilemap2(int, int, const uint8_t*, const uint8_t**, uint16_t)':
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1191:27: error: 'tilemap2' was not declared in this scope
int tile = pgm_read_byte(tilemap2 + (x + y* ));
^
C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/pgmspace.h:41:57: note: in definition of macro 'pgm_read_byte'
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1191:46: error: expected primary-expression before ')' token
int tile = pgm_read_byte(tilemap2 + (x + y* ));
^
C:\Users\chuck\OneDrive\Documents\Arduino\hardware\espressif\Esp32\cores\esp32/pgmspace.h:41:57: note: in definition of macro 'pgm_read_byte'
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1192:30: error: 'w' was not declared in this scope
drawBitmap1(x * 16, y * 16, w * 16, h * 16, tile, color);
^
C:\Users\chuck\OneDrive\Documents\Arduino\libraries\GameRIot_ESP\Grafx_esp.cpp:1192:38: error: 'h' was not declared in this scope
drawBitmap1(x * 16, y * 16, w * 16, h * 16, tile, color);
^
exit status 1
Error compiling for board ESP32 Dev Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by awesome101 » Sun May 28, 2017 2:57 am
Copy and paste what I posted just now and try that
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
by awesome101 » Sun May 28, 2017 2:59 am
Then in your test sketch call the function like this: drawTilemap(spritesheet1);
-
awesome101
-
- Posts: 159
- Joined: Sat Jun 20, 2015 6:56 pm
Return to Programming Questions
Who is online
Users browsing this forum: No registered users and 1 guest