diff --git a/Gamby.cpp b/Gamby.cpp index 2eca9de..a077b39 100644 --- a/Gamby.cpp +++ b/Gamby.cpp @@ -254,7 +254,7 @@ void GambyBase::setColumn (byte column) { * @param icon: The icon's location in `PROGMEM` (e.g. the name of the * `PROGMEM` constant). */ -void GambyBase::drawIcon(const prog_uchar *icon) { +void GambyBase::drawIcon(const unsigned char *icon) { DATA_MODE(); byte w = pgm_read_byte_near(icon); currentColumn += w; @@ -271,7 +271,7 @@ void GambyBase::drawIcon(const prog_uchar *icon) { * `PROGMEM` constant). * @param frame The frame number, 0 to (total frames)-1 */ -void GambyBase::drawIcon(const prog_uchar *icon, byte frame) { +void GambyBase::drawIcon(const unsigned char *icon, byte frame) { DATA_MODE(); byte w = pgm_read_byte_near(icon); icon += w * frame; @@ -1112,7 +1112,7 @@ boolean GambyGraphicsMode::getPatternPixel (byte x, byte y) { * @param x The sprite's horizontal position * @param y The sprite's vertical position */ -void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite) { +void GambyGraphicsMode::drawSprite(byte x, byte y, const unsigned char *sprite) { byte w = pgm_read_byte_near(sprite); byte h = pgm_read_byte_near(++sprite); @@ -1143,7 +1143,7 @@ void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite) { * constant's name) * @param frame The frame number to draw (0 to (number of frames)-1) */ -void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite, byte frame) { +void GambyGraphicsMode::drawSprite(byte x, byte y, const unsigned char *sprite, byte frame) { unsigned int w = pgm_read_byte_near(sprite); unsigned int h = pgm_read_byte_near(++sprite); @@ -1185,7 +1185,7 @@ void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite, byt * @param mask: The address of the mask sprite in `PROGMEM` * (e.g. the constant's name) */ -void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite, const prog_uchar *mask) { +void GambyGraphicsMode::drawSprite(byte x, byte y, const unsigned char *sprite, const unsigned char *mask) { byte w = pgm_read_byte_near(sprite); byte h = pgm_read_byte_near(++sprite); @@ -1226,8 +1226,8 @@ void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite, con * @param maskFrame The mask image's frame number to draw * (0 to (number of frames)-1) */ -void GambyGraphicsMode::drawSprite(byte x, byte y, const prog_uchar *sprite, byte frame, - const prog_uchar *mask, byte maskFrame) { +void GambyGraphicsMode::drawSprite(byte x, byte y, const unsigned char *sprite, byte frame, + const unsigned char *mask, byte maskFrame) { byte w = pgm_read_byte_near(sprite); byte h = pgm_read_byte_near(++sprite); diff --git a/Gamby.h b/Gamby.h index 72d69dd..252daf2 100644 --- a/Gamby.h +++ b/Gamby.h @@ -226,8 +226,8 @@ class GambyBase { byte getCharBaseline(byte); int getTextWidth(char *); int getTextWidth_P(const char *); - void drawIcon(const prog_uchar *); - void drawIcon(const prog_uchar *, byte); + void drawIcon(const unsigned char *); + void drawIcon(const unsigned char *, byte); void drawChar(char); void print(char *); void print(long, uint8_t = 10); @@ -255,7 +255,7 @@ class GambyBase { static byte inputs; /**< The D-Pad and button states. Set by readInputs(). */ static byte textDraw; - const prog_int32_t* font; /**< The font to be used for drawing text, read from PROGMEM. */ + const int32_t* font; /**< The font to be used for drawing text, read from PROGMEM. */ // private: byte currentPage; @@ -307,7 +307,7 @@ class GambyBlockMode: public GambyBase { void update(); void update(byte, byte, byte, byte); - const prog_uint16_t* palette; /**< The palette of 16 4x4 pixel blocks */ + const uint16_t* palette; /**< The palette of 16 4x4 pixel blocks */ byte offscreen[NUM_BLOCK_COLUMNS][NUM_PAGES]; /**< The offscreen buffer, where the screen is stored before being drawn */ }; @@ -334,10 +334,10 @@ class GambyGraphicsMode: public GambyBase { void circle(int, int, int); void disc(int, int, int); - void drawSprite(byte, byte, const prog_uchar *); - void drawSprite(byte, byte, const prog_uchar *, const prog_uchar *); - void drawSprite(byte, byte, const prog_uchar *, byte); - void drawSprite(byte, byte, const prog_uchar *, byte, const prog_uchar *, byte); + void drawSprite(byte, byte, const unsigned char *); + void drawSprite(byte, byte, const unsigned char *, const unsigned char *); + void drawSprite(byte, byte, const unsigned char *, byte); + void drawSprite(byte, byte, const unsigned char *, byte, const unsigned char *, byte); void drawText(int, int, char *); void drawText_P(int, int, const char *); diff --git a/examples/FirstTest/FirstTest.ino b/examples/FirstTest/FirstTest.ino index a465780..b015f29 100644 --- a/examples/FirstTest/FirstTest.ino +++ b/examples/FirstTest/FirstTest.ino @@ -16,7 +16,7 @@ by David R. Stokes (gamby@logicalzero.com) 2012-08-14 // Splash screen graphics: 96 x 40 pixels. These are in the form of several // 8-pixel-high 'icons' the full width of the screen. -PROGMEM prog_uchar screen_logo_graphic_1[] = { +PROGMEM const unsigned char screen_logo_graphic_1[] = { 96, // Width (full screen) 0xf0, 0x18, 0x8c, 0x44, 0xa4, 0x54, 0x24, 0x54, 0x24, 0x54, 0x24, 0x54, 0x24, 0x54, 0x24, 0x54, 0x24, 0x8c, 0xf8, 0xf8, 0x8c, 0x04, 0x24, 0x54, @@ -30,7 +30,7 @@ PROGMEM prog_uchar screen_logo_graphic_1[] = { }; -PROGMEM prog_uchar screen_logo_graphic_2[] = { +PROGMEM const unsigned char screen_logo_graphic_2[] = { 96, 0xff, 0x00, 0xaa, 0x55, 0xaa, 0x55, 0x00, 0xff, 0xc7, 0x93, 0xab, 0x93, 0xab, 0x13, 0xab, 0x53, 0xa3, 0x07, 0xff, 0xff, 0x07, 0x53, 0xab, 0x53, @@ -43,7 +43,7 @@ PROGMEM prog_uchar screen_logo_graphic_2[] = { 0xff, 0xff }; -PROGMEM prog_uchar screen_logo_graphic_3[] = { +PROGMEM const unsigned char screen_logo_graphic_3[] = { 96, 0x3f, 0xe0, 0xca, 0xd5, 0xca, 0xd5, 0xc8, 0xd5, 0xc9, 0xd5, 0xc9, 0xd5, 0xc9, 0xd4, 0xca, 0xd5, 0xca, 0xe0, 0xff, 0xff, 0xe0, 0xc5, 0xca, 0xd5, @@ -56,7 +56,7 @@ PROGMEM prog_uchar screen_logo_graphic_3[] = { 0xff, 0xff }; -PROGMEM prog_uchar screen_logo_graphic_4[] = { +PROGMEM const unsigned char screen_logo_graphic_4[] = { 96, 0x1f, 0x31, 0x20, 0x24, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, 0x6a, 0x64, @@ -69,7 +69,7 @@ PROGMEM prog_uchar screen_logo_graphic_4[] = { 0x01, 0x00 }; -PROGMEM prog_uchar screen_logo_text[] = { +PROGMEM const unsigned char screen_logo_text[] = { 96, 0x00, 0x3c, 0x0a, 0x0a, 0x3c, 0x00, 0x3e, 0x0a, 0x1a, 0x24, 0x00, 0x3e, 0x22, 0x22, 0x1c, 0x00, 0x1e, 0x20, 0x20, 0x1e, 0x00, 0x3e, diff --git a/examples/GambyGraphicsMode/AnimatedSprites/AnimatedSprites.ino b/examples/GambyGraphicsMode/AnimatedSprites/AnimatedSprites.ino index 0ac67d0..46b8411 100644 --- a/examples/GambyGraphicsMode/AnimatedSprites/AnimatedSprites.ino +++ b/examples/GambyGraphicsMode/AnimatedSprites/AnimatedSprites.ino @@ -18,7 +18,7 @@ by David R. Stokes (gamby@logicalzero.com) 2012-08-28 // Two spinning balls, each with 4 frames of animation. // The first two numbers are the dimensions, the rest is the image data. -PROGMEM prog_uchar ball1[] = {16, 16, +PROGMEM const unsigned char ball1[] = {16, 16, // Frame 0 7, 224, 31, 248, 53, 252, 127, 158, 127, 106, 255, 21, 255, 195, 255, 9, 216, 255, 162, 255, 216, 255, 100, 254, 120, 242, 63, 4, 31, 24, 7, 224, @@ -33,7 +33,7 @@ PROGMEM prog_uchar ball1[] = {16, 16, 210, 255, 172, 255, 240, 249, 127, 2, 127, 2, 63, 4, 31, 24, 7, 224 }; -PROGMEM prog_uchar ball2[] = {16, 16, // width and height +PROGMEM const unsigned char ball2[] = {16, 16, // width and height // Frame 0 7, 224, 31, 248, 63, 252, 127, 126, 127, 214, 253, 43, 250, 213, 255, 3, 213, 171, 248, 85, 214, 171, 104, 86, 122, 162, 53, 4, 26, 24, 7, 224, @@ -52,13 +52,13 @@ PROGMEM prog_uchar ball2[] = {16, 16, // width and height // out the entire square, which would cause one ball to clip the other if // they got too close. It is only a single frame; the shape of the ball does // not change as it animates. -PROGMEM prog_uchar ballMask[] = {16, 16, +PROGMEM const unsigned char ballMask[] = {16, 16, 7, 224, 31, 248, 63, 252, 127, 254, 127, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 254, 127, 254, 63, 252, 31, 248, 7, 224 }; // An 'eraser' sprite, which is all white. It is also only a single frame. -PROGMEM prog_uchar ballEraser[] = {16, 16, +PROGMEM const unsigned char ballEraser[] = {16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -175,4 +175,3 @@ void loop() { nextRead = now + readInputTime; } } - diff --git a/examples/GambyGraphicsMode/GambyGraphics_SpeedTest/GambyGraphics_SpeedTest.ino b/examples/GambyGraphicsMode/GambyGraphics_SpeedTest/GambyGraphics_SpeedTest.ino index ed9549c..e920a84 100644 --- a/examples/GambyGraphicsMode/GambyGraphics_SpeedTest/GambyGraphics_SpeedTest.ino +++ b/examples/GambyGraphicsMode/GambyGraphics_SpeedTest/GambyGraphics_SpeedTest.ino @@ -13,12 +13,12 @@ David R. Stokes (gamby@logicalzero.com) 9/11/2012 #include #include -const prog_uchar smiley8x8[] PROGMEM = { +const unsigned char smiley8x8[] PROGMEM = { 8, 8, 0x3c, 0x42, 0xad, 0xa1, 0xad, 0x91, 0x42, 0x3c }; -const prog_uchar smiley8x8_mask[] PROGMEM = { +const unsigned char smiley8x8_mask[] PROGMEM = { 8, 8, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x3c }; @@ -229,7 +229,7 @@ unsigned long randomRects() { } -unsigned long drawSpriteGrid(const prog_uchar *spriteIdx) { +unsigned long drawSpriteGrid(const unsigned char *spriteIdx) { gamby.drawPattern = PATTERN_GRAY; gamby.rect(0,0,NUM_COLUMNS-1, NUM_ROWS-1); Serial.print("Sprite grid, plain:\t"); @@ -246,7 +246,7 @@ unsigned long drawSpriteGrid(const prog_uchar *spriteIdx) { } -unsigned long drawSpriteGrid(const prog_uchar *spriteIdx, const prog_uchar *maskIdx) { +unsigned long drawSpriteGrid(const unsigned char *spriteIdx, const unsigned char *maskIdx) { gamby.drawPattern = PATTERN_GRAY; gamby.rect(0,0,NUM_COLUMNS-1, NUM_ROWS-1); Serial.print("Sprite grid, masked:\t"); @@ -261,4 +261,3 @@ unsigned long drawSpriteGrid(const prog_uchar *spriteIdx, const prog_uchar *mask Serial.println(startTime, DEC); return startTime; } - diff --git a/examples/GambyGraphicsMode/PatternFillDemo/PatternFillDemo.ino b/examples/GambyGraphicsMode/PatternFillDemo/PatternFillDemo.ino index 2cc17fc..175c952 100644 --- a/examples/GambyGraphicsMode/PatternFillDemo/PatternFillDemo.ino +++ b/examples/GambyGraphicsMode/PatternFillDemo/PatternFillDemo.ino @@ -74,5 +74,3 @@ void loop () { // circle outline. gamby.update(); } - - diff --git a/examples/Games/BlocDrop/BlocDrop.ino b/examples/Games/BlocDrop/BlocDrop.ino index bec320b..de29089 100644 --- a/examples/Games/BlocDrop/BlocDrop.ino +++ b/examples/Games/BlocDrop/BlocDrop.ino @@ -35,7 +35,7 @@ unsigned int pieces[7][4] = { // There is a duplicate of each block used for 'dropped' pieces (`n+8`); this // makes it easy to ignore the currently falling piece's blocks when testing // for collisions. -PROGMEM prog_uint16_t palette[] = { +PROGMEM const uint16_t palette[] = { 0x0000, // 0: Empty 0xf99f, // 1: Block 0 ("T") 0xadaf, // 2: Block 1 ("-") @@ -86,7 +86,7 @@ unsigned long lastInputTime; // The time at which gamby.readInputs() was last ca byte lastInputs; // The state of the inputs the last time they were checked. // Bring in the font from the other tab (font.ino) -extern prog_int32_t font[]; +extern const int32_t font[]; GambyBlockMode gamby; diff --git a/examples/Games/BlocDrop/font.ino b/examples/Games/BlocDrop/font.ino index 030be35..d04cf17 100644 --- a/examples/Games/BlocDrop/font.ino +++ b/examples/Games/BlocDrop/font.ino @@ -4,7 +4,7 @@ // bits 0-24: the character bitmap (by column) // bits 25-27: character vertical offset // bits 28-31: character width -PROGMEM prog_int32_t font[] = { +PROGMEM const int32_t font[] = { 0x00000002L, // character ' ' (32) 0xB8000001L, // character '!' (33) 0x18060003L, // character '"' (34) @@ -100,7 +100,5 @@ PROGMEM prog_int32_t font[] = { 0xD8000001L, // character '|' (124) 0x8FC80003L, // character '}' (125) 0x20882004L, // character '~' (126) - 0xFC631F85L, // character '' (127) + 0xFC631F85L, // character ' (127) }; - - diff --git a/examples/Games/BlocDrop/splashscreen.ino b/examples/Games/BlocDrop/splashscreen.ino index e7e9c5b..834b997 100644 --- a/examples/Games/BlocDrop/splashscreen.ino +++ b/examples/Games/BlocDrop/splashscreen.ino @@ -1,7 +1,7 @@ // The introductory 'splash screen' with the game's title. // It is stored as 8-pixel-high 'icons' the full width of the LCD with a // separate 'frame' for each piece of the larger image. -PROGMEM prog_uchar splashscreen[] = { +PROGMEM const unsigned char splashscreen[] = { 96, // Width // Row 0 ("frame" 0) 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 131, 131, 3, 3, @@ -57,7 +57,7 @@ PROGMEM prog_uchar splashscreen[] = { // The 'Game Over' message. Like the splash screen, it is a multi-frame 'icon', // with each 'frame' comprising an 8 pixel row of the image. Unlike the splash // screen, this is smaller than the screen; it only displays over the 'well'. -PROGMEM prog_uchar gameover[] = { +PROGMEM const unsigned char gameover[] = { // Width 48, // Row 0 ("frame" 0) diff --git a/examples/Games/Jewels/Jewels.ino b/examples/Games/Jewels/Jewels.ino index 63890b8..574fd38 100644 --- a/examples/Games/Jewels/Jewels.ino +++ b/examples/Games/Jewels/Jewels.ino @@ -200,7 +200,7 @@ Cursor cursor(board); // Score: deleting squares gains you points. unsigned score = 0; -void blit_inverted(prog_uchar *icon) +void blit_inverted(const unsigned char *icon) { DATA_MODE(); byte length = pgm_read_byte_near(icon); @@ -216,7 +216,7 @@ void draw_board() for (unsigned y = 0; y < board.height; y++) { // We might get called in the middle of a run-deletion operation, so we have to // be careful about masking out the run mark. - prog_uchar *icon = get_jewel(board.tile(x, y).jewel()); + const unsigned char *icon = get_jewel(board.tile(x, y).jewel()); gamby.setPos(x * kColumnPixels, y); bool inverted = false; inverted |= cursor.blink().state() && cursor.Equals(x, y); @@ -330,8 +330,8 @@ void animate_swap_horizontal(byte leftX, byte bothY, bool holdHighlight) { // We are exchanging the tile at leftX,bothY with the tile at leftX+1,bothY. // Do a cute little animation thingy where the two tiles switch places. - prog_uchar *left_icon = get_jewel(board.tile(leftX, bothY).jewel()); - prog_uchar *right_icon = get_jewel(board.tile(leftX+1, bothY).jewel()); + const unsigned char *left_icon = get_jewel(board.tile(leftX, bothY).jewel()); + const unsigned char *right_icon = get_jewel(board.tile(leftX+1, bothY).jewel()); byte local_left[16]; for (unsigned i = 0; i < 8; i++) { local_left[i] = pgm_read_byte_near(left_icon + i + 1); @@ -361,8 +361,8 @@ void animate_swap_horizontal(byte leftX, byte bothY, bool holdHighlight) void animate_swap_vertical(byte bothX, byte topY, bool holdHighlight) { // Exchange the tile at bothX, topY with the tile at bothX, topY+1. - prog_uchar *top_icon = get_jewel(board.tile(bothX, topY).jewel()); - prog_uchar *bot_icon = get_jewel(board.tile(bothX, topY+1).jewel()); + const unsigned char *top_icon = get_jewel(board.tile(bothX, topY).jewel()); + const unsigned char *bot_icon = get_jewel(board.tile(bothX, topY+1).jewel()); byte local_top[8]; for (unsigned i = 0; i < 8; i++) local_top[i] = pgm_read_byte_near(top_icon + i + 1); byte local_bot[8]; @@ -512,4 +512,3 @@ void loop () gamby.setPos(0,0); } } - diff --git a/examples/Games/Jewels/gameover.ino b/examples/Games/Jewels/gameover.ino index 6050bc5..d8fd5d4 100644 --- a/examples/Games/Jewels/gameover.ino +++ b/examples/Games/Jewels/gameover.ino @@ -44,7 +44,7 @@ void dissolve_away() // ........ ........ ........ ........ ........ ........ ........ ........ // ........ ........ ........ ........ ........ ........ ........ ........ -PROGMEM prog_uchar loss_display_top[65] = {64, +PROGMEM const unsigned char loss_display_top[65] = {64, B00000110, B00000010, B11100110, B00010010, B00010110, B00010010, B00100110, B00000010, B00000110, B11000010, B00100110, B00010010, B00100110, B11000010, B00000110, B00000010, B11110110, B00100010, B11000110, B00100010, B11110110, B00000010, B00000110, B11110010, @@ -54,7 +54,7 @@ PROGMEM prog_uchar loss_display_top[65] = {64, B00000110, B00000010, B11110110, B10010010, B10010110, B00010010, B00010110, B00000010, B00000110, B11110010, B10010110, B10010010, B10010110, B01100010, B00000110, B00000010 }; -PROGMEM prog_uchar loss_display_bottom[65] = {64, +PROGMEM const unsigned char loss_display_bottom[65] = {64, B00100000, B00110000, B00100011, B00110100, B00100100, B00110101, B00100111, B00110000, B00100000, B00110111, B00100001, B00110001, B00100001, B00110111, B00100000, B00110000, B00100111, B00110000, B00100000, B00110000, B00100111, B00110000, B00100000, B00110111, @@ -138,7 +138,7 @@ void do_loss_animation() -PROGMEM prog_uchar win_display[8][65] = { +PROGMEM const unsigned char win_display[8][65] = { {64, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B10000000, @@ -280,4 +280,3 @@ bool check_end() if (redraw) init_board(); return redraw; } - diff --git a/examples/Games/Jewels/jools.ino b/examples/Games/Jewels/jools.ino index 5720624..94273fd 100644 --- a/examples/Games/Jewels/jools.ino +++ b/examples/Games/Jewels/jools.ino @@ -3,7 +3,7 @@ // we represent them as 8x8-pixel icons // this allows us to present a game field of 8x8 icons, with 32 px on the side -PROGMEM prog_uchar jewels[8][9] = { +PROGMEM const unsigned char jewels[8][9] = { // hexagon (orange) // . . . X . . . . // . . X . X . . . @@ -95,9 +95,7 @@ PROGMEM prog_uchar jewels[8][9] = { {8, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000}, }; -prog_uchar* get_jewel(unsigned id) +const unsigned char* get_jewel(unsigned id) { return jewels[id]; } - - diff --git a/examples/Games/Jewels/sidebar.ino b/examples/Games/Jewels/sidebar.ino index eea00d2..bb22d1f 100644 --- a/examples/Games/Jewels/sidebar.ino +++ b/examples/Games/Jewels/sidebar.ino @@ -29,21 +29,21 @@ // . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . . . // . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . . . -PROGMEM prog_uchar sidebar_top[65] = {32, +PROGMEM const unsigned char sidebar_top[65] = {32, B11111111, B01111111, B10111111, B10111111, B10111111, B01111111, B01111111, B11111111, B01111111, B11111111, B10111111, B11111111, B11011111, B10111111, B11111111, B10101111, B01111111, B10101111, B11111111, B01010111, B10111111, B11010111, B01111111, B10101011, B10011111, B00101011, B01011111, B10101101, B01011011, B10110111, B01001101, B00110111 }; -PROGMEM prog_uchar sidebar_mid[65] = {32, +PROGMEM const unsigned char sidebar_mid[65] = {32, B11010111, B01011101, B00000000, B11111111, B00000000, B01110111, B10011001, B10010101, B10010101, B01001001, B10000100, B00011101, B11100100, B00110001, B00011100, B11100001, B00110101, B00001100, B01110000, B10011001, B10010100, B10010100, B01001001, B10000000, B11111111, B10000000, B01001001, B10010100, B10010100, B01100100, B00000001, B00000000 }; -PROGMEM prog_uchar sidebar_bot[65] = {32, +PROGMEM const unsigned char sidebar_bot[65] = {32, B00100000, B00000010, B00000001, B00001000, B00100000, B00001001, B00000010, B00000000, B00000010, B00010000, B00000000, B00000010, B00000000, B00000100, B00000000, B00000000, B00000000, B00000001, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, @@ -61,7 +61,7 @@ void draw_sidebar() draw_score(); } -PROGMEM prog_uchar digiticons[10][7] = { +PROGMEM const unsigned char digiticons[10][7] = { // zero // . X X X X . // X X . . X X @@ -180,7 +180,7 @@ void draw_score() unsigned local_score = score; do { unsigned digit = local_score % 10; - prog_uchar *icon = digiticons[digit]; + const unsigned char *icon = digiticons[digit]; byte char_width = pgm_read_byte_near(icon); startPos -= char_width; gamby.setPos(startPos, 5); @@ -189,5 +189,3 @@ void draw_score() startPos -= 1; } while (local_score > 0); } - - diff --git a/examples/Games/SimianSays/SimianSays.ino b/examples/Games/SimianSays/SimianSays.ino index 9049ec5..b5bc356 100644 --- a/examples/Games/SimianSays/SimianSays.ino +++ b/examples/Games/SimianSays/SimianSays.ino @@ -17,11 +17,11 @@ by David R. Stokes (gamby@logicalzero.com) 2012-09-18 // Bring in the font from the 'font' tab (font.ino) // Bring in all the icons from the 'artwork' tab (artwork.ino) -extern prog_int32_t font[]; -extern prog_uchar splashscreen[]; -extern prog_uchar gameover[]; -extern prog_uchar monkeyIcon[]; -extern prog_uchar buttonIcons[]; +extern const int32_t font[]; +extern const unsigned char splashscreen[]; +extern const unsigned char gameover[]; +extern const unsigned char monkeyIcon[]; +extern const unsigned char buttonIcons[]; // Some sets of numbers. These don't actually change. int notes[] = {220, 247, 262, 294}; // The musical notes associated with each button diff --git a/examples/Games/SimianSays/artwork.ino b/examples/Games/SimianSays/artwork.ino index f31521c..2b046b1 100644 --- a/examples/Games/SimianSays/artwork.ino +++ b/examples/Games/SimianSays/artwork.ino @@ -3,7 +3,7 @@ // The introductory 'splash screen' with the game's title. // It is stored as 8-pixel-high 'icons' the full width of the LCD with a separate 'frame' for // each piece of the larger image. -PROGMEM prog_uchar splashscreen[] = {96, +PROGMEM const unsigned char splashscreen[] = {96, // Row 0 ("frame" 0) 84, 0, 202, 228, 224, 50, 48, 114, 96, 226, 192, 0, 12, 158, 158, 12, 192, 224, 224, 0, 128, 224, 240, 240, 240, 0, 8, 144, 196, 232, 226, 196, 0, 132, 206, 206, 6, 0, 53, 48, 186, 153, 248, 241, @@ -45,7 +45,7 @@ PROGMEM prog_uchar splashscreen[] = {96, // The "Game Over" screen. It's only 16 pixels high and displayed in the middle of the LCD. // Each 8 pixel stripe is a different 'frame.' -PROGMEM prog_uchar gameover[] = { +PROGMEM const unsigned char gameover[] = { 96, 0, 0, 120, 252, 206, 134, 195, 247, 255, 127, 0, 0, 204, 204, 238, 230, 230, 126, 252, 248, 0, 248, 252, 252, 192, 240, 124, 254, 254, 254, 192, 224, 112, 56, 252, 252, 248, 0, 248, 252, 254, 14, 134, 134, 252, 248, 112, 0, 0, 0, 0, 0, 128, 192, 240, 48, 48, 48, 240, 224, 156, 124, 252, 240, 192, 0, 128, 240, 254, 127, 15, 194, 224, 240, 48, 48, 48, 224, 192, 128, 30, 254, 252, 248, 124, 30, 14, 6, 12, 12, 128, 254, 255, 15, 0, 0, 0, 0, 24, 57, 113, 97, 97, 127, 127, 60, 0, 15, 31, 31, 25, 56, 120, 120, 127, 63, 0, 15, 31, 31, 15, 1, 0, 31, 31, 15, 7, 1, 0, 112, 127, 127, 15, 0, 3, 15, 31, 63, 51, 49, 49, 56, 24, 0, 0, 0, 0, 0, 15, 31, 63, 48, 48, 56, 63, 31, 7, 0, 1, 7, 15, 31, 31, 7, 1, 0, 0, 7, 31, 63, 126, 103, 99, 99, 113, 49, 0, 63, 63, 31, 0, 0, 0, 0, 0, 28, 61, 57, 1, 0, 0, 0 @@ -54,7 +54,7 @@ PROGMEM prog_uchar gameover[] = { // The 'lives left' monkey icon. // It consists of a 2 frame icon, frame 0 is the top half, 1 is the bottom. -PROGMEM prog_uchar monkeyIcon[] = { +PROGMEM const unsigned char monkeyIcon[] = { 17, // icon width // Top half of monkey face ("frame" 0) 192, 96, 48, 248, 60, 206, 230, 15, 255, 63, 207, 230, 14, 252, 48, 32, 192, @@ -65,7 +65,7 @@ PROGMEM prog_uchar monkeyIcon[] = { // The button images. This is a bit more complex: there are four buttons, each 3 lines tall, // each with 2 states. Different 'frames' are used for each of these. -PROGMEM prog_uchar buttonIcons[] = {24, +PROGMEM const unsigned char buttonIcons[] = {24, // button 1 'off' (frames 0-2) 0, 0, 0, 0, 0, 0, 0, 0, 64, 96, 96, 224, 224, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -99,6 +99,3 @@ PROGMEM prog_uchar buttonIcons[] = {24, 126, 255, 255, 255, 255, 255, 31, 15, 3, 33, 48, 60, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 126, 0, 3, 7, 15, 31, 63, 127, 127, 127, 255, 255, 255, 248, 248, 248, 127, 127, 127, 63, 31, 15, 7, 3, 0 }; - - - diff --git a/examples/Games/SimianSays/font.ino b/examples/Games/SimianSays/font.ino index 78dc6a0..24ee9e4 100644 --- a/examples/Games/SimianSays/font.ino +++ b/examples/Games/SimianSays/font.ino @@ -5,7 +5,7 @@ // bits 0-24: the character bitmap (by column) // bits 25-27: character vertical offset // bits 28-31: character width -PROGMEM prog_int32_t font[] = { +PROGMEM const int32_t font[] = { 0x00000002L, // character ' ' (32) 0xB8000001L, // character '!' (33) 0x18060003L, // character '"' (34) @@ -101,7 +101,5 @@ PROGMEM prog_int32_t font[] = { 0xD8000001L, // character '|' (124) 0x8FC80003L, // character '}' (125) 0x20882004L, // character '~' (126) - 0xFC631F85L, // character '' (127) + 0xFC631F85L, // character ' (127) }; - - diff --git a/examples/_Templates/BlockModeTemplate/BlockModeTemplate.ino b/examples/_Templates/BlockModeTemplate/BlockModeTemplate.ino index 30a9f2b..5f73327 100644 --- a/examples/_Templates/BlockModeTemplate/BlockModeTemplate.ino +++ b/examples/_Templates/BlockModeTemplate/BlockModeTemplate.ino @@ -16,7 +16,7 @@ by David R. Stokes (gamby@logicalzero.com) 2012-08-28 // or all of the individual blocks, but a palette can have no more than 16 // blocks in it. Typically, you will have only one per sketch, but it is // possible to create more than one and switch between them. -PROGMEM prog_uint16_t palette[] = { +PROGMEM const uint16_t palette[] = { 0x0000, // 0 All 'white' (block 0 should almost always be 0x0000) 0xffff, // 1 All 'black' 0x5a5a, // 2 50% gray dither @@ -47,7 +47,7 @@ void setup() { // just after initializing Gamby. You could, however, do this elsewhere in // your sketch -- for example, if you had a role-playing game and had an // 'indoor' and an 'outdoor' palette. - gamby.palette = blocks; + gamby.palette = palette; // That's all that's required! From here on, it's up to you. All of Gamby's // functionality is contained in the 'gamby' object, which you use like @@ -62,4 +62,3 @@ void setup() { void loop () { // Your code here! } - diff --git a/examples/_Templates/TextModeTemplate/TextModeTemplate.ino b/examples/_Templates/TextModeTemplate/TextModeTemplate.ino index 7849783..2113cbe 100644 --- a/examples/_Templates/TextModeTemplate/TextModeTemplate.ino +++ b/examples/_Templates/TextModeTemplate/TextModeTemplate.ino @@ -12,7 +12,7 @@ by David R. Stokes (gamby@logicalzero.com) 2012-07-06 #include // Bring in the font from the 'font' tab (font.ino) -extern prog_int32_t font[]; +extern const int32_t font[]; // Each of Gamby's 'modes' are wrapped in a class, a self-contained unit // that bundles together all the required functionality. To use a mode, diff --git a/examples/_Templates/TextModeTemplate/font.ino b/examples/_Templates/TextModeTemplate/font.ino index ea6da16..dedf55d 100644 --- a/examples/_Templates/TextModeTemplate/font.ino +++ b/examples/_Templates/TextModeTemplate/font.ino @@ -5,7 +5,7 @@ // bits 0-24: the character bitmap (by column) // bits 25-27: character vertical offset // bits 28-31: character width -PROGMEM prog_int32_t font[] = { +PROGMEM const int32_t font[] = { 0x00000002L, // character ' ' (32) 0xB8000001L, // character '!' (33) 0x18060003L, // character '"' (34)