generated from 32blit/32blit-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutputManager.hpp
57 lines (49 loc) · 1.69 KB
/
OutputManager.hpp
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
/*
* OutputManager.hpp - part of 32Blox (revised edition!)
*
* Copyright (C) 2020 Pete Favelle <32blit@ahnlak.com>
*
* This file is released under the MIT License; see LICENSE for details
*
* The OutputManager is a singleton class to manage outputs; implemented as a
* singleton because it's interacted with from everywhere and I'm trying to hide
* the fact that this is, basically, a global :-)
*/
#ifndef _OUTPUTMANAGER_HPP_
#define _OUTPUTMANAGER_HPP_
typedef struct
{
bool sound_enabled;
bool music_enabled;
bool haptic_enabled;
} output_flags_t;
#define CHANNEL_MUSIC 0
#define CHANNEL_LEVEL 4
#define CHANNEL_FALLING 5
#define CHANNEL_PICKUP 6
#define CHANNEL_BOUNCE 7
class OutputManager
{
private:
OutputManager( void );
output_flags_t flags;
blit::Tween haptic_tween;
void play_music( void );
void stop_music( void );
public:
static OutputManager &get_instance( void );
bool sound_enabled( void );
bool music_enabled( void );
bool haptic_enabled( void );
void enable_sound( bool );
void enable_music( bool );
void enable_haptic( bool );
void update( uint32_t );
void trigger_haptic( float, uint32_t );
void play_effect_bounce( uint16_t );
void play_effect_pickup( void );
void play_effect_falling( uint8_t );
void play_effect_level_complete( void );
};
#endif /* _OUTPUTMANAGER_HPP_ */
/* End of OutputManager.hpp */