summaryrefslogtreecommitdiffstats
path: root/pacman-c++/mainwidget.h
blob: f7113a5336e4a2418c592cc2228cc64fa0ae0068 (plain)
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
#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include "constants.h"
#include <QtGui>
#include <QtCore>

class Actor;

class MainWidget
  : public QWidget
{
  Q_OBJECT

public:
  MainWidget();

protected:
  // handling of current key
  virtual void keyPressEvent(QKeyEvent* );
  virtual void keyReleaseEvent(QKeyEvent* );

private:
  void loadDummyMap();

  void updateScore();

  // data conversion
  QPoint mapPositionToCoord(unsigned int x, unsigned int y);

  // GUI elements needed in the progress of the game
  QList<QGridLayout*> m_playerScoreLayouts;
  QGraphicsScene *m_scene;

  // map of actors in order to keep track of those instances
  QMap<Color, Actor*> m_actors;

  // key currently pressed by user
  transmission::field_t currentKey;

  // translate Qt::Key to our key format
  transmission::field_t translateKey(int);
};

#endif // MAINWIDGET_H