-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathGamebuino.h
86 lines (73 loc) · 2.71 KB
/
Gamebuino.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* (C) Copyright 2014 Aurélien Rodot. All rights reserved.
*
* This file is part of the Gamebuino Library (http://gamebuino.com)
*
* The Gamebuino 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 version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef GAMEBUINO_H
#define GAMEBUINO_H
#include <Arduino.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
#include "utility/settings.c"
#include "utility/Backlight.h"
#include "utility/Display.h"
#include "utility/Buttons.h"
#include "utility/Battery.h"
#include "utility/Sound.h"
#define load_game (*((void(*)(const char* filename))(0x7ffc/2)))
#define write_flash_page (*((void(*)(const char * page, unsigned char * buffer))(0x7ffa/2)))
#define wrap(i, imax) ((imax+i)%(imax))
class Gamebuino {
public:
Backlight backlight;
Buttons buttons;
Battery battery;
Sound sound;
Display display;
void begin();
void titleScreen(const __FlashStringHelper* name, const uint8_t *logo);
void titleScreen(const __FlashStringHelper* name);
void titleScreen(const uint8_t* logo);
void titleScreen();
boolean update();
uint8_t startMenuTimer;
uint32_t frameCount;
void setFrameRate(uint8_t fps);
void pickRandomSeed();
uint8_t getCpuLoad();
uint16_t getFreeRam();
uint16_t frameDurationMicros;
uint32_t frameStartMicros, frameEndMicros;
int8_t menu(const char* const* items, uint8_t length);
void keyboard(char* text, uint8_t length);
void popup(const __FlashStringHelper* text, uint8_t duration);
//void adjustVolume();
void changeGame();
boolean settingsAvailable();
void readSettings();
void getDefaultName(char* string);
boolean collidePointRect(int16_t x1, int16_t y1 ,int16_t x2 ,int16_t y2, int16_t w, int16_t h);
boolean collideRectRect(int16_t x1, int16_t y1, int16_t w1, int16_t h1 ,int16_t x2 ,int16_t y2, int16_t w2, int16_t h2);
boolean collideBitmapBitmap(int16_t x1, int16_t y1, const uint8_t* b1, int16_t x2, int16_t y2, const uint8_t* b2);
private:
uint8_t timePerFrame;
uint32_t nextFrameMillis;
void updatePopup();
const __FlashStringHelper* popupText;
uint8_t popupTimeLeft;
void displayBattery();
};
#endif /* GAMEBUINO_H */