Skip to content

Commit 2772603

Browse files
committed
Added sprite functionality
1 parent 4d1b418 commit 2772603

File tree

10 files changed

+1235
-403
lines changed

10 files changed

+1235
-403
lines changed

examples/Arduino/getting_started/Roboto_Black_40.h

Lines changed: 321 additions & 323 deletions
Large diffs are not rendered by default.

examples/Arduino/getting_started/getting_started.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void setup()
4949

5050
void loop()
5151
{
52-
BBEPRECT rect;
52+
BB_RECT rect;
5353
int i, j;
5454
// initialize the I/O and memory
5555
// epaper.initPanel(BB_PANEL_T5EPAPERS3);

examples/Arduino/sprite_demo/Roboto_Regular_20.h

Lines changed: 210 additions & 0 deletions
Large diffs are not rendered by default.

examples/Arduino/sprite_demo/courierprime_14.h

Lines changed: 400 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// FastEPD Sprite Example
3+
// Written by Larry Bank August 23, 2025
4+
// Copyright (c) 2025 BitBank Software, Inc. All rights reserved
5+
//
6+
// Sprites in FastEPD refer to virtual drawing surfaces.
7+
// in other words, instances of the FastEPD class without
8+
// a physical Eink panel. Their purpose is to allow easy
9+
// re-use of prepared graphics to composite a scene or to
10+
// make use of the FastEPD font and graphics functions for
11+
// an external program to utilize.
12+
//
13+
// 1-bpp sprites can be drawn on 4-bpp surfaces, but not the reverse
14+
//
15+
#include <FastEPD.h>
16+
#include "Roboto_Regular_20.h"
17+
#include "courierprime_14.h"
18+
FASTEPD epaper;
19+
FASTEPD sprite1, sprite2;
20+
21+
void setup()
22+
{
23+
sprite1.initSprite(128, 64); // allocate the memory for 2 small drawing surfaces
24+
sprite2.initSprite(128, 64);
25+
epaper.initPanel(BB_PANEL_V7_RAW); // defaults to 1-bit mode
26+
epaper.setPanelSize(1280, 720);
27+
epaper.fillScreen(BBEP_WHITE);
28+
epaper.fullUpdate(); // clear the screen to white to begin
29+
sprite1.fillScreen(BBEP_WHITE);
30+
sprite1.setFont(courierprime_14);
31+
sprite1.setCursor(0, 24);
32+
sprite1.print("Sprite1");
33+
sprite2.fillScreen(BBEP_WHITE);
34+
sprite2.setFont(Roboto_Regular_20);
35+
sprite2.setCursor(0, 32);
36+
sprite2.print("Sprite2");
37+
for (int i=0; i<epaper.width(); i += 160) {
38+
epaper.drawSprite(&sprite1, i, 0);
39+
epaper.drawSprite(&sprite2, i, 256);
40+
}
41+
epaper.fullUpdate();
42+
} /* setup() */
43+
44+
void loop()
45+
{
46+
} /* loop() */
47+

0 commit comments

Comments
 (0)