This repository was archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngine.h
More file actions
60 lines (41 loc) · 1.2 KB
/
Copy pathEngine.h
File metadata and controls
60 lines (41 loc) · 1.2 KB
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
#pragma once
#include <Arduino.h>
#include <LedControl.h>
#include "src/Vector2.h"
class Engine
{
private:
const float JOYSTICK_TRESHOLD = 0.8;
static const int TOTAL_DISPLAY = 2;
static const int PIN_BUTTON = 12;
static const int PIN_X_AXIS = A5;
static const int PIN_Y_AXIS = A4;
static const int PIN_BUZZER = 7;
static const int PIN_CS = 8;
static const int PIN_DIN = 9;
static const int PIN_CLK = 10;
LedControl mLedController = LedControl(PIN_DIN, PIN_CLK, PIN_CS, TOTAL_DISPLAY);
unsigned char mDisplay0[8];
unsigned char mDisplay1[8];
int mButtonState;
float Remap(float currentValue, float oldMin, float oldMax, float newMin, float newMax) const;
public:
static const int DISPLAY_WIDTH = 16;
static const int DISPLAY_HEIGHT = 8;
float deltaTime;
unsigned long time;
float inputX;
float inputY;
bool isButtonDown;
bool isButtonDownThisFrame;
bool isButtonUpThisFrame;
float buttonDownDuration;
Engine();
void Update(float deltaTime);
void DrawToDisplay();
void ClearDisplay();
void SetPixel(int x, int y, boolean value = true);
void SetPixel(Vector2 position, boolean value = true);
void PlaySound(int frequency, int duration);
void SetDisplayBrightness(int brightness);
};