added title sprites, added comma and apostrophe to fonts

This commit is contained in:
Rudis Muiznieks 2022-06-19 13:53:48 -05:00
parent b40277bdc5
commit 59a09e1cdf
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
8 changed files with 75 additions and 23 deletions

View File

@ -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.

View File

@ -5,8 +5,8 @@ License: WTFPL
*/
#include <Arduboy2.h>
#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;

View File

@ -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
@ -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 // ░░░░░░░░
};
@ -411,6 +423,14 @@ void Font3x5::printChar(const char c, const int8_t x, int8_t y) {
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) {

View File

@ -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 // ░░░░░░░░
};
@ -475,6 +488,14 @@ void Font4x6::printChar(const char c, const int8_t x, int8_t y) {
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) {

View File

@ -385,6 +385,7 @@ void handleFightMenuInput() {
sPreviousGameState = pMoney >= 1200
? STATE_HEAL_DIALOG : STATE_TURN_MENU;
sGameState = STATE_INFO_DIALOG;
// TODO: draw apostrophe :(
}
}
}