2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
16 #include <QGraphicsScene>
17 #include "audioplayer.h"
24 class QGraphicsSceneMouseEvent
;
28 class MainArea
: public QGraphicsScene
36 /// time interval between two balls being added
46 QList
<Ball
*> m_fading
;
49 /// the blue ball is dead
52 /// the falling animation is over, we're waiting for a new game to start
59 QList
<MessagePtr
> m_welcome_msg
;
60 QList
<MessagePtr
> m_pause_msg
;
64 double radius() const;
65 QPointF
randomPoint() const;
66 QPointF
randomDirection(double val
) const;
68 Ball
* addBall(const QString
& id
);
69 bool collide(const QPointF
& a
, const QPointF
& b
,
70 double diam
, Collision
& collision
);
72 Animation
* writeMessage(const QString
& text
);
73 Animation
* writeText(const QString
& lines
, bool fade
= true);
74 void displayMessages(const QList
<KSharedPtr
<Message
> >& msgs
);
75 void playSound(int sound
);
77 void setManPosition(const QPointF
& p
);
78 void drawBackground(QPainter
*, const QRectF
&);
81 virtual void mousePressEvent(QGraphicsSceneMouseEvent
* event
);
82 virtual void focusOutEvent(QFocusEvent
*);
89 void enableSounds(bool enable
);
95 void changeBallNumber(int);
96 void changeGameTime(int);
97 void changeState(bool);