src/platform/qt/MultiplayerController.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_MULTIPLAYER_CONTROLLER
7#define QGBA_MULTIPLAYER_CONTROLLER
8
9#include <QMutex>
10#include <QList>
11#include <QObject>
12
13extern "C" {
14#include "gba/sio/lockstep.h"
15}
16
17namespace QGBA {
18
19class GameController;
20
21class MultiplayerController : public QObject {
22Q_OBJECT
23
24public:
25 MultiplayerController();
26 ~MultiplayerController();
27
28 bool attachGame(GameController*);
29 void detachGame(GameController*);
30
31 int attached();
32 int playerId(GameController*);
33
34signals:
35 void gameAttached();
36 void gameDetached();
37
38private:
39 GBASIOLockstep m_lockstep;
40 QList<GameController*> m_players;
41 QList<int> m_asleep;
42 QMutex m_lock;
43};
44
45}
46#endif