1
Tiny Arcade / Visual Studio Code
« on: January 30, 2019, 08:14:54 PM »
Hi there! Are you guys planning to add support for debugging using Visual Studio Code? I would love to be able to use that IDE instead of the Arduino IDE.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
ts_sprite zero = { offscreen, offscreen, 3, 5, 0, zeroBitmapFont };
ts_sprite onesdigit = { 91, 2, 3, 5, 0, zeroBitmapFont };
ts_sprite tensdigit = { 87, 2, 3, 5, 0, empty };
ts_sprite hundredsdigit = { 83, 2, 3, 5, 0, empty };
ts_sprite thousandsdigit = { 79, 2, 3, 5, 0, empty };
int score = 0;
ts_sprite * numbersBitmapFont[10] = { &zero, &one, &two, &three, &four, &five, &six, &seven, &eight, &nine };
ts_sprite * digits[4] = { &thousandsdigit, &hundredsdigit, &tensdigit, &onesdigit };
void scoreUpdate() {
//Convert score to string
String scoreDisplay = String(score);
//Determine how big is the score and how many digits will be needed to display it
int startAt = 4 - scoreDisplay.length();
//Go through the string, and draw each character
for (int i = 0; i < scoreDisplay.length() ; i++) {
int c = scoreDisplay.charAt(i);
//c will have the ASCII value of the character, number 0 is 48 in ASCII
int n = c - 48;
//make digit be the right number
digits[startAt+i]->bitmap = numbersBitmapFont[n]->bitmap;
}
}