gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/cross-platform/gbprinter/src/print_example.c
1 #include <gbdk/platform.h>
2 #include <stdio.h>
3 #include <stdbool.h>
4
5 #include "gbprinter.h"
6
7 #include "res/scene00001.h"
8
9 bool printer_check_cancel(void) {
10 static uint8_t keys = 0, old_keys;
11 old_keys = keys; keys = joypad();
12 return (((old_keys ^ keys) & J_B) & (keys & J_B));
13 }
14
15 void main(void) {
16 while(1) {
17 puts("Press A to print");
18 waitpad(J_A);
19 if (gbprinter_detect(PRINTER_DETECT_TIMEOUT) == PRN_STATUS_OK) {
20 if (gbprinter_print_image(scene00001_map, scene00001_tiles,
21 (PRN_TILE_WIDTH - (scene00001_WIDTH / scene00001_TILE_W)) / 2,
22 (scene00001_WIDTH / scene00001_TILE_W), (scene00001_HEIGHT / scene00001_TILE_H)) == PRN_STATUS_OK) {
23 puts("Printed OK!");
24 } else {
25 puts("Print error!");
26 }
27 } else {
28 puts("No printer!");
29 }
30 waitpadup();
31 }
32 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.