Fixes and cleanups of ArduBreakout example sketch

- Changed banner name from ARAKNOID to BREAKOUT.
- Set frame rate appropriately for the corrected nextFrame() function.
- Removed dead and non-functioning code.
- Cleaned up save, load and display of high scores.
- Made pausing the game work.
- Display the achieved score on the "game over" screen.

Also: Minor refactor of function nextFrame()
This commit is contained in:
Scott Allen 2016-09-17 18:54:55 -04:00
parent 88d5226042
commit f9dc4cb0e5
7 changed files with 54 additions and 209 deletions

View File

@ -3,6 +3,8 @@
Copyright (C) 2011 Sebastian Goscik
All rights reserved.
Modifications by Scott Allen 2016 (after previous changes by ???)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@ -10,7 +12,9 @@
*/
#include <Arduboy2.h>
#include "breakout_bitmaps.h"
// block in EEPROM to save high scores
#define EE_FILE 2
Arduboy2 arduboy;
@ -29,8 +33,8 @@ byte lives = 3; //Amount of lives
byte level = 1; //Current level
unsigned int score=0; //Score for the game
unsigned int brickCount; //Amount of bricks hit
byte pad,pad2,pad3; //Button press buffer used to stop pause repeating
byte oldpad,oldpad2,oldpad3;
boolean pad, pad2, pad3; //Button press buffer used to stop pause repeating
boolean oldpad, oldpad2, oldpad3;
char text_buffer[16]; //General string buffer
boolean start=false; //If in menu or in game
boolean initialDraw=false;//If the inital draw has happened
@ -53,7 +57,8 @@ byte tick;
void setup()
{
arduboy.begin();
arduboy.setFrameRate(25);
arduboy.setFrameRate(40);
arduboy.initRandomSeed();
}
void loop()
@ -69,7 +74,7 @@ void loop()
start = titleScreen();
if (!start)
{
start = displayHighScores(2);
start = displayHighScores(EE_FILE);
}
}
@ -80,7 +85,9 @@ void loop()
arduboy.clear();
//Selects Font
//Draws the new level
level = 1;
newLevel();
score = 0;
initialDraw=true;
}
@ -91,13 +98,13 @@ void loop()
//Pause game if FIRE pressed
pad = arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON);
if(pad >1 && oldpad==0 && released)
if(pad == true && oldpad == false && released)
{
oldpad2=0; //Forces pad loop 2 to run once
oldpad2 = false; //Forces pad loop 2 to run once
pause();
}
oldpad=pad;
oldpad = pad;
drawBall();
if(brickCount == ROWS * COLUMNS)
@ -111,14 +118,13 @@ void loop()
drawGameOver();
if (score > 0)
{
enterHighScore(2);
enterHighScore(EE_FILE);
}
arduboy.clear();
initialDraw=false;
start=false;
lives=3;
score=0;
newLevel();
}
@ -184,7 +190,6 @@ void moveBall()
yb=60;
released = false;
lives--;
drawLives();
playTone(175, 250);
if (random(0, 2) == 0)
{
@ -285,9 +290,9 @@ void moveBall()
//Release ball if FIRE pressed
pad3 = arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON);
if (pad3 == 1 && oldpad3 == 0)
if (pad3 == true && oldpad3 == false)
{
released=true;
released = true;
//Apply random direction to ball on release
if (random(0, 2) == 0)
@ -330,23 +335,17 @@ void drawPaddle()
arduboy.drawRect(xPaddle, 63, 11, 1, 1);
}
void drawLives()
{
sprintf(text_buffer, "LIVES:%u", lives);
arduboy.setCursor(0, 90);
arduboy.print(text_buffer);
}
void drawGameOver()
{
arduboy.drawPixel(xb, yb, 0);
arduboy.drawPixel(xb+1, yb, 0);
arduboy.drawPixel(xb, yb+1, 0);
arduboy.drawPixel(xb+1, yb+1, 0);
arduboy.setCursor(52, 42);
arduboy.print( "Game");
arduboy.setCursor(52, 54);
arduboy.print("Over");
arduboy.setCursor(37, 42);
arduboy.print("Game Over");
arduboy.setCursor(31, 56);
arduboy.print("Score: ");
arduboy.print(score);
arduboy.display();
delay(4000);
}
@ -363,22 +362,19 @@ void pause()
delay(150);
//Unpause if FIRE is pressed
pad2 = arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON);
if (pad2 > 1 && oldpad2 == 0 && released)
if (pad2 == true && oldpad2 == false && released)
{
arduboy.fillRect(52, 45, 30, 11, 0);
paused=false;
}
oldpad2=pad2;
oldpad2 = pad2;
}
}
void Score()
{
score += (level*10);
sprintf(text_buffer, "SCORE:%u", score);
arduboy.setCursor(80, 90);
arduboy.print(text_buffer);
}
void newLevel(){
@ -406,13 +402,7 @@ void newLevel(){
}
}
//Draws the initial lives
drawLives();
//Draws the initial score
sprintf(text_buffer, "SCORE:%u", score);
arduboy.setCursor(80, 90);
arduboy.print(text_buffer);
arduboy.display();
}
//Used to delay images while reading button input
@ -422,9 +412,9 @@ boolean pollFireButton(int n)
{
delay(15);
pad = arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON);
if(pad == 1 && oldpad == 0)
if(pad == true && oldpad == false)
{
oldpad3 = 1; //Forces pad loop 3 to run once
oldpad3 = true; //Forces pad loop 3 to run once
return true;
}
oldpad = pad;
@ -435,18 +425,18 @@ boolean pollFireButton(int n)
//Function by nootropic design to display highscores
boolean displayHighScores(byte file)
{
byte y = 10;
byte y = 8;
byte x = 24;
// Each block of EEPROM has 10 high scores, and each high score entry
// Each block of EEPROM has 7 high scores, and each high score entry
// is 5 bytes long: 3 bytes for initials and two bytes for score.
int address = file*10*5;
int address = file * 7 * 5 + EEPROM_STORAGE_SPACE_START;
byte hi, lo;
arduboy.clear();
arduboy.setCursor(32, 0);
arduboy.print("HIGH SCORES");
arduboy.display();
for(int i = 0; i < 10; i++)
for(int i = 0; i < 7; i++)
{
sprintf(text_buffer, "%2d", i+1);
arduboy.setCursor(x,y+(i*8));
@ -490,7 +480,7 @@ boolean titleScreen()
arduboy.clear();
arduboy.setCursor(16,22);
arduboy.setTextSize(2);
arduboy.print("ARAKNOID");
arduboy.print("BREAKOUT");
arduboy.setTextSize(1);
arduboy.display();
if (pollFireButton(25))
@ -502,7 +492,6 @@ boolean titleScreen()
for(byte i = 0; i < 5; i++)
{
//Draws "Press FIRE"
//arduboy.bitmap(31, 53, fire); arduboy.display();
arduboy.setCursor(31, 53);
arduboy.print("PRESS FIRE!");
arduboy.display();
@ -511,15 +500,12 @@ boolean titleScreen()
{
return true;
}
//Removes "Press FIRE"
arduboy.clear();
arduboy.setCursor(16,22);
arduboy.setTextSize(2);
arduboy.print("ARAKNOID");
arduboy.setTextSize(1);
arduboy.setCursor(31, 53);
arduboy.print(" ");
arduboy.display();
arduboy.display();
if (pollFireButton(25))
{
return true;
@ -532,7 +518,7 @@ boolean titleScreen()
//Function by nootropic design to add high scores
void enterInitials()
{
char index = 0;
byte index = 0;
arduboy.clear();
@ -565,24 +551,19 @@ void enterInitials()
delay(150);
if (arduboy.pressed(LEFT_BUTTON) || arduboy.pressed(B_BUTTON))
{
if (index > 0)
{
index--;
if (index < 0)
{
index = 0;
} else
{
playTone(1046, 250);
}
}
if (arduboy.pressed(RIGHT_BUTTON))
{
index++;
if (index > 2)
if (index < 2)
{
index = 2;
} else {
index++;
playTone(1046, 250);
}
}
@ -645,15 +626,15 @@ void enterInitials()
void enterHighScore(byte file)
{
// Each block of EEPROM has 10 high scores, and each high score entry
// Each block of EEPROM has 7 high scores, and each high score entry
// is 5 bytes long: 3 bytes for initials and two bytes for score.
int address = file * 10 * 5;
int address = file * 7 * 5 + EEPROM_STORAGE_SPACE_START;
byte hi, lo;
char tmpInitials[3];
unsigned int tmpScore = 0;
// High score processing
for(byte i = 0; i < 10; i++)
for(byte i = 0; i < 7; i++)
{
hi = EEPROM.read(address + (5*i));
lo = EEPROM.read(address + (5*i) + 1);
@ -669,7 +650,7 @@ void enterHighScore(byte file)
if (score > tmpScore)
{
enterInitials();
for(byte j=i;j<10;j++)
for(byte j = i; j < 7; j++)
{
hi = EEPROM.read(address + (5*j));
lo = EEPROM.read(address + (5*j) + 1);
@ -688,11 +669,11 @@ void enterHighScore(byte file)
tmpInitials[2] = (char)EEPROM.read(address + (5*j) + 4);
// write score and initials to current slot
EEPROM.write(address + (5*j), ((score >> 8) & 0xFF));
EEPROM.write(address + (5*j) + 1, (score & 0xFF));
EEPROM.write(address + (5*j) + 2, initials[0]);
EEPROM.write(address + (5*j) + 3, initials[1]);
EEPROM.write(address + (5*j) + 4, initials[2]);
EEPROM.update(address + (5*j), ((score >> 8) & 0xFF));
EEPROM.update(address + (5*j) + 1, (score & 0xFF));
EEPROM.update(address + (5*j) + 2, initials[0]);
EEPROM.update(address + (5*j) + 3, initials[1]);
EEPROM.update(address + (5*j) + 4, initials[2]);
// tmpScore and tmpInitials now hold what we want to
//write in the next slot.

View File

@ -1,124 +0,0 @@
#include "breakout_bitmaps.h"
PROGMEM const unsigned char title[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xE0,0x00,
0x00,0x08,0x00,0x60,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x03,0xF4,0x10,0x00,
0x00,0x0B,0xFF,0x10,0x00,0x00,0x00,0x20,0x80,0x00,0x00,0x04,0x09,0xD0,0x00,
0x00,0x0B,0x83,0xD0,0x00,0x00,0x00,0x2E,0xB8,0x00,0x00,0x05,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xD0,0x00,0x00,0x00,0x2E,0x44,0x00,0x00,0x05,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xD0,0x00,0x00,0x00,0x2E,0x34,0x00,0x00,0x05,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xCF,0xFF,0xF9,0xFF,0xAE,0x35,0xFF,0x7C,0xF9,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xC0,0x00,0x06,0x00,0x4E,0x66,0x00,0x83,0x01,0xE1,0xD0,0x00,
0x00,0x0B,0xFF,0x13,0xE7,0xF0,0xFF,0x0F,0xE0,0x7E,0x38,0x73,0xF9,0xD0,0x00,
0x00,0x0B,0xFF,0x13,0xE7,0xF0,0xFF,0x0F,0xC0,0x7E,0x38,0x73,0xF9,0xD0,0x00,
0x00,0x0B,0x83,0xDC,0x0E,0x0C,0x01,0xCF,0x80,0xE1,0x38,0x71,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xDC,0xCE,0x0C,0x01,0xCF,0xC0,0xE1,0x38,0x71,0xE1,0xD0,0x00,
0x00,0x0B,0x83,0xDD,0x2F,0xF0,0x7F,0xCE,0xE0,0xE1,0x38,0x71,0xE0,0x10,0x00,
0x00,0x0B,0x83,0xDD,0x2F,0xF0,0xFF,0xCE,0x70,0xE1,0x38,0x71,0xE0,0x10,0x00,
0x00,0x0B,0x83,0xDD,0x2E,0x00,0x81,0xCE,0x38,0xE1,0x38,0x71,0xE1,0xD0,0x00,
0x00,0x0B,0xFF,0x1D,0x27,0xFC,0xFE,0xCE,0x1C,0x7E,0x1F,0xC4,0x79,0xD0,0x00,
0x00,0x0B,0xFF,0x1D,0x17,0xFC,0x7E,0xCE,0x0C,0x7E,0x1F,0xCA,0x79,0xD0,0x00,
0x00,0x08,0x00,0x41,0x10,0x01,0x00,0x00,0xE1,0x00,0xC0,0x11,0x00,0x10,0x00,
0x00,0x07,0xFF,0xBE,0x0F,0xFE,0xFF,0xFF,0x1E,0xFF,0x3F,0xE0,0xFF,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x04,0x04,0x10,0x03,0x8A,0x10,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x04,0x00,0x00,0x02,0x08,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xF3,0x35,0x54,0xD7,0x63,0x1A,0xD7,0x60,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x95,0x46,0x54,0x95,0x52,0x2A,0x95,0x50,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x93,0x35,0x25,0x97,0x53,0x9A,0x57,0x50,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xF0,0x06,0x04,0x00,0x04,0x00,0x38,0x00,0x0A,0x00,0x00,0x00,
0x00,0x00,0x00,0x88,0x09,0x04,0x00,0x20,0x00,0x44,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0xF2,0x84,0x27,0x31,0xB5,0x98,0x40,0xC6,0x6A,0x80,0x00,0x00,
0x00,0x00,0x00,0x8A,0x82,0x54,0x8A,0x24,0x54,0x4D,0x28,0x8B,0x00,0x00,0x00,
0x00,0x00,0x00,0x8A,0x89,0x44,0xA8,0xA5,0x54,0x45,0x22,0x8A,0x80,0x00,0x00,
0x00,0x00,0x00,0xF1,0x06,0x37,0x1B,0x14,0xD4,0x3C,0xCC,0x6A,0x80,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
PROGMEM const unsigned char fire[] =
{
57,8,
0xF8,0x00,0x00,0x00,0x3D,0xEF,0x8F,0x80,
0xCC,0x00,0x00,0x00,0x60,0xCC,0xD8,0x00,
0xCC,0x00,0x00,0x00,0x60,0xCC,0xD8,0x00,
0xF9,0x67,0x1E,0x78,0x78,0xCF,0x9F,0x00,
0xC1,0x8C,0xA0,0x80,0x60,0xCC,0xD8,0x00,
0xC1,0x8F,0x1C,0x70,0x60,0xCC,0xD8,0x00,
0xC1,0x8C,0x02,0x08,0x60,0xCC,0xDF,0x80,
0xC1,0x87,0xBC,0xF0,0x61,0xEC,0xCF,0x80,
};
PROGMEM const unsigned char arrow[] =
{
5,5,
0x20,
0x10,
0xF8,
0x10,
0x20,
};

View File

@ -1,10 +0,0 @@
#ifndef BREAKOUT_BITMAPS_H
#define BREAKOUT_BITMAPS_H
#include <avr/pgmspace.h>
extern const unsigned char fire[];
extern const unsigned char title[];
extern const unsigned char arrow[];
#endif

View File

@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/MLXXXp/Arduboy2.git"
},
"version": "2.0.4",
"version": "2.0.5",
"exclude": "extras",
"frameworks": "arduino",
"platforms": "atmelavr"

View File

@ -1,5 +1,5 @@
name=Arduboy2
version=2.0.4
version=2.0.5
author=Chris J. Martinez, Kevin Bates, Josh Goebel, Scott Allen, Ross O. Shoger
maintainer=Scott Allen saydisp-git@yahoo.ca
sentence=An alternative library for use with the Arduboy game system.

View File

@ -123,7 +123,6 @@ bool Arduboy2Base::everyXFrames(uint8_t frames)
bool Arduboy2Base::nextFrame()
{
unsigned long now = millis();
uint8_t remaining;
// post render
if (post_render) {
@ -134,10 +133,9 @@ bool Arduboy2Base::nextFrame()
// if it's not time for the next frame yet
if (now < nextFrameStart) {
remaining = nextFrameStart - now;
// if we have more than 1ms to spare, lets sleep
// we should be woken up by timer0 every 1ms, so this should be ok
if (remaining > 1)
if ((uint8_t)(nextFrameStart - now) > 1)
idle();
return false;
}

View File

@ -9,7 +9,7 @@
// For a version number in the form of x.y.z the value of the define will be
// ((x * 10000) + (y * 100) + (z)) as a decimal number.
// So, it will read as xxxyyzz, with no leading zeros on x.
#define ARDUBOY_LIB_VER 20004
#define ARDUBOY_LIB_VER 20005
// EEPROM settings
#define EEPROM_VERSION 0