Arduboy-homemade-package/board-package-source/libraries/ArdBitmap/examples/Sample3-Resize/Sample3-Resize.ino

37 lines
1004 B
Arduino
Raw Permalink Normal View History

#include <Arduboy.h>
#include "bitmaps.h"
// make an instance of arduboy used for many functions
Arduboy arduboy;
// make an ArdBitmap instance that will use the given the screen buffer and dimensions
#define ARDBITMAP_SBUF arduboy.getBuffer()
#include <ArdBitmap.h>
ArdBitmap<WIDTH, HEIGHT> ardbitmap;
// This function runs once in your game.
// use it for anything that needs to be set only once in your game.
void setup() {
// initiate arduboy instance
arduboy.begin();
arduboy.setFrameRate(60);
}
// our main game loop, this runs once every cycle/frame.
// this is where our game logic goes.
void loop() {
// pause render until it's time for the next frame
if (!(arduboy.nextFrame()))
return;
// first we clear our screen to black
arduboy.clear();
ardbitmap.drawCompressedResized(WIDTH / 2 ,HEIGHT, BOY, WHITE, ALIGN_H_CENTER | ALIGN_V_BOTTOM, MIRROR_NONE, 0.5);
// then we finaly we tell the arduboy to display what we just wrote to the display
arduboy.display();
}