ok so ive been building a library for gamesystem that will allow any one to write and play their own games. I was hung up on the drawbitmap functions along with the tilemap functions but ive since then completed that part and a whole lot more and I seem to be stuck at something ive never dealt with.
its giving me problems with pgmspace.h in teensy. I looked at the file and it looks right but the weird thing is that I cant find the regular arduino version on my computer. do I need to download the regular arduino version?
here are the actual errors....
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:11:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,
from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolor\Sound.h:23,
from C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolor\Sound.cpp:20:
C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolor\Sound.cpp: In member function 'void Sound::updateTrack(uint8_t)':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:80:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
^
C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolor\Sound.cpp:124:32: note: in expansion of macro 'pgm_read_word'
playPattern((const uint16_t*)pgm_read_word(&(patternSet[channel][patternID])), channel);
^
C:\Users\duhjoker\Documents\Arduino\libraries\gamebuinoduhjokercolor\Sound.cpp: In member function 'void Sound::command(uint8_t, uint8_t, int8_t, uint8_t)':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:80:61: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
heres the bit of code it refers to
int8_t Gamebuino::menu(const char* const* items, uint8_t length) {
#if (ENABLE_GUI > 0)
display.persistence = false;
int8_t activeItem = 0;
int8_t currentY = LCDHEIGHT;
int8_t targetY = 0;
boolean exit = false;
int8_t answer = -1;
while (1) {
if (update()) {
if (buttons.pressed(BTN_A) || buttons.pressed(BTN_B) || buttons.pressed(BTN_C)) {
exit = true; //time to exit menu !
targetY = - display.fontHeight * length - 2; //send the menu out of the screen
if (buttons.pressed(BTN_A)) {
answer = activeItem;
sound.playOK();
} else {
sound.playCancel();
}
}
if (exit == false) {
if (buttons.repeat(BTN_DOWN,4)) {
activeItem++;
sound.playTick();
}
if (buttons.repeat(BTN_UP,4)) {
activeItem--;
sound.playTick();
}
//don't go out of the menu
if (activeItem == length) activeItem = 0;
if (activeItem < 0) activeItem = length - 1;
targetY = -display.fontHeight * activeItem + (display.fontHeight+4); //center the menu on the active item
} else { //exit :
if ((currentY - targetY) <= 1)
return (answer);
}
//draw a fancy menu
currentY = (currentY + targetY) / 2;
display.cursorX = 0;
display.cursorY = currentY;
display.fontSize = 1;
display.textWrap = false;
for (byte i = 0; i < length; i++) {
if (i == activeItem){
display.cursorX = 3;
display.cursorY = currentY + display.fontHeight * activeItem;
}
display.println((const __FlashStringHelper*)pgm_read_word(items+i));
}
//display.fillRect(0, currentY + 3 + 8 * activeItem, 2, 2, BLACK);
//display.setColor(WHITE); //color UNSET BY DUHJOKER
display.drawFastHLine(0, currentY + display.fontHeight * activeItem - 1, LCDWIDTH, WHITE); //DUHJOKER
//display.setColor(BLACK); //color UNSET BY DUHJOKER
display.drawRoundRect(0, currentY + display.fontHeight * activeItem - 2, LCDWIDTH, (display.fontHeight+3), 3, BLACK); //DUHJOKER
}
}
#else
return 0;
#endif
}
the working sketch is included in the file