fix examples with now breaking API changes

This commit is contained in:
Josh Goebel 2016-02-28 02:14:53 -05:00 committed by Scott Allen
parent 8eb4deed69
commit c5445c7b9c
2 changed files with 9 additions and 7 deletions

View File

@ -16,9 +16,10 @@ version 2.1 of the License, or (at your option) any later version.
// Make an instance of arduboy used for many functions // Make an instance of arduboy used for many functions
Arduboy arduboy; Arduboy arduboy;
AbPrinter text(arduboy);
// Variables for your game go here. // Variables for your game go here.
char text[] = "Press Buttons!"; char title[] = "Press Buttons!";
byte x; byte x;
byte y; byte y;
@ -52,7 +53,7 @@ void setup() {
// here we set the framerate to 30, we do not need to run at default 60 and // here we set the framerate to 30, we do not need to run at default 60 and
// it saves us battery life. // it saves us battery life.
arduboy.setFrameRate(30); arduboy.setFrameRate(30);
// set x and y to the middle of the screen // set x and y to the middle of the screen
x = (WIDTH / 2) - (NUM_CHARS * CHAR_WIDTH / 2); x = (WIDTH / 2) - (NUM_CHARS * CHAR_WIDTH / 2);
y = (HEIGHT / 2) - (CHAR_HEIGHT / 2); y = (HEIGHT / 2) - (CHAR_HEIGHT / 2);
@ -96,10 +97,10 @@ void loop() {
arduboy.clear(); arduboy.clear();
// we set our cursor x pixels to the right and y down from the top // we set our cursor x pixels to the right and y down from the top
arduboy.setCursor(x, y); text.setCursor(x, y);
// then we print to screen what is stored in our text variable we declared earlier // then we print to screen what is stored in our text variable we declared earlier
arduboy.print(text); text.print(title);
// then we finaly we tell the arduboy to display what we just wrote to the display. // then we finaly we tell the arduboy to display what we just wrote to the display.
arduboy.display(); arduboy.display();

View File

@ -15,6 +15,7 @@ version 2.1 of the License, or (at your option) any later version.
// make an instance of arduboy used for many functions // make an instance of arduboy used for many functions
Arduboy arduboy; Arduboy arduboy;
AbPrinter text(arduboy);
// This function runs once in your game. // This function runs once in your game.
@ -40,11 +41,11 @@ void loop() {
arduboy.clear(); arduboy.clear();
// we set our cursor 5 pixels to the right and 10 down from the top // we set our cursor 5 pixels to the right and 10 down from the top
// (positions start at 0, 0) // (positions start at 0, 0)
arduboy.setCursor(4, 9); text.setCursor(4, 9);
// then we print to screen what is in the Quotation marks "" // then we print to screen what is in the Quotation marks ""
arduboy.print(F("Hello, world!")); text.print(F("Hello, world!"));
// then we finaly we tell the arduboy to display what we just wrote to the display // then we finaly we tell the arduboy to display what we just wrote to the display
arduboy.display(); arduboy.display();