-
Notifications
You must be signed in to change notification settings - Fork 41
/
Player.h
49 lines (42 loc) · 994 Bytes
/
Player.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
#ifndef _PLAYER_H
#define _PLAYER_H
#include "StateMachine.h"
class Player : public StateMachine
{
public:
Player();
// External events taken by this state machine
void OpenClose();
void Play();
void Stop();
void Pause();
void EndPause();
private:
// State enumeration order must match the order of state method entries
// in the state map.
enum States
{
ST_EMPTY,
ST_OPEN,
ST_STOPPED,
ST_PAUSED,
ST_PLAYING,
ST_MAX_STATES
};
// Define the state machine states
STATE_DECLARE(Player, Empty, NoEventData)
STATE_DECLARE(Player, Open, NoEventData)
STATE_DECLARE(Player, Stopped, NoEventData)
STATE_DECLARE(Player, Paused, NoEventData)
STATE_DECLARE(Player, Playing, NoEventData)
// State map to define state object order. Each state map entry defines a
// state object.
BEGIN_STATE_MAP
STATE_MAP_ENTRY(&Empty)
STATE_MAP_ENTRY(&Open)
STATE_MAP_ENTRY(&Stopped)
STATE_MAP_ENTRY(&Paused)
STATE_MAP_ENTRY(&Playing)
END_STATE_MAP
};
#endif