diff --git a/README.md b/README.md index 4a3f48c..3e7727a 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,5 @@ Your port path (`-p` argument) may differ depending on your system. Font libraries used: - [Font3x5](https://github.com/filmote/Font3x5) - [Font4x6](https://github.com/filmote/Font4x6) + +Slightly modified to add missing comma and apostrophe characters. diff --git a/slangin.ino b/slangin.ino index f9c946b..6b3ef34 100644 --- a/slangin.ino +++ b/slangin.ino @@ -5,8 +5,8 @@ License: WTFPL */ #include -#include "src/fonts/Font3x5.h" -#include "src/fonts/Font4x6.h" +#include "src/Font3x5.h" +#include "src/Font4x6.h" Arduboy2 arduboy; Font4x6 font4x6 = Font4x6(); @@ -67,6 +67,14 @@ const uint8_t PROGMEM spriteAdjust[] = { 0x24, 0x66, 0xe7, 0x66, 0x24, }; +const uint8_t PROGMEM spriteWeed[] = { +30, 30, +0x00, 0x00, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x78, 0x07, 0x06, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x00, +0x00, 0x00, 0x03, 0x3c, 0xc1, 0x02, 0x04, 0x08, 0x10, 0x20, 0xc0, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xc0, 0x20, 0x10, 0x08, 0x04, 0x04, 0xc2, 0x39, 0x07, 0x00, 0x00, +0x38, 0x50, 0x90, 0x90, 0x90, 0x23, 0x24, 0x48, 0x50, 0x60, 0x81, 0x26, 0x08, 0xe7, 0x00, 0x90, 0xe7, 0x08, 0x26, 0x01, 0x60, 0x50, 0x48, 0x26, 0xa1, 0x90, 0x90, 0x90, 0x50, 0x30, +0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x22, 0x32, 0x2a, 0x24, 0x22, 0x10, 0x0a, 0x08, 0x0c, 0x08, 0x12, 0x21, 0x24, 0x2a, 0x32, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + /**************/ /* game state */ /**************/ @@ -139,9 +147,11 @@ void loop() { switch (sGameState) { case STATE_TITLE: - arduboy.setCursor(25, 10); - arduboy.print(F("Slangin' v0.9")); - menu[0] = F("Hit the Streets"); + Sprites::drawOverwrite(0, 0, spriteWeed, 0); + Sprites::drawOverwrite(98, 0, spriteWeed, 0); + arduboy.setCursor(42, 15); + arduboy.print(F("Slangin'")); + menu[0] = F("Hit the Streets!!"); menuLength = 1; menuSmall = false; menuCols = false; @@ -255,6 +265,7 @@ void loop() { dialogSmall = false; drawDialog(); drawYesNoPrompt(); + sPreviousGameState = STATE_TURN_MENU; break; case STATE_INFO_DIALOG: @@ -268,15 +279,12 @@ void loop() { case STATE_DID_WEED_DIALOG_1: dialog[0] = "You hallucinate on the"; dialog[1] = "wildest trip of your"; - dialog[2] = "life stumble onto the"; - dialog[3] = "subway tracks and get"; + dialog[2] = "life, stumble onto the"; + dialog[3] = "subway tracks, and get"; dialog[4] = "creamed by a train."; dialogLength = 5; dialogSmall = true; drawDialog(); - // draw a comma manually since the font doesn't have one - arduboy.drawRect(32, 34, 1, 1, WHITE); - arduboy.drawRect(31, 35, 1, 1, WHITE); sPreviousGameState = STATE_DID_WEED_DIALOG_2; break; diff --git a/src/fonts/Font3x5.cpp b/src/Font3x5.cpp similarity index 95% rename from src/fonts/Font3x5.cpp rename to src/Font3x5.cpp index 5ee5ce4..4660a70 100644 --- a/src/fonts/Font3x5.cpp +++ b/src/Font3x5.cpp @@ -10,6 +10,8 @@ #define CHAR_EXCLAMATION 33 #define CHAR_PERIOD 46 +#define CHAR_COMMA 44 +#define CHAR_APOSTROPHE 39 #define CHAR_LETTER_A 65 #define CHAR_LETTER_Z 90 #define CHAR_LETTER_A_LOWER 97 @@ -29,7 +31,7 @@ const uint8_t PROGMEM font_images[] = { 3, 8, - + // #65 Letter 'A'. 0x1F, // ░░░▓▓▓▓▓ 0x05, // ░░░░░▓░▓ @@ -161,7 +163,7 @@ const uint8_t PROGMEM font_images[] = { 0x13, // ░░░▓░░▓▓ #ifdef USE_LOWER_CASE - + // #97 Letter 'a'. 0x0C, // ░░░░▓▓░░ 0x12, // ░░░▓░░▓░ @@ -352,6 +354,16 @@ const uint8_t PROGMEM font_images[] = { // #46 Symbol '.'. 0x00, // ░░░░░░░░ 0x10, // ░░░▓░░░░ + 0x00, // ░░░░░░░░ + // + // #44 Symbol ','. + 0x20, // ░░▓░░░░░ + 0x10, // ░░░▓░░░░ + 0x00, // ░░░░░░░░ + // + // #39 Symbol '''. + 0x00, // ░░░░░░░░ + 0x03, // ░░░░░░▓▓ 0x00 // ░░░░░░░░ }; @@ -388,12 +400,12 @@ void Font3x5::printChar(const char c, const int8_t x, int8_t y) { ++y; switch (c) { - + case CHAR_LETTER_A ... CHAR_LETTER_Z: idx = c - CHAR_LETTER_A; break; -#ifdef USE_LOWER_CASE +#ifdef USE_LOWER_CASE case CHAR_LETTER_A_LOWER ... CHAR_LETTER_Z_LOWER: idx = c - CHAR_LETTER_A_LOWER + 26; break; @@ -402,19 +414,27 @@ void Font3x5::printChar(const char c, const int8_t x, int8_t y) { case CHAR_NUMBER_0 ... CHAR_NUMBER_9: idx = c - CHAR_NUMBER_0 + FONT_NUMBER_INDEX; break; - + case CHAR_EXCLAMATION: idx = FONT_EXCLAMATION_INDEX; break; - + case CHAR_PERIOD: idx = FONT_PERIOD_INDEX; break; + case CHAR_COMMA: + idx = FONT_PERIOD_INDEX + 1; + break; + + case CHAR_APOSTROPHE: + idx = FONT_PERIOD_INDEX + 2; + break; + } if (idx > -1) { - + if (_textColor == WHITE) { Sprites::drawSelfMasked(x, y, font_images, idx); } diff --git a/src/fonts/Font3x5.h b/src/Font3x5.h similarity index 100% rename from src/fonts/Font3x5.h rename to src/Font3x5.h diff --git a/src/fonts/Font4x6.cpp b/src/Font4x6.cpp similarity index 95% rename from src/fonts/Font4x6.cpp rename to src/Font4x6.cpp index d133e9e..65f0a55 100644 --- a/src/fonts/Font4x6.cpp +++ b/src/Font4x6.cpp @@ -10,6 +10,8 @@ #define CHAR_EXCLAMATION 33 #define CHAR_PERIOD 46 +#define CHAR_COMMA 44 +#define CHAR_APOSTROPHE 39 #define CHAR_LETTER_A 65 #define CHAR_LETTER_Z 90 #define CHAR_LETTER_A_LOWER 97 @@ -416,8 +418,19 @@ const uint8_t PROGMEM font_images[] = { 0x00, // ░░░░░░░░ 0x20, // ░░▓░░░░░ 0x00, // ░░░░░░░░ - 0x00 // ░░░░░░░░ + 0x00, // ░░░░░░░░ + // #44 Symbol ','. + 0x40, // ░▓░░░░░░ + 0x20, // ░░▓░░░░░ + 0x00, // ░░░░░░░░ + 0x00, // ░░░░░░░░ + // + // #39 Symbol '''. + 0x00, // ░░░░░░░░ + 0x03, // ░░░░░░▓▓ + 0x00, // ░░░░░░░░ + 0x00 // ░░░░░░░░ }; @@ -452,12 +465,12 @@ void Font4x6::printChar(const char c, const int8_t x, int8_t y) { ++y; switch (c) { - + case CHAR_LETTER_A ... CHAR_LETTER_Z: idx = c - CHAR_LETTER_A; break; -#ifdef USE_LOWER_CASE +#ifdef USE_LOWER_CASE case CHAR_LETTER_A_LOWER ... CHAR_LETTER_Z_LOWER: idx = c - CHAR_LETTER_A_LOWER + 26; break; @@ -466,19 +479,27 @@ void Font4x6::printChar(const char c, const int8_t x, int8_t y) { case CHAR_NUMBER_0 ... CHAR_NUMBER_9: idx = c - CHAR_NUMBER_0 + FONT_NUMBER_INDEX; break; - + case CHAR_EXCLAMATION: idx = FONT_EXCLAMATION_INDEX; break; - + case CHAR_PERIOD: idx = FONT_PERIOD_INDEX; break; + case CHAR_COMMA: + idx = FONT_PERIOD_INDEX + 1; + break; + + case CHAR_APOSTROPHE: + idx = FONT_PERIOD_INDEX + 2; + break; + } if (idx > -1) { - + if (_textColor == WHITE) { Sprites::drawSelfMasked(x, y, font_images, idx); } diff --git a/src/fonts/Font4x6.h b/src/Font4x6.h similarity index 100% rename from src/fonts/Font4x6.h rename to src/Font4x6.h diff --git a/src/fonts/LICENSE b/src/LICENSE similarity index 100% rename from src/fonts/LICENSE rename to src/LICENSE diff --git a/states.ino b/states.ino index 0e68b34..986eb8b 100644 --- a/states.ino +++ b/states.ino @@ -385,6 +385,7 @@ void handleFightMenuInput() { sPreviousGameState = pMoney >= 1200 ? STATE_HEAL_DIALOG : STATE_TURN_MENU; sGameState = STATE_INFO_DIALOG; + // TODO: draw apostrophe :( } } }